Skip to content

Commit

Permalink
🗃️ add data to transactions and make date in news and transactions wi…
Browse files Browse the repository at this point in the history
…th nullable=False
  • Loading branch information
matv864 committed Sep 2, 2024
1 parent 94d7a38 commit 78c04f1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions backend/src/api/schemas/transactions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from datetime import date

from pydantic import BaseModel


class Transaction_schema(BaseModel):
date_of_payment: date
goal: "TransactionGoal_schema"
amount: float
sender_receiver: str
Expand Down
5 changes: 1 addition & 4 deletions backend/src/database/models/news/news.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ class News(Base):
default=uuid4
)

date_of_publication: Mapped[date] = mapped_column(
nullable=True,
default=date.today()
)
date_of_publication: Mapped[date] = mapped_column(default=date.today())

title: Mapped[str]
text: Mapped[str] = mapped_column(Text, default="")
Expand Down
3 changes: 3 additions & 0 deletions backend/src/database/models/report/transaction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from uuid import UUID, uuid4
from datetime import date

from sqladmin import ModelView

Expand All @@ -22,6 +23,8 @@ class Transaction(Base):
default=uuid4
)

date_of_payment: Mapped[date] = mapped_column(default=date.today())

goal_id: Mapped[str] = mapped_column(ForeignKey("transactionGoal.id"))
goal = relationship("TransactionGoal", lazy="selectin")

Expand Down

0 comments on commit 78c04f1

Please sign in to comment.