feat: Реализована функциональность списка желаний с бэкенд API, базой данных и пользовательским интерфейсом.

This commit is contained in:
2025-12-06 11:08:07 +03:00
parent 07c1285bb9
commit 7eb4fb731b
42 changed files with 1610 additions and 44 deletions

View File

@@ -0,0 +1,41 @@
import { Controller, Get, Post, Patch, Delete, Body, Param, UsePipes } from '@nestjs/common';
import { WishlistCategoriesService } from './categories.service';
import { CreateWishlistCategoryDto, UpdateWishlistCategoryDto } from './dto/category.dto';
import { ZodValidationPipe } from '../pipes/zod-validation.pipe';
import { CreateWishlistCategorySchema, UpdateWishlistCategorySchema } from './dto/category.dto';
@Controller('api/wishlist/categories')
export class WishlistCategoriesController {
constructor(private readonly categoriesService: WishlistCategoriesService) { }
@Get()
async findAll() {
return this.categoriesService.findAll();
}
@Get(':id')
async findOne(@Param('id') id: string) {
return this.categoriesService.findOne(id);
}
@Post()
@UsePipes(new ZodValidationPipe(CreateWishlistCategorySchema))
async create(@Body() dto: CreateWishlistCategoryDto) {
return this.categoriesService.create(dto);
}
@Patch(':id')
@UsePipes(new ZodValidationPipe(UpdateWishlistCategorySchema))
async update(
@Param('id') id: string,
@Body() dto: UpdateWishlistCategoryDto
) {
return this.categoriesService.update(id, dto);
}
@Delete(':id')
async delete(@Param('id') id: string) {
await this.categoriesService.delete(id);
return { message: 'Category deleted successfully' };
}
}