88from typing import Annotated
99
1010from fastapi import APIRouter , Depends , status
11+ from models_library .rest_error import EnvelopedError
1112from models_library .trash import RemoveQueryParams
1213from simcore_service_webserver ._meta import API_VTAG
1314from simcore_service_webserver .folders ._common .models import (
1415 FoldersPathParams ,
1516 FolderTrashQueryParams ,
1617)
18+ from simcore_service_webserver .projects ._common .exceptions_handlers import (
19+ _TO_HTTP_ERROR_MAP ,
20+ )
1721from simcore_service_webserver .projects ._trash_rest import ProjectPathParams
1822from simcore_service_webserver .workspaces ._common .models import (
1923 WorkspacesPathParams ,
2327router = APIRouter (
2428 prefix = f"/{ API_VTAG } " ,
2529 tags = ["trash" ],
30+ responses = {
31+ i .status_code : {"model" : EnvelopedError } for i in _TO_HTTP_ERROR_MAP .values ()
32+ },
2633)
2734
2835
@@ -42,11 +49,18 @@ def empty_trash():
4249 tags = _extra_tags ,
4350 status_code = status .HTTP_204_NO_CONTENT ,
4451 responses = {
45- status .HTTP_404_NOT_FOUND : {"description" : "Not such a project" },
52+ status .HTTP_404_NOT_FOUND : {
53+ "description" : "Not such a project" ,
54+ "model" : EnvelopedError ,
55+ },
4656 status .HTTP_409_CONFLICT : {
47- "description" : "Project is in use and cannot be trashed"
57+ "description" : "Project is in use and cannot be trashed" ,
58+ "model" : EnvelopedError ,
59+ },
60+ status .HTTP_503_SERVICE_UNAVAILABLE : {
61+ "description" : "Trash service error" ,
62+ "model" : EnvelopedError ,
4863 },
49- status .HTTP_503_SERVICE_UNAVAILABLE : {"description" : "Trash service error" },
5064 },
5165)
5266def trash_project (
0 commit comments