-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
69 add endpoints to retrieve from look up data tables (#74)
Closes #69 Added institutions/address-states, institutions/regulators, and institutions/types/{type} endpoints Went with a 'generic' InstitutionTypeDTO (since both sbl and hmda tables just have id and name). The /types/ endpoint uses a type Literal to limit the accepted types to sbl or hmda. It then queries the specific Dao type. If this approach isn't desired I can break that GET into two separate types/sbl and types/hmda endpoints that return the specific DTO type. Updated pytests to test these endpoints and the corresponding get_* functions added to the institution repo.
- Loading branch information
Showing
8 changed files
with
126 additions
and
27 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
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
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,12 @@ | ||
from sqlalchemy import select | ||
from sqlalchemy.ext.asyncio import AsyncSession | ||
from typing import List, TypeVar | ||
|
||
T = TypeVar("T") | ||
|
||
|
||
async def query_type(session: AsyncSession, type: T) -> List[T]: | ||
async with session.begin(): | ||
stmt = select(type) | ||
res = await session.scalars(stmt) | ||
return res.all() |
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
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