|
@@ -349,6 +349,30 @@ export class QdrantEndpoint extends BaseEndpointComponent {
|
|
|
}
|
|
}
|
|
|
),
|
|
),
|
|
|
|
|
|
|
|
|
|
+ this.createEndpoint(
|
|
|
|
|
+ 'DELETE',
|
|
|
|
|
+ '/api/qdrant/shops/:shopId/errors',
|
|
|
|
|
+ this.clearShopQdrantErrors.bind(this),
|
|
|
|
|
+ {
|
|
|
|
|
+ summary: 'Clear shop Qdrant errors',
|
|
|
|
|
+ description: 'Clear all Qdrant errors for a specific shop',
|
|
|
|
|
+ tags: ['Qdrant'],
|
|
|
|
|
+ requiresAuth: true,
|
|
|
|
|
+ parameters: [
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'shopId',
|
|
|
|
|
+ in: 'path',
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ description: 'Shop ID'
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
|
|
+ responses: {
|
|
|
|
|
+ '200': { description: 'Errors cleared successfully' }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ),
|
|
|
|
|
+
|
|
|
this.createEndpoint(
|
|
this.createEndpoint(
|
|
|
'POST',
|
|
'POST',
|
|
|
'/api/qdrant/cleanup',
|
|
'/api/qdrant/cleanup',
|
|
@@ -727,19 +751,6 @@ export class QdrantEndpoint extends BaseEndpointComponent {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private async clearShopQdrantErrors(req: Request, res: Response): Promise<void> {
|
|
|
|
|
- try {
|
|
|
|
|
- const { shopId } = req.params;
|
|
|
|
|
-
|
|
|
|
|
- this.db.clearQdrantErrors(shopId);
|
|
|
|
|
-
|
|
|
|
|
- res.json({ message: 'Errors cleared' });
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- logger.error('Failed to clear shop Qdrant errors:', error);
|
|
|
|
|
- res.status(500).json({ error: 'Internal server error' });
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
private async getSystemStats(req: Request, res: Response): Promise<void> {
|
|
private async getSystemStats(req: Request, res: Response): Promise<void> {
|
|
|
try {
|
|
try {
|
|
|
let totalCollections = 0;
|
|
let totalCollections = 0;
|
|
@@ -916,6 +927,32 @@ export class QdrantEndpoint extends BaseEndpointComponent {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private async clearShopQdrantErrors(req: Request, res: Response): Promise<void> {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const { shopId } = req.params;
|
|
|
|
|
+
|
|
|
|
|
+ // Get shop from database - try both internal ID and custom ID
|
|
|
|
|
+ let shop = this.db.getShopById(shopId);
|
|
|
|
|
+ if (!shop) {
|
|
|
|
|
+ shop = this.db.getShopByCustomId(shopId);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!shop) {
|
|
|
|
|
+ res.status(404).json({ error: 'Shop not found' });
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.db.clearQdrantErrors(shop.id);
|
|
|
|
|
+
|
|
|
|
|
+ res.json({
|
|
|
|
|
+ message: `Cleared all Qdrant errors for shop ${shop.id}`,
|
|
|
|
|
+ success: true
|
|
|
|
|
+ });
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ logger.error('Failed to clear shop Qdrant errors:', error);
|
|
|
|
|
+ res.status(500).json({ error: 'Internal server error' });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private async triggerCleanup(req: Request, res: Response): Promise<void> {
|
|
private async triggerCleanup(req: Request, res: Response): Promise<void> {
|
|
|
try {
|
|
try {
|
|
|
// Trigger manual cleanup using the scheduler service
|
|
// Trigger manual cleanup using the scheduler service
|