diff --git a/backend/src/repositories/cardRepository.ts b/backend/src/repositories/cardRepository.ts index 6ae6a39..44cc17c 100644 --- a/backend/src/repositories/cardRepository.ts +++ b/backend/src/repositories/cardRepository.ts @@ -3,42 +3,42 @@ import { prisma } from '@configs/prisma'; import { CreateCard, UpdateCard } from '@dtos'; class CardRepository { - async getCardById(id: string) { + getCardById(id: string) { try { - return await prisma.card.findFirst({ where: { id } }); + return prisma.card.findFirst({ where: { id } }); } catch { throw new CustomError('entityNotFoundError'); } } - async getCardsCount(wordId: string) { + getCardsCount(wordId: string) { try { - return await prisma.card.count({ where: { wordId } }); + return prisma.card.count({ where: { wordId } }); } catch { throw new CustomError('entityNotFoundError'); } } - async getCardsByGroupId(groupId: string) { + getCardsByGroupId(groupId: string) { try { - return await prisma.card.findMany({ where: { groupId }, include: { word: true } }); + return prisma.card.findMany({ where: { groupId }, include: { word: true } }); } catch { throw new CustomError('entityNotFoundError'); } } - async createCard(data: CreateCard) { + createCard(data: CreateCard) { try { - return await prisma.card.create({ data, include: { word: true } }); + return prisma.card.create({ data, include: { word: true } }); } catch { throw new CustomError('entityCreateError'); } } - async updateCard(data: UpdateCard) { + updateCard(data: UpdateCard) { try { const dataWithoutId = { ...data, id: undefined }; - return await prisma.card.update({ where: { id: data.id }, data: dataWithoutId }); + return prisma.card.update({ where: { id: data.id }, data: dataWithoutId }); } catch { throw new CustomError('entityUpdateError'); } diff --git a/backend/src/repositories/groupRepository.ts b/backend/src/repositories/groupRepository.ts index 7453c52..0b702a4 100644 --- a/backend/src/repositories/groupRepository.ts +++ b/backend/src/repositories/groupRepository.ts @@ -3,9 +3,9 @@ import { prisma } from '@configs/prisma'; import { CreateGroupDto, UpdateGroupDto } from '@dtos'; class GroupRepository { - async getGroupsByUserId(userId: string) { + getGroupsByUserId(userId: string) { try { - return await prisma.group.findMany({ where: { userId } }); + return prisma.group.findMany({ where: { userId } }); } catch { throw new CustomError('entityNotFoundError'); } diff --git a/backend/src/repositories/userRepository.ts b/backend/src/repositories/userRepository.ts index c9751d6..02f3614 100644 --- a/backend/src/repositories/userRepository.ts +++ b/backend/src/repositories/userRepository.ts @@ -20,9 +20,9 @@ class UserRepository { return user; } - async create(data: CreateUserDto) { + create(data: CreateUserDto) { try { - return await prisma.user.create({ data }); + return prisma.user.create({ data }); } catch { throw new CustomError('entityCreateError'); } diff --git a/backend/src/repositories/wordRepository.ts b/backend/src/repositories/wordRepository.ts index 60054cd..ff26ff8 100644 --- a/backend/src/repositories/wordRepository.ts +++ b/backend/src/repositories/wordRepository.ts @@ -3,9 +3,9 @@ import { prisma } from '@configs/prisma'; import { Word } from '@prisma/client'; class WordRepository { - async searchWord(query: string) { + searchWord(query: string) { try { - return await prisma.word.findMany({ + return prisma.word.findMany({ where: { OR: [ { translation: { contains: query } }, @@ -19,17 +19,17 @@ class WordRepository { } } - async createWord(data: Omit) { + createWord(data: Omit) { try { - return await prisma.word.create({ data }); + return prisma.word.create({ data }); } catch { throw new CustomError('entityCreateError'); } } - async updateWord(data: Partial) { + updateWord(data: Partial) { try { - return await prisma.word.update({ where: { id: data.id }, data }); + return prisma.word.update({ where: { id: data.id }, data }); } catch { throw new CustomError('entityUpdateError'); }