chore: port lab4 solution as lab5 base

This commit is contained in:
2026-11-15 14:42:12 +03:00
parent 276dbdad8a
commit 19dda6e286
90 changed files with 18537 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
import { ApiError } from '../common/filters/api-error';
import { validate as isUuid } from '../common/uuid';
import { PrismaService } from '../db/prisma.service';
export async function assertChatMember(
prisma: PrismaService,
chatId: string,
userId: string,
): Promise<void> {
if (!isUuid(chatId)) {
throw new ApiError('invalid_request', 'chatId must be a valid UUID');
}
const member = await prisma.chatMember.findUnique({
where: { chatId_userId: { chatId, userId } },
});
if (!member) {
throw new ApiError('not_found', 'chat not found');
}
}