Skip to content

Commit 3c1ff61

Browse files
committed
fix: convert limit to number type in catalog endpoints
- Add Number() conversion for limit in fetchCatalog and fetchCollections - Fixes 'limit is not of a type(s) number' error when limit is sent as string
1 parent 642a416 commit 3c1ff61

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4901,7 +4901,7 @@ export class BaileysStartupService extends ChannelStartupService {
49014901
//Business Controller
49024902
public async fetchCatalog(instanceName: string, data: getCollectionsDto) {
49034903
const jid = data.number ? createJid(data.number) : this.client?.user?.id;
4904-
const limit = data.limit || 50;
4904+
const limit = Number(data.limit) || 50;
49054905
const cursor = data.cursor || null;
49064906

49074907
const onWhatsapp = (await this.whatsappNumber({ numbers: [jid] }))?.shift();
@@ -4971,7 +4971,7 @@ export class BaileysStartupService extends ChannelStartupService {
49714971

49724972
public async fetchCollections(instanceName: string, data: getCollectionsDto) {
49734973
const jid = data.number ? createJid(data.number) : this.client?.user?.id;
4974-
const limit = data.limit || 100;
4974+
const limit = Number(data.limit) || 100;
49754975

49764976
const onWhatsapp = (await this.whatsappNumber({ numbers: [jid] }))?.shift();
49774977

0 commit comments

Comments
 (0)