Renamed the random_id type alias to random_pk.

This commit is contained in:
依瑪貓 2023-04-24 20:22:33 +08:00
parent d5c1be3d80
commit 167990fc4c

View File

@ -42,9 +42,9 @@ user_pk: t.Type[int] \
= t.Annotated[int, mapped_column(db.ForeignKey(user_pk_column, = t.Annotated[int, mapped_column(db.ForeignKey(user_pk_column,
onupdate="CASCADE"))] onupdate="CASCADE"))]
"""The user primary key.""" """The user primary key."""
random_id: t.Type[int] \ random_pk: t.Type[int] \
= t.Annotated[int, mapped_column(primary_key=True, autoincrement=False)] = t.Annotated[int, mapped_column(primary_key=True, autoincrement=False)]
"""The random ID.""" """The random primary key."""
class BaseAccount(db.Model): class BaseAccount(db.Model):
@ -112,7 +112,7 @@ class Account(db.Model):
"""An account.""" """An account."""
__tablename__ = "accounting_accounts" __tablename__ = "accounting_accounts"
"""The table name.""" """The table name."""
id: Mapped[random_id] id: Mapped[random_pk]
"""The account ID.""" """The account ID."""
base_code: Mapped[str] \ base_code: Mapped[str] \
= mapped_column(db.ForeignKey(BaseAccount.code, onupdate="CASCADE", = mapped_column(db.ForeignKey(BaseAccount.code, onupdate="CASCADE",
@ -535,7 +535,7 @@ class JournalEntry(db.Model):
"""A journal entry.""" """A journal entry."""
__tablename__ = "accounting_journal_entries" __tablename__ = "accounting_journal_entries"
"""The table name.""" """The table name."""
id: Mapped[random_id] id: Mapped[random_pk]
"""The journal entry ID.""" """The journal entry ID."""
date: Mapped[dt.date] date: Mapped[dt.date]
"""The date.""" """The date."""
@ -646,7 +646,7 @@ class JournalEntryLineItem(db.Model):
"""A line item in the journal entry.""" """A line item in the journal entry."""
__tablename__ = "accounting_journal_entry_line_items" __tablename__ = "accounting_journal_entry_line_items"
"""The table name.""" """The table name."""
id: Mapped[random_id] = mapped_column() id: Mapped[random_pk] = mapped_column()
"""The line item ID.""" """The line item ID."""
journal_entry_id: Mapped[int] \ journal_entry_id: Mapped[int] \
= mapped_column(db.ForeignKey(JournalEntry.id, onupdate="CASCADE", = mapped_column(db.ForeignKey(JournalEntry.id, onupdate="CASCADE",