Skip to content

Commit fc521b8

Browse files
committed
feat(label): add GET /label/syncLabels/:instanceName route
New endpoint that forces WhatsApp to re-download labels via Baileys resyncAppState(['regular'], true) before returning updated labels from DB. Uses same dataValidate pattern as findLabels.
1 parent aa9f394 commit fc521b8

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/api/routes/label.router.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ export class LabelRouter extends RouterBroker {
2020

2121
return res.status(HttpStatus.OK).json(response);
2222
})
23+
.get(this.routerPath('syncLabels'), ...guards, async (req, res) => {
24+
const response = await this.dataValidate<LabelDto>({
25+
request: req,
26+
schema: null,
27+
ClassRef: LabelDto,
28+
execute: (instance) => labelController.syncLabels(instance),
29+
});
30+
31+
return res.status(HttpStatus.OK).json(response);
32+
})
2333
.post(this.routerPath('handleLabel'), ...guards, async (req, res) => {
2434
const response = await this.dataValidate<HandleLabelDto>({
2535
request: req,
@@ -33,4 +43,4 @@ export class LabelRouter extends RouterBroker {
3343
}
3444

3545
public readonly router: Router = Router();
36-
}
46+
}

0 commit comments

Comments
 (0)