forked from ITISFoundation/osparc-simcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Introduce initial get wallets endpoints (ITISFoundation#4853)
- Loading branch information
1 parent
63c0514
commit 0901949
Showing
15 changed files
with
443 additions
and
20 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
24 changes: 24 additions & 0 deletions
24
services/api-server/src/simcore_service_api_server/api/routes/wallets.py
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,24 @@ | ||
import logging | ||
from typing import Annotated | ||
|
||
from fastapi import APIRouter, Depends | ||
from models_library.api_schemas_webserver.wallets import WalletGet | ||
|
||
from ..dependencies.webserver import AuthSession, get_webserver_session | ||
from ._common import API_SERVER_DEV_FEATURES_ENABLED | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
router = APIRouter() | ||
|
||
|
||
@router.get( | ||
"/{wallet_id}", | ||
response_model=WalletGet, | ||
include_in_schema=API_SERVER_DEV_FEATURES_ENABLED, | ||
) | ||
async def get_wallet( | ||
wallet_id: int, | ||
webserver_api: Annotated[AuthSession, Depends(get_webserver_session)], | ||
): | ||
return await webserver_api.get_wallet(wallet_id=wallet_id) |
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,45 @@ | ||
[ | ||
{ | ||
"name": "GET /projects/87643648-3a38-44e2-9cfe-d86ab3d50629/wallet", | ||
"description": "<Request('GET', 'http://webserver:8080/v0/projects/87643648-3a38-44e2-9cfe-d86ab3d50629/wallet')>", | ||
"method": "GET", | ||
"host": "webserver", | ||
"path": { | ||
"path": "/v0/projects/{project_id}/wallet", | ||
"path_parameters": [ | ||
{ | ||
"in_": "path", | ||
"name": "project_id", | ||
"required": true, | ||
"schema_": { | ||
"title": "Project Id", | ||
"type_": "str", | ||
"pattern": null, | ||
"format_": "uuid", | ||
"exclusiveMinimum": null, | ||
"minimum": null, | ||
"anyOf": null, | ||
"allOf": null, | ||
"oneOf": null | ||
}, | ||
"response_value": "projects" | ||
} | ||
] | ||
}, | ||
"query": null, | ||
"request_payload": null, | ||
"response_body": { | ||
"data": { | ||
"walletId": 1, | ||
"name": "my_wallet", | ||
"description": "my awesome wallet", | ||
"owner": 3, | ||
"thumbnail": "string", | ||
"status": "ACTIVE", | ||
"created": "2023-10-10T13:58:20.381826+00:00", | ||
"modified": "2023-10-10T13:58:20.381826+00:00" | ||
} | ||
}, | ||
"status_code": 200 | ||
} | ||
] |
55 changes: 55 additions & 0 deletions
55
services/api-server/tests/mocks/get_job_wallet_not_found.json
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,55 @@ | ||
[ | ||
{ | ||
"name": "GET /projects/87643648-3a38-44e2-9cfe-d86ac3d50629/wallet", | ||
"description": "<Request('GET', 'http://webserver:8080/v0/projects/87643648-3a38-44e2-9cfe-d86ac3d50629/wallet')>", | ||
"method": "GET", | ||
"host": "webserver", | ||
"path": { | ||
"path": "/v0/projects/{project_id}/wallet", | ||
"path_parameters": [ | ||
{ | ||
"in_": "path", | ||
"name": "project_id", | ||
"required": true, | ||
"schema_": { | ||
"title": "Project Id", | ||
"type_": "str", | ||
"pattern": null, | ||
"format_": "uuid", | ||
"exclusiveMinimum": null, | ||
"minimum": null, | ||
"anyOf": null, | ||
"allOf": null, | ||
"oneOf": null | ||
}, | ||
"response_value": "87643648-3a38-44e2-9cfe-d86ac3d50629" | ||
} | ||
] | ||
}, | ||
"query": null, | ||
"request_payload": null, | ||
"response_body": { | ||
"data": null, | ||
"error": { | ||
"logs": [ | ||
{ | ||
"message": "Project with uuid 87643648-3a38-44e2-9cfe-d86ac3d50629 not found.", | ||
"level": "ERROR", | ||
"logger": "user" | ||
} | ||
], | ||
"errors": [ | ||
{ | ||
"code": "HTTPNotFound", | ||
"message": "Project with uuid 87643648-3a38-44e2-9cfe-d86ac3d50629 not found.", | ||
"resource": null, | ||
"field": null | ||
} | ||
], | ||
"status": 404, | ||
"message": "Project with uuid 87643648-3a38-44e2-9cfe-d86ac3d50629 not found." | ||
} | ||
}, | ||
"status_code": 404 | ||
} | ||
] |
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,55 @@ | ||
[ | ||
{ | ||
"name": "GET /wallets/8", | ||
"description": "<Request('GET', 'http://webserver:8080/v0/wallets/8')>", | ||
"method": "GET", | ||
"host": "webserver", | ||
"path": { | ||
"path": "/v0/wallets/{wallet_id}", | ||
"path_parameters": [ | ||
{ | ||
"in_": "path", | ||
"name": "wallet_id", | ||
"required": true, | ||
"schema_": { | ||
"title": "Wallet Id", | ||
"type_": "int", | ||
"pattern": null, | ||
"format_": null, | ||
"exclusiveMinimum": true, | ||
"minimum": 0, | ||
"anyOf": null, | ||
"allOf": null, | ||
"oneOf": null | ||
}, | ||
"response_value": "wallets" | ||
} | ||
] | ||
}, | ||
"query": null, | ||
"request_payload": null, | ||
"response_body": { | ||
"data": null, | ||
"error": { | ||
"logs": [ | ||
{ | ||
"message": "Wallet access forbidden. User does not have access to the wallet 8. Or wallet does not exist.", | ||
"level": "ERROR", | ||
"logger": "user" | ||
} | ||
], | ||
"errors": [ | ||
{ | ||
"code": "HTTPForbidden", | ||
"message": "Wallet access forbidden. User does not have access to the wallet 8. Or wallet does not exist.", | ||
"resource": null, | ||
"field": null | ||
} | ||
], | ||
"status": 403, | ||
"message": "Wallet access forbidden. User does not have access to the wallet 8. Or wallet does not exist." | ||
} | ||
}, | ||
"status_code": 403 | ||
} | ||
] |
Oops, something went wrong.