Skip to content

Commit 6f7d55a

Browse files
committed
fix(officers): term_id added to Officer response, id is now an int
1 parent bd9e3ad commit 6f7d55a

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/officers/crud.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ async def current_officers(db_session: database.DBSession, include_private: bool
3434
for term, officer in result:
3535
officer_list.append(
3636
Officer(
37+
term_id=term.id,
3738
legal_name=officer.legal_name,
3839
position=term.position,
3940
start_date=term.start_date,
@@ -102,6 +103,7 @@ async def get_all_officers(
102103
for term, officer in result:
103104
officer_list.append(
104105
Officer(
106+
term_id=term.id,
105107
legal_name=officer.legal_name,
106108
position=term.position,
107109
start_date=term.start_date,

src/officers/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ class Officer(OfficerBase):
9595
@classmethod
9696
def public_fields(cls, term: OfficerTermDB, info: OfficerInfoDB) -> Self:
9797
return cls(
98+
term_id=term.id,
9899
legal_name=info.legal_name,
99100
position=term.position,
100101
start_date=term.start_date,
@@ -108,6 +109,8 @@ def public_fields(cls, term: OfficerTermDB, info: OfficerInfoDB) -> Self:
108109
def is_active(self) -> bool:
109110
return is_active_term(start_date=self.start_date, end_date=self.end_date)
110111

112+
term_id: int
113+
111114
# Private Info
112115
discord_id: str | None = None
113116
discord_name: str | None = None

src/officers/tables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
class OfficerTermDB(Base):
2929
__tablename__ = "officer_term"
3030

31-
id: Mapped[str] = mapped_column(Integer, primary_key=True, autoincrement=True)
31+
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
3232

3333
computing_id: Mapped[str] = mapped_column(
3434
String(COMPUTING_ID_LEN),

0 commit comments

Comments
 (0)