2020use Symfony \Component \HttpFoundation \Response ;
2121use Symfony \Component \Routing \Attribute \Route ;
2222
23- #[Route('/administrators/attributes ' )]
23+ #[Route('/administrators/attributes ' , name: ' admin_attribute_definition_ ' )]
2424class AdminAttributeDefinitionController extends BaseController
2525{
2626 private AdminAttributeDefinitionManager $ definitionManager ;
@@ -40,25 +40,15 @@ public function __construct(
4040 $ this ->paginatedDataProvider = $ paginatedDataProvider ;
4141 }
4242
43- #[Route('' , name: 'create_admin_attribute_definition ' , methods: ['POST ' ])]
43+ #[Route('' , name: 'create ' , methods: ['POST ' ])]
4444 #[OA \Post(
4545 path: '/administrators/attributes ' ,
4646 description: 'Returns created admin attribute definition. ' ,
4747 summary: 'Create an admin attribute definition. ' ,
4848 requestBody: new OA \RequestBody (
4949 description: 'Pass parameters to create admin attribute. ' ,
5050 required: true ,
51- content: new OA \JsonContent (
52- required: ['name ' ],
53- properties: [
54- new OA \Property (property: 'name ' , type: 'string ' , format: 'string ' , example: 'Country ' ),
55- new OA \Property (property: 'type ' , type: 'string ' , example: 'checkbox ' ),
56- new OA \Property (property: 'order ' , type: 'number ' , example: 12 ),
57- new OA \Property (property: 'default_value ' , type: 'string ' , example: 'United States ' ),
58- new OA \Property (property: 'required ' , type: 'boolean ' , example: true ),
59- new OA \Property (property: 'table_name ' , type: 'string ' , example: 'list_attributes ' ),
60- ]
61- )
51+ content: new OA \JsonContent (ref: '#/components/schemas/CreateAdminAttributeDefinitionRequest ' )
6252 ),
6353 tags: ['admin-attributes ' ],
6454 parameters: [
@@ -103,25 +93,15 @@ public function create(Request $request): JsonResponse
10393 return $ this ->json ($ json , Response::HTTP_CREATED );
10494 }
10595
106- #[Route('/{definitionId} ' , name: 'update_admin_attribute_definition ' , methods: ['PUT ' ])]
96+ #[Route('/{definitionId} ' , name: 'update ' , requirements: [ ' definitionId ' => ' \d+ ' ] , methods: ['PUT ' ])]
10797 #[OA \Put(
10898 path: '/administrators/attributes/{definitionId} ' ,
10999 description: 'Returns updated admin attribute definition. ' ,
110100 summary: 'Update an admin attribute definition. ' ,
111101 requestBody: new OA \RequestBody (
112102 description: 'Pass parameters to update admin attribute. ' ,
113103 required: true ,
114- content: new OA \JsonContent (
115- required: ['name ' ],
116- properties: [
117- new OA \Property (property: 'name ' , type: 'string ' , format: 'string ' , example: 'Country ' ),
118- new OA \Property (property: 'type ' , type: 'string ' , example: 'checkbox ' ),
119- new OA \Property (property: 'order ' , type: 'number ' , example: 12 ),
120- new OA \Property (property: 'default_value ' , type: 'string ' , example: 'United States ' ),
121- new OA \Property (property: 'required ' , type: 'boolean ' , example: true ),
122- new OA \Property (property: 'table_name ' , type: 'string ' , example: 'list_attributes ' ),
123- ]
124- )
104+ content: new OA \JsonContent (ref: '#/components/schemas/CreateAdminAttributeDefinitionRequest ' )
125105 ),
126106 tags: ['admin-attributes ' ],
127107 parameters: [
@@ -179,7 +159,7 @@ public function update(
179159 return $ this ->json ($ json , Response::HTTP_OK );
180160 }
181161
182- #[Route('/{definitionId} ' , name: 'delete_admin_attribute_definition ' , methods: ['DELETE ' ])]
162+ #[Route('/{definitionId} ' , name: 'delete ' , requirements: [ ' definitionId ' => ' \d+ ' ] , methods: ['DELETE ' ])]
183163 #[OA \Delete(
184164 path: '/administrators/attributes/{definitionId} ' ,
185165 description: 'Deletes a single admin attribute definition. ' ,
@@ -232,11 +212,11 @@ public function delete(
232212 return $ this ->json (null , Response::HTTP_NO_CONTENT );
233213 }
234214
235- #[Route('' , name: 'get_admin_attribute_definitions ' , methods: ['GET ' ])]
215+ #[Route('' , name: 'get_lists ' , methods: ['GET ' ])]
236216 #[OA \Get(
237217 path: '/administrators/attributes ' ,
238218 description: 'Returns a JSON list of all admin attribute definitions. ' ,
239- summary: 'Gets a list of all DMIN attribute definitions. ' ,
219+ summary: 'Gets a list of all admin attribute definitions. ' ,
240220 tags: ['admin-attributes ' ],
241221 parameters: [
242222 new OA \Parameter (
@@ -300,7 +280,7 @@ public function getPaginated(Request $request): JsonResponse
300280 );
301281 }
302282
303- #[Route('/{definitionId} ' , name: 'get_admin_attribute_definition ' , methods: ['GET ' ])]
283+ #[Route('/{definitionId} ' , name: 'get_one ' , requirements: [ ' definitionId ' => ' \d+ ' ] , methods: ['GET ' ])]
304284 #[OA \Get(
305285 path: '/administrators/attributes/{definitionId} ' ,
306286 description: 'Returns a single attribute with specified ID. ' ,
0 commit comments