mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-22 20:12:02 -06:00
feat: update API routes and services for better cache handling
Modified instance.router.ts to change HTTP method from PUT to POST for 'restart' route. Updated whatsapp.baileys.service.ts to correct cache configuration logic, ensuring proper usage of cached group metadata. Removed obsolete Typebot-related schema definitions from instance.schema.ts for cleaner validation. These changes improve API functionality and maintainability.
This commit is contained in:
parent
7dfc09ff16
commit
92a0d8ccc9
@ -21,7 +21,7 @@ export class InstanceRouter extends RouterBroker {
|
||||
|
||||
return res.status(HttpStatus.CREATED).json(response);
|
||||
})
|
||||
.put(this.routerPath('restart'), ...guards, async (req, res) => {
|
||||
.post(this.routerPath('restart'), ...guards, async (req, res) => {
|
||||
const response = await this.dataValidate<InstanceDto>({
|
||||
request: req,
|
||||
schema: null,
|
||||
|
@ -1826,10 +1826,8 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
{
|
||||
...option,
|
||||
useCachedGroupMetadata:
|
||||
!this.configService.get<CacheConf>('CACHE').REDIS.ENABLED &&
|
||||
!this.configService.get<CacheConf>('CACHE').LOCAL.ENABLED
|
||||
? false
|
||||
: true,
|
||||
!!this.configService.get<CacheConf>('CACHE').REDIS.ENABLED &&
|
||||
!!this.configService.get<CacheConf>('CACHE').LOCAL.ENABLED,
|
||||
} as unknown as MiscMessageGenerationOptions,
|
||||
);
|
||||
}
|
||||
@ -1845,10 +1843,8 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
{
|
||||
...option,
|
||||
useCachedGroupMetadata:
|
||||
!this.configService.get<CacheConf>('CACHE').REDIS.ENABLED &&
|
||||
!this.configService.get<CacheConf>('CACHE').LOCAL.ENABLED
|
||||
? false
|
||||
: true,
|
||||
!!this.configService.get<CacheConf>('CACHE').REDIS.ENABLED &&
|
||||
!!this.configService.get<CacheConf>('CACHE').LOCAL.ENABLED,
|
||||
} as unknown as MiscMessageGenerationOptions,
|
||||
);
|
||||
}
|
||||
@ -1866,10 +1862,8 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
{
|
||||
...option,
|
||||
useCachedGroupMetadata:
|
||||
!this.configService.get<CacheConf>('CACHE').REDIS.ENABLED &&
|
||||
!this.configService.get<CacheConf>('CACHE').LOCAL.ENABLED
|
||||
? false
|
||||
: true,
|
||||
!!this.configService.get<CacheConf>('CACHE').REDIS.ENABLED &&
|
||||
!!this.configService.get<CacheConf>('CACHE').LOCAL.ENABLED,
|
||||
} as unknown as MiscMessageGenerationOptions,
|
||||
);
|
||||
}
|
||||
@ -1892,10 +1886,8 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
{
|
||||
...option,
|
||||
useCachedGroupMetadata:
|
||||
!this.configService.get<CacheConf>('CACHE').REDIS.ENABLED &&
|
||||
!this.configService.get<CacheConf>('CACHE').LOCAL.ENABLED
|
||||
? false
|
||||
: true,
|
||||
!!this.configService.get<CacheConf>('CACHE').REDIS.ENABLED &&
|
||||
!!this.configService.get<CacheConf>('CACHE').LOCAL.ENABLED,
|
||||
} as unknown as MiscMessageGenerationOptions,
|
||||
);
|
||||
})();
|
||||
@ -2003,6 +1995,8 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
public async setPresence(data: SetPresenceDto) {
|
||||
try {
|
||||
await this.client.sendPresenceUpdate(data.presence);
|
||||
|
||||
return { presence: data.presence };
|
||||
} catch (error) {
|
||||
this.logger.error(error);
|
||||
throw new BadRequestException(error.toString());
|
||||
|
@ -171,14 +171,6 @@ export const instanceSchema: JSONSchema7 = {
|
||||
chatwootMergeBrazilContacts: { type: 'boolean' },
|
||||
chatwootImportMessages: { type: 'boolean' },
|
||||
chatwootDaysLimitImportMessages: { type: 'number' },
|
||||
// Typebot
|
||||
typebotUrl: { type: 'string' },
|
||||
typebot: { type: 'boolean' },
|
||||
typebotExpire: { type: 'number' },
|
||||
typebotKeywordFinish: { type: 'string' },
|
||||
typebotDelayMessage: { type: 'number' },
|
||||
typebotUnknownMessage: { type: 'string' },
|
||||
typebotListeningFromMe: { type: 'boolean' },
|
||||
},
|
||||
...isNotEmpty('instanceName'),
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user