Skip to content
Snippets Groups Projects
Commit 668df46b authored by Lukáš Kratochvíl's avatar Lukáš Kratochvíl
Browse files

fix: added async/await to prisma queries in category

parent 554e74d0
No related branches found
No related tags found
No related merge requests found
......@@ -31,12 +31,12 @@ export class CategoriesController {
}
@Patch(':id')
update(@Param('id') id: string, @Body() updateCategoryDto: UpdateCategoryDto) {
return this.categoriesService.update(id, updateCategoryDto);
async update(@Param('id') id: string, @Body() updateCategoryDto: UpdateCategoryDto) {
return await this.categoriesService.update(id, updateCategoryDto);
}
@Delete(':id')
remove(@Param('id') id: string) {
return this.categoriesService.remove(id);
async remove(@Param('id') id: string) {
return await this.categoriesService.remove(id);
}
}
......@@ -7,26 +7,26 @@ import { UpdateCategoryDto } from './dto/update-category.dto';
export class CategoriesService {
constructor(private prisma: PrismaService) {}
create(createCategoryDto: CreateCategoryDto) {
return this.prisma.category.create({
async create(createCategoryDto: CreateCategoryDto) {
return await this.prisma.category.create({
data: createCategoryDto,
});
}
findAll() {
return this.prisma.category.findMany();
async findAll() {
return await this.prisma.category.findMany();
}
findOne(id: string) {
return this.prisma.category.findUnique({
async findOne(id: string) {
return await this.prisma.category.findUnique({
where: {
id,
},
});
}
update(id: string, updateCategoryDto: UpdateCategoryDto) {
return this.prisma.category.update({
async update(id: string, updateCategoryDto: UpdateCategoryDto) {
return await this.prisma.category.update({
where: {
id,
},
......@@ -36,8 +36,8 @@ export class CategoriesService {
});
}
remove(id: string) {
return this.prisma.category.update({
async remove(id: string) {
return await this.prisma.category.update({
where: {
id,
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment