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.');
|
this.logger?.info?.('Video upload attempted but is disabled by configuration.');
|
||||||
return {
|
return {
|
||||||
success: false,
|
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 token = this.token;
|
||||||
|
|
||||||
const headers = { Authorization: `Bearer ${token}` };
|
const headers = { Authorization: `Bearer ${token}` };
|
||||||
const url = `${this.configService.get<WaBusiness>('WA_BUSINESS').URL}/${this.configService.get<WaBusiness>('WA_BUSINESS').VERSION
|
const url = `${this.configService.get<WaBusiness>('WA_BUSINESS').URL}/${
|
||||||
}/${this.number}/media`;
|
this.configService.get<WaBusiness>('WA_BUSINESS').VERSION
|
||||||
|
}/${this.number}/media`;
|
||||||
|
|
||||||
const res = await axios.post(url, formData, { headers });
|
const res = await axios.post(url, formData, { headers });
|
||||||
return res.data.id;
|
return res.data.id;
|
||||||
|
|||||||
@ -381,7 +381,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
qrcodeTerminal.generate(qr, { small: true }, (qrcode) =>
|
qrcodeTerminal.generate(qr, { small: true }, (qrcode) =>
|
||||||
this.logger.log(
|
this.logger.log(
|
||||||
`\n{ instance: ${this.instance.name} pairingCode: ${this.instance.qrcode.pairingCode}, qrcodeCount: ${this.instance.qrcode.count} }\n` +
|
`\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(
|
const messagesRepository: Set<string> = new Set(
|
||||||
chatwootImport.getRepositoryMessagesCache(instance) ??
|
chatwootImport.getRepositoryMessagesCache(instance) ??
|
||||||
(
|
(
|
||||||
await this.prismaRepository.message.findMany({
|
await this.prismaRepository.message.findMany({
|
||||||
select: { key: true },
|
select: { key: true },
|
||||||
where: { instanceId: this.instanceId },
|
where: { instanceId: this.instanceId },
|
||||||
})
|
})
|
||||||
).map((message) => {
|
).map((message) => {
|
||||||
const key = message.key as { id: string };
|
const key = message.key as { id: string };
|
||||||
|
|
||||||
return key.id;
|
return key.id;
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (chatwootImport.getRepositoryMessagesCache(instance) === null) {
|
if (chatwootImport.getRepositoryMessagesCache(instance) === null) {
|
||||||
@ -4726,12 +4726,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async fetchMessages(query: Query<Message>) {
|
public async fetchMessages(query: Query<Message>) {
|
||||||
const keyFilters = query?.where?.key as {
|
const keyFilters = query?.where?.key as ExtendedIMessageKey;
|
||||||
id?: string;
|
|
||||||
fromMe?: boolean;
|
|
||||||
remoteJid?: string;
|
|
||||||
participants?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
const timestampFilter = {};
|
const timestampFilter = {};
|
||||||
if (query?.where?.messageTimestamp) {
|
if (query?.where?.messageTimestamp) {
|
||||||
@ -4754,7 +4749,13 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
keyFilters?.id ? { key: { path: ['id'], equals: keyFilters?.id } } : {},
|
keyFilters?.id ? { key: { path: ['id'], equals: keyFilters?.id } } : {},
|
||||||
keyFilters?.fromMe ? { key: { path: ['fromMe'], equals: keyFilters?.fromMe } } : {},
|
keyFilters?.fromMe ? { key: { path: ['fromMe'], equals: keyFilters?.fromMe } } : {},
|
||||||
keyFilters?.remoteJid ? { key: { path: ['remoteJid'], equals: keyFilters?.remoteJid } } : {},
|
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?.id ? { key: { path: ['id'], equals: keyFilters?.id } } : {},
|
||||||
keyFilters?.fromMe ? { key: { path: ['fromMe'], equals: keyFilters?.fromMe } } : {},
|
keyFilters?.fromMe ? { key: { path: ['fromMe'], equals: keyFilters?.fromMe } } : {},
|
||||||
keyFilters?.remoteJid ? { key: { path: ['remoteJid'], equals: keyFilters?.remoteJid } } : {},
|
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' },
|
orderBy: { messageTimestamp: 'desc' },
|
||||||
|
|||||||
@ -38,14 +38,16 @@ const getTypeMessage = (msg: any) => {
|
|||||||
? `videoMessage|${mediaId}${msg?.message?.videoMessage?.caption ? `|${msg?.message?.videoMessage?.caption}` : ''}`
|
? `videoMessage|${mediaId}${msg?.message?.videoMessage?.caption ? `|${msg?.message?.videoMessage?.caption}` : ''}`
|
||||||
: undefined,
|
: undefined,
|
||||||
documentMessage: msg?.message?.documentMessage
|
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,
|
: undefined,
|
||||||
documentWithCaptionMessage: msg?.message?.documentWithCaptionMessage?.message?.documentMessage
|
documentWithCaptionMessage: msg?.message?.documentWithCaptionMessage?.message?.documentMessage
|
||||||
? `documentWithCaptionMessage|${mediaId}${msg?.message?.documentWithCaptionMessage?.message?.documentMessage?.caption
|
? `documentWithCaptionMessage|${mediaId}${
|
||||||
? `|${msg?.message?.documentWithCaptionMessage?.message?.documentMessage?.caption}`
|
msg?.message?.documentWithCaptionMessage?.message?.documentMessage?.caption
|
||||||
: ''
|
? `|${msg?.message?.documentWithCaptionMessage?.message?.documentMessage?.caption}`
|
||||||
}`
|
: ''
|
||||||
|
}`
|
||||||
: undefined,
|
: undefined,
|
||||||
externalAdReplyBody: msg?.contextInfo?.externalAdReply?.body
|
externalAdReplyBody: msg?.contextInfo?.externalAdReply?.body
|
||||||
? `externalAdReplyBody|${msg.contextInfo.externalAdReply.body}`
|
? `externalAdReplyBody|${msg.contextInfo.externalAdReply.body}`
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user