44
55use Exdrals \Identity \DTO \Response \HttpResponseMessage ;
66use Exdrals \Shared \Domain \Account \AccountInterface ;
7+ use Exdrals \Shared \Domain \Enum \DataType ;
78use Fig \Http \Message \StatusCodeInterface as HTTP ;
89use Laminas \Diactoros \Response \JsonResponse ;
910use OpenApi \Attributes as OA ;
1011use ownHackathon \Shared \Domain \ValueObject \Pagination ;
11- use ownHackathon \Workspace \DTO \WorkspaceList ;
12+ use ownHackathon \Workspace \DTO \PaginationMeta ;
1213use ownHackathon \Workspace \DTO \WorkspaceResponse ;
1314use ownHackathon \Workspace \Infrastructure \Persistence \Repository \WorkspaceRepository ;
1415use ownHackathon \Workspace \Infrastructure \Service \PaginationService ;
@@ -26,7 +27,7 @@ public function __construct(
2627
2728 #[OA \Get(
2829 path: '/me/workspaces ' ,
29- operationId: 'findWorkspaces ' ,
30+ operationId: 'findOwnWorkspaces ' ,
3031 description: 'List all workspaces for the authenticated account ' ,
3132 summary: 'Returns a collection of all workspaces owned by or associated with the currently authenticated user. ' ,
3233 security: [['accessToken ' => []]],
@@ -58,7 +59,21 @@ public function __construct(
5859 #[OA \Response(
5960 response: HTTP ::STATUS_OK ,
6061 description: 'A list of workspaces belonging to the user. ' ,
61- content: new OA \JsonContent (ref: WorkspaceList::class)
62+ content: new OA \JsonContent (
63+ properties: [
64+ new OA \Property (
65+ property: 'workspaces ' ,
66+ type: 'array ' ,
67+ items: new OA \Items (ref: WorkspaceResponse::class)
68+ ),
69+ new OA \Property (
70+ property: 'meta ' ,
71+ ref: PaginationMeta::class,
72+ type: DataType::OBJECT ->value
73+ ),
74+ ],
75+ type: DataType::OBJECT ->value
76+ )
6277 )]
6378 #[OA \Response(
6479 response: HTTP ::STATUS_UNAUTHORIZED ,
@@ -86,7 +101,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
86101 'workspaces ' => $ response ,
87102 'meta ' => [
88103 'currentPage ' => $ metaData ->currentPage ,
89- 'maxPages ' => $ metaData ->totalPages ,
104+ 'totalPages ' => $ metaData ->totalPages ,
90105 'totalItems ' => $ metaData ->totalItems ,
91106 ],
92107 ], HTTP ::STATUS_OK );
0 commit comments