Chat settings in Super Admin and changing the chat title and position.
This commit is contained in:
@@ -12,9 +12,7 @@ import type {
|
||||
ConversationSettingsDto,
|
||||
PlatformConversationStatsDto,
|
||||
UpdateConversationSettingsRequest,
|
||||
UserRole,
|
||||
} from '@mento/shared';
|
||||
import { canManageSettings } from '@mento/shared';
|
||||
import { PrismaService } from '../prisma/prisma.service';
|
||||
import { TahesabCryptoService } from '../integrations/tahesab/tahesab-crypto.service';
|
||||
import { ChatExternalClient, type ExternalRoomRow } from './chat-external.client';
|
||||
@@ -59,14 +57,17 @@ export class ConversationsService {
|
||||
};
|
||||
}
|
||||
|
||||
async updateSettings(
|
||||
/** ذخیره تنظیمات اتصال چت — فقط از مسیر سوپرادمین */
|
||||
async upsertSettingsForOrganization(
|
||||
organizationId: string,
|
||||
role: UserRole | string,
|
||||
dto: UpdateConversationSettingsRequest,
|
||||
): Promise<ConversationSettingsDto> {
|
||||
if (!canManageSettings(role)) {
|
||||
throw new ForbiddenException('فقط مدیر میتواند تنظیمات گفتگو را تغییر دهد');
|
||||
}
|
||||
const org = await this.prisma.organization.findUnique({
|
||||
where: { id: organizationId },
|
||||
select: { id: true },
|
||||
});
|
||||
if (!org) throw new NotFoundException('محیط پیدا نشد');
|
||||
|
||||
const host = this.chat.normalizeHost(dto.chatHost);
|
||||
if (!host) throw new BadRequestException('آدرس سرویس گفتگو نامعتبر است');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user