resolvers
api.resolvers.get_address(session, filter, page_size, page_number)
async
Get all addresses from database or all plugins.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
AsyncSession
|
get the session of database from get_session |
required |
filter |
AddressFilterInput
|
Strawberry input dataclass, everything can be None (based on sqlmodel model) |
required |
page_size |
PositiveInt
|
How many elements in each page |
required |
page_number |
PositiveInt
|
Number of the page |
required |
Returns:
Name | Type | Description |
---|---|---|
DictResponse |
DictResponse
|
'data' key has all addresses (db model) based on filter or empty list; 'provider' key has the service provider local or some plugin |
Source code in api/resolvers.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
api.resolvers.insert_address(session, address)
async
Insert address and city if not exists on database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
AsyncSession
|
get the session of database from get_session |
required |
address |
AddressInsertInput
|
Strict address class, all needed fields need to be passed |
required |
Returns:
Name | Type | Description |
---|---|---|
Address |
Address
|
Address (db model) |
Source code in api/resolvers.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|