fix document 500 error and fix users tabel for bot

This commit is contained in:
lendry
2026-06-26 10:32:04 +03:00
parent ead3155ad8
commit d5e6b58955
17 changed files with 396 additions and 67 deletions

View File

@@ -30,6 +30,14 @@ const ROLES = [
isSystem: true,
isDefault: true
},
{
slug: 'bot',
name: 'Бот',
description: 'Системная учётная запись Telegram-бота',
permissions: [] as string[],
isSystem: true,
isDefault: false
},
{
slug: 'admin',
name: 'Администратор',
@@ -120,9 +128,13 @@ export class AdminSeedService implements OnModuleInit {
}
}
const users = await this.prisma.user.findMany({ where: { deletedAt: null }, select: { id: true } });
const users = await this.prisma.user.findMany({ where: { deletedAt: null }, select: { id: true, isSystemAccount: true, linkedBotId: true } });
for (const user of users) {
await this.rbac.ensureDefaultUserRole(user.id);
if (user.linkedBotId || user.isSystemAccount) {
await this.rbac.ensureBotUserRole(user.id);
} else {
await this.rbac.ensureDefaultUserRole(user.id);
}
}
}
}