mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-25 01:48:39 -06:00
chore: Add businessId to Instance model
Updated the Instance model to include a new optional string property called businessId. This change affects the following files: - prisma/postgresql-schema.prisma - src/api/controllers/instance.controller.ts - src/api/dto/instance.dto.ts - src/api/services/monitor.service.ts - src/validate/instance.schema.ts A new untracked migration folder has been created to manage database schema updates: - prisma/migrations/20240712144948_add_business_id_column_to_instances/ This change allows for storing a business identifier alongside the instance, enhancing the ability to categorize and manage instances more effectively.
This commit is contained in:
parent
f6d4f940a3
commit
a145935366
@ -0,0 +1,2 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "Instance" ADD COLUMN "businessId" VARCHAR(100);
|
@ -54,6 +54,7 @@ model Instance {
|
|||||||
profilePicUrl String? @db.VarChar(500)
|
profilePicUrl String? @db.VarChar(500)
|
||||||
integration String? @db.VarChar(100)
|
integration String? @db.VarChar(100)
|
||||||
number String? @db.VarChar(100)
|
number String? @db.VarChar(100)
|
||||||
|
businessId String? @db.VarChar(100)
|
||||||
token String? @unique @db.VarChar(255)
|
token String? @unique @db.VarChar(255)
|
||||||
clientName String? @db.VarChar(100)
|
clientName String? @db.VarChar(100)
|
||||||
createdAt DateTime? @default(now()) @db.Timestamp
|
createdAt DateTime? @default(now()) @db.Timestamp
|
||||||
|
@ -87,6 +87,7 @@ export class InstanceController {
|
|||||||
chatwootDaysLimitImportMessages,
|
chatwootDaysLimitImportMessages,
|
||||||
chatwootOrganization,
|
chatwootOrganization,
|
||||||
chatwootLogo,
|
chatwootLogo,
|
||||||
|
businessId,
|
||||||
}: InstanceDto) {
|
}: InstanceDto) {
|
||||||
try {
|
try {
|
||||||
if (token) await this.authService.checkDuplicateToken(token);
|
if (token) await this.authService.checkDuplicateToken(token);
|
||||||
@ -125,7 +126,7 @@ export class InstanceController {
|
|||||||
if (!token) hash = v4().toUpperCase();
|
if (!token) hash = v4().toUpperCase();
|
||||||
else hash = token;
|
else hash = token;
|
||||||
|
|
||||||
await this.waMonitor.saveInstance({ instanceId, integration, instanceName, hash, number });
|
await this.waMonitor.saveInstance({ instanceId, integration, instanceName, hash, number, businessId });
|
||||||
|
|
||||||
instance.setInstance({
|
instance.setInstance({
|
||||||
instanceName,
|
instanceName,
|
||||||
|
@ -42,6 +42,7 @@ export class InstanceDto {
|
|||||||
proxyProtocol?: string;
|
proxyProtocol?: string;
|
||||||
proxyUsername?: string;
|
proxyUsername?: string;
|
||||||
proxyPassword?: string;
|
proxyPassword?: string;
|
||||||
|
businessId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SetPresenceDto {
|
export class SetPresenceDto {
|
||||||
|
@ -192,6 +192,7 @@ export class WAMonitoringService {
|
|||||||
integration: data.integration || Integration.WHATSAPP_BAILEYS,
|
integration: data.integration || Integration.WHATSAPP_BAILEYS,
|
||||||
token: data.hash,
|
token: data.hash,
|
||||||
clientName: clientName,
|
clientName: clientName,
|
||||||
|
businessId: data.businessId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ export const instanceSchema: JSONSchema7 = {
|
|||||||
instanceName: { type: 'string' },
|
instanceName: { type: 'string' },
|
||||||
token: { type: 'string' },
|
token: { type: 'string' },
|
||||||
number: { type: 'string', pattern: '^\\d+[\\.@\\w-]+' },
|
number: { type: 'string', pattern: '^\\d+[\\.@\\w-]+' },
|
||||||
|
businessId: { type: 'string' },
|
||||||
qrcode: { type: 'boolean' },
|
qrcode: { type: 'boolean' },
|
||||||
Integration: {
|
Integration: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
Loading…
Reference in New Issue
Block a user