-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
69dd85f
commit ea65dd1
Showing
16 changed files
with
131 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...energy_journal/api/viewsets/energy_log.py → ilgi/energy_journal/viewsets.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class FinanceConfig(AppConfig): | ||
name = "ilgi.finance" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Generated by Django 5.1.2 on 2024-11-30 12:37 | ||
|
||
import django.core.validators | ||
import uuid | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="EnergyLog", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"external_id", | ||
models.UUIDField(db_index=True, default=uuid.uuid4, unique=True), | ||
), | ||
( | ||
"created_at", | ||
models.DateTimeField(auto_now_add=True, db_index=True, null=True), | ||
), | ||
( | ||
"updated_at", | ||
models.DateTimeField(auto_now=True, db_index=True, null=True), | ||
), | ||
("deleted", models.BooleanField(db_index=True, default=False)), | ||
("title", models.CharField(max_length=255)), | ||
("story", models.TextField()), | ||
("date", models.DateField()), | ||
( | ||
"energy_delta", | ||
models.SmallIntegerField( | ||
validators=[ | ||
django.core.validators.MinValueValidator(-5), | ||
django.core.validators.MaxValueValidator(5), | ||
] | ||
), | ||
), | ||
], | ||
options={ | ||
"abstract": False, | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Generated by Django 5.1.2 on 2024-11-30 12:37 | ||
|
||
import django.db.models.deletion | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
("energy_journal", "0001_initial"), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="energylog", | ||
name="created_by", | ||
field=models.ForeignKey( | ||
on_delete=django.db.models.deletion.PROTECT, | ||
related_name="+", | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from django.db import models | ||
|
||
from utils.models import BaseModel | ||
|
||
|
||
class Account(BaseModel): | ||
name = models.CharField(max_length=255) | ||
balance = models.DecimalField(max_digits=10, decimal_places=2) | ||
owner = models.ForeignKey("users.User", on_delete=models.PROTECT) | ||
active = models.BooleanField(default=True) | ||
|
||
|
||
class Transaction(BaseModel): | ||
name = models.CharField(max_length=255) | ||
description = models.TextField() | ||
performed_on = models.DateField() | ||
created_by = models.ForeignKey("users.User", on_delete=models.PROTECT) | ||
|
||
|
||
class TransactionEntry(BaseModel): | ||
transaction = models.ForeignKey("finance.Transaction", on_delete=models.PROTECT, related_name="entries") | ||
account = models.ForeignKey( | ||
"finance.Account", on_delete=models.PROTECT, null=True, blank=True, related_name="transaction_entries" | ||
) | ||
amount = models.DecimalField(max_digits=10, decimal_places=2) | ||
name = models.CharField(max_length=255) | ||
|
||
class Meta: | ||
unique_together = ("transaction", "account") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from rest_framework import serializers | ||
|
||
from ilgi.finance.models import Account | ||
|
||
class AccountSerializer(serializers.ModelSerializer): | ||
id = serializers.UUIDField(source="external_id") | ||
|
||
class Meta: | ||
model = Account | ||
fields = "__all__" |
Empty file.
Empty file.
Empty file.