Skip to content

Commit 076449e

Browse files
Refactor DecryptPollVoteDto and schema structure
Updated DecryptPollVoteDto to use a nested message.key structure and moved remoteJid to the top level. Adjusted the controller and validation schema to match the new structure for consistency and clarity.
1 parent 5faf3d1 commit 076449e

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

src/api/controllers/chat.controller.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ export class ChatController {
116116
}
117117

118118
public async decryptPollVote({ instanceName }: InstanceDto, data: DecryptPollVoteDto) {
119-
return await this.waMonitor.waInstances[instanceName].baileysDecryptPollVote(data.pollCreationMessageKey);
119+
const pollCreationMessageKey = {
120+
id: data.message.key.id,
121+
remoteJid: data.remoteJid,
122+
};
123+
return await this.waMonitor.waInstances[instanceName].baileysDecryptPollVote(pollCreationMessageKey);
120124
}
121125
}

src/api/dto/chat.dto.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ export class BlockUserDto {
129129
}
130130

131131
export class DecryptPollVoteDto {
132-
pollCreationMessageKey: {
133-
id: string;
134-
remoteJid: string;
135-
participant?: string;
136-
fromMe?: boolean;
132+
message: {
133+
key: {
134+
id: string;
135+
};
137136
};
137+
remoteJid: string;
138138
}

src/validate/message.schema.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -452,16 +452,20 @@ export const decryptPollVoteSchema: JSONSchema7 = {
452452
$id: v4(),
453453
type: 'object',
454454
properties: {
455-
pollCreationMessageKey: {
455+
message: {
456456
type: 'object',
457457
properties: {
458-
id: { type: 'string' },
459-
remoteJid: { type: 'string' },
460-
participant: { type: 'string' },
461-
fromMe: { type: 'boolean' },
458+
key: {
459+
type: 'object',
460+
properties: {
461+
id: { type: 'string' },
462+
},
463+
required: ['id'],
464+
},
462465
},
463-
required: ['id', 'remoteJid'],
466+
required: ['key'],
464467
},
468+
remoteJid: { type: 'string' },
465469
},
466-
required: ['pollCreationMessageKey'],
470+
required: ['message', 'remoteJid'],
467471
};

0 commit comments

Comments
 (0)