mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-09 01:49:37 -06:00
style: improve code formatting for better readability in WhatsApp service files
This commit is contained in:
parent
00780157db
commit
55822f9443
@ -463,7 +463,8 @@ export class BusinessStartupService extends ChannelStartupService {
|
||||
this.logger?.info?.('Video upload attempted but is disabled by configuration.');
|
||||
return {
|
||||
success: false,
|
||||
message: 'Video upload is currently disabled. Please contact support if you need this feature enabled.',
|
||||
message:
|
||||
'Video upload is currently disabled. Please contact support if you need this feature enabled.',
|
||||
};
|
||||
}
|
||||
|
||||
@ -1213,8 +1214,9 @@ export class BusinessStartupService extends ChannelStartupService {
|
||||
const token = this.token;
|
||||
|
||||
const headers = { Authorization: `Bearer ${token}` };
|
||||
const url = `${this.configService.get<WaBusiness>('WA_BUSINESS').URL}/${this.configService.get<WaBusiness>('WA_BUSINESS').VERSION
|
||||
}/${this.number}/media`;
|
||||
const url = `${this.configService.get<WaBusiness>('WA_BUSINESS').URL}/${
|
||||
this.configService.get<WaBusiness>('WA_BUSINESS').VERSION
|
||||
}/${this.number}/media`;
|
||||
|
||||
const res = await axios.post(url, formData, { headers });
|
||||
return res.data.id;
|
||||
|
||||
@ -381,7 +381,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
qrcodeTerminal.generate(qr, { small: true }, (qrcode) =>
|
||||
this.logger.log(
|
||||
`\n{ instance: ${this.instance.name} pairingCode: ${this.instance.qrcode.pairingCode}, qrcodeCount: ${this.instance.qrcode.count} }\n` +
|
||||
qrcode,
|
||||
qrcode,
|
||||
),
|
||||
);
|
||||
|
||||
@ -978,16 +978,16 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
|
||||
const messagesRepository: Set<string> = new Set(
|
||||
chatwootImport.getRepositoryMessagesCache(instance) ??
|
||||
(
|
||||
await this.prismaRepository.message.findMany({
|
||||
select: { key: true },
|
||||
where: { instanceId: this.instanceId },
|
||||
})
|
||||
).map((message) => {
|
||||
const key = message.key as { id: string };
|
||||
(
|
||||
await this.prismaRepository.message.findMany({
|
||||
select: { key: true },
|
||||
where: { instanceId: this.instanceId },
|
||||
})
|
||||
).map((message) => {
|
||||
const key = message.key as { id: string };
|
||||
|
||||
return key.id;
|
||||
}),
|
||||
return key.id;
|
||||
}),
|
||||
);
|
||||
|
||||
if (chatwootImport.getRepositoryMessagesCache(instance) === null) {
|
||||
@ -4726,12 +4726,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
}
|
||||
|
||||
public async fetchMessages(query: Query<Message>) {
|
||||
const keyFilters = query?.where?.key as {
|
||||
id?: string;
|
||||
fromMe?: boolean;
|
||||
remoteJid?: string;
|
||||
participants?: string;
|
||||
};
|
||||
const keyFilters = query?.where?.key as ExtendedIMessageKey;
|
||||
|
||||
const timestampFilter = {};
|
||||
if (query?.where?.messageTimestamp) {
|
||||
@ -4754,7 +4749,13 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
keyFilters?.id ? { key: { path: ['id'], equals: keyFilters?.id } } : {},
|
||||
keyFilters?.fromMe ? { key: { path: ['fromMe'], equals: keyFilters?.fromMe } } : {},
|
||||
keyFilters?.remoteJid ? { key: { path: ['remoteJid'], equals: keyFilters?.remoteJid } } : {},
|
||||
keyFilters?.participants ? { key: { path: ['participants'], equals: keyFilters?.participants } } : {},
|
||||
keyFilters?.participant ? { key: { path: ['participant'], equals: keyFilters?.participant } } : {},
|
||||
{
|
||||
OR: [
|
||||
keyFilters?.remoteJid ? { key: { path: ['remoteJid'], equals: keyFilters?.remoteJid } } : {},
|
||||
keyFilters?.senderPn ? { key: { path: ['senderPn'], equals: keyFilters?.senderPn } } : {},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
@ -4778,7 +4779,13 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
keyFilters?.id ? { key: { path: ['id'], equals: keyFilters?.id } } : {},
|
||||
keyFilters?.fromMe ? { key: { path: ['fromMe'], equals: keyFilters?.fromMe } } : {},
|
||||
keyFilters?.remoteJid ? { key: { path: ['remoteJid'], equals: keyFilters?.remoteJid } } : {},
|
||||
keyFilters?.participants ? { key: { path: ['participants'], equals: keyFilters?.participants } } : {},
|
||||
keyFilters?.participant ? { key: { path: ['participant'], equals: keyFilters?.participant } } : {},
|
||||
{
|
||||
OR: [
|
||||
keyFilters?.remoteJid ? { key: { path: ['remoteJid'], equals: keyFilters?.remoteJid } } : {},
|
||||
keyFilters?.senderPn ? { key: { path: ['senderPn'], equals: keyFilters?.senderPn } } : {},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
orderBy: { messageTimestamp: 'desc' },
|
||||
|
||||
@ -38,14 +38,16 @@ const getTypeMessage = (msg: any) => {
|
||||
? `videoMessage|${mediaId}${msg?.message?.videoMessage?.caption ? `|${msg?.message?.videoMessage?.caption}` : ''}`
|
||||
: undefined,
|
||||
documentMessage: msg?.message?.documentMessage
|
||||
? `documentMessage|${mediaId}${msg?.message?.documentMessage?.caption ? `|${msg?.message?.documentMessage?.caption}` : ''
|
||||
}`
|
||||
? `documentMessage|${mediaId}${
|
||||
msg?.message?.documentMessage?.caption ? `|${msg?.message?.documentMessage?.caption}` : ''
|
||||
}`
|
||||
: undefined,
|
||||
documentWithCaptionMessage: msg?.message?.documentWithCaptionMessage?.message?.documentMessage
|
||||
? `documentWithCaptionMessage|${mediaId}${msg?.message?.documentWithCaptionMessage?.message?.documentMessage?.caption
|
||||
? `|${msg?.message?.documentWithCaptionMessage?.message?.documentMessage?.caption}`
|
||||
: ''
|
||||
}`
|
||||
? `documentWithCaptionMessage|${mediaId}${
|
||||
msg?.message?.documentWithCaptionMessage?.message?.documentMessage?.caption
|
||||
? `|${msg?.message?.documentWithCaptionMessage?.message?.documentMessage?.caption}`
|
||||
: ''
|
||||
}`
|
||||
: undefined,
|
||||
externalAdReplyBody: msg?.contextInfo?.externalAdReply?.body
|
||||
? `externalAdReplyBody|${msg.contextInfo.externalAdReply.body}`
|
||||
|
||||
Loading…
Reference in New Issue
Block a user