mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-25 14:47:45 -06:00
feat: Route to fetch all privacy settings
This commit is contained in:
@@ -63,6 +63,10 @@ export class ChatController {
|
||||
return await this.waMonitor.waInstances[instanceName].fetchChats();
|
||||
}
|
||||
|
||||
public async fetchPrivacySettings({ instanceName }: InstanceDto) {
|
||||
return await this.waMonitor.waInstances[instanceName].fetchPrivacySettings();
|
||||
}
|
||||
|
||||
public async getBusinessProfile(
|
||||
{ instanceName }: InstanceDto,
|
||||
data: ProfilePictureDto,
|
||||
|
||||
@@ -140,6 +140,16 @@ export class ChatRouter extends RouterBroker {
|
||||
return res.status(HttpStatus.OK).json(response);
|
||||
})
|
||||
// Profile routes
|
||||
.get(this.routerPath('fetchPrivacySettings'), ...guards, async (req, res) => {
|
||||
const response = await this.dataValidate<InstanceDto>({
|
||||
request: req,
|
||||
schema: null,
|
||||
ClassRef: InstanceDto,
|
||||
execute: (instance) => chatController.fetchPrivacySettings(instance),
|
||||
});
|
||||
|
||||
return res.status(HttpStatus.OK).json(response);
|
||||
})
|
||||
.post(this.routerPath('getBusinessProfile'), ...guards, async (req, res) => {
|
||||
const response = await this.dataValidate<ProfilePictureDto>({
|
||||
request: req,
|
||||
|
||||
@@ -1475,6 +1475,10 @@ export class WAStartupService {
|
||||
return await this.repository.chat.find({ where: { owner: this.instance.wuid } });
|
||||
}
|
||||
|
||||
public async fetchPrivacySettings() {
|
||||
return await this.client.fetchPrivacySettings();
|
||||
}
|
||||
|
||||
public async getBusinessProfile(number: string) {
|
||||
try {
|
||||
let jid;
|
||||
|
||||
Reference in New Issue
Block a user