Quellcode durchsuchen

fix: move /api/sites/deleted route before /api/sites/:id to prevent route shadowing

fszontagh vor 3 Monaten
Ursprung
Commit
a600dae5d3
1 geänderte Dateien mit 33 neuen und 33 gelöschten Zeilen
  1. 33 33
      src/api/components/SitesEndpoint.ts

+ 33 - 33
src/api/components/SitesEndpoint.ts

@@ -84,6 +84,39 @@ export class SitesEndpoint extends BaseEndpointComponent {
           requiresAuth: true
         }
       ),
+      this.createEndpoint(
+        'GET',
+        '/api/sites/deleted',
+        this.getDeletedShops.bind(this),
+        {
+          summary: 'List deleted sites',
+          description: 'Retrieves a list of soft-deleted sites that can be force-deleted',
+          tags: ['Sites'],
+          responses: {
+            '200': {
+              description: 'List of deleted sites',
+              schema: {
+                type: 'object',
+                properties: {
+                  sites: {
+                    type: 'array',
+                    items: {
+                      type: 'object',
+                      properties: {
+                        id: { type: 'string' },
+                        custom_id: { type: 'string', nullable: true },
+                        url: { type: 'string' },
+                        deleted_at: { type: 'string' }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          requiresAuth: true
+        }
+      ),
       this.createEndpoint(
         'GET',
         '/api/sites/:id',
@@ -458,39 +491,6 @@ export class SitesEndpoint extends BaseEndpointComponent {
           requiresAuth: true
         }
       ),
-      this.createEndpoint(
-        'GET',
-        '/api/sites/deleted',
-        this.getDeletedShops.bind(this),
-        {
-          summary: 'List deleted shops',
-          description: 'Retrieves a list of soft-deleted sites that can be force-deleted',
-          tags: ['Sites'],
-          responses: {
-            '200': {
-              description: 'List of deleted shops',
-              schema: {
-                type: 'object',
-                properties: {
-                  sites: {
-                    type: 'array',
-                    items: {
-                      type: 'object',
-                      properties: {
-                        id: { type: 'string' },
-                        custom_id: { type: 'string', nullable: true },
-                        url: { type: 'string' },
-                        deleted_at: { type: 'string' }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          },
-          requiresAuth: true
-        }
-      ),
       this.createEndpoint(
         'DELETE',
         '/api/sites/:id/force',