Skip to content

Commit 4b659be

Browse files
committed
wip: add GET all registrations
1 parent 6e5c539 commit 4b659be

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/registrations/crud.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
from registrations.tables import NomineeApplication
88

99

10+
async def get_all_registrations(
11+
db_session: AsyncSession
12+
) -> Sequence[NomineeApplication]:
13+
registrations = (await db_session.scalars(
14+
sqlalchemy
15+
.select(NomineeApplication)
16+
)).all()
17+
return registrations
18+
1019
async def get_all_registrations_of_user(
1120
db_session: AsyncSession,
1221
computing_id: str,

src/registrations/urls.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@
2525
tags=["registration"],
2626
)
2727

28+
@router.get(
29+
"",
30+
description="get all the registrations",
31+
response_model=list[NomineeApplicationModel],
32+
operation_id="get_registrations"
33+
)
34+
async def get_all_registrations(
35+
db_session: database.DBSession,
36+
):
37+
return await registrations.crud.get_all_registrations(db_session)
38+
2839
@router.get(
2940
"/{election_name:str}",
3041
description="get all the registrations of a single election",

0 commit comments

Comments
 (0)