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.
This commit is contained in:
OrionDesign
2025-12-09 17:03:15 -03:00
parent 5faf3d18d6
commit 076449e5d6
3 changed files with 21 additions and 13 deletions

View File

@@ -116,6 +116,10 @@ export class ChatController {
}
public async decryptPollVote({ instanceName }: InstanceDto, data: DecryptPollVoteDto) {
return await this.waMonitor.waInstances[instanceName].baileysDecryptPollVote(data.pollCreationMessageKey);
const pollCreationMessageKey = {
id: data.message.key.id,
remoteJid: data.remoteJid,
};
return await this.waMonitor.waInstances[instanceName].baileysDecryptPollVote(pollCreationMessageKey);
}
}

View File

@@ -129,10 +129,10 @@ export class BlockUserDto {
}
export class DecryptPollVoteDto {
pollCreationMessageKey: {
id: string;
remoteJid: string;
participant?: string;
fromMe?: boolean;
message: {
key: {
id: string;
};
};
remoteJid: string;
}

View File

@@ -452,16 +452,20 @@ export const decryptPollVoteSchema: JSONSchema7 = {
$id: v4(),
type: 'object',
properties: {
pollCreationMessageKey: {
message: {
type: 'object',
properties: {
id: { type: 'string' },
remoteJid: { type: 'string' },
participant: { type: 'string' },
fromMe: { type: 'boolean' },
key: {
type: 'object',
properties: {
id: { type: 'string' },
},
required: ['id'],
},
},
required: ['id', 'remoteJid'],
required: ['key'],
},
remoteJid: { type: 'string' },
},
required: ['pollCreationMessageKey'],
required: ['message', 'remoteJid'],
};