📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
new route to get a category
Yevhenii K254713b6c873
diff --git a/src/marketplace/categories/categories.controller.ts b/src/marketplace/categories/categories.controller.tsindex 046fd882c..965d167fc 100644--- a/src/marketplace/categories/categories.controller.ts+++ b/src/marketplace/categories/categories.controller.ts@@ -3,6 +3,7 @@ import {ConflictException,Controller,Delete,+ Get,NotFoundException,Param,Patch,@@ -13,6 +14,7 @@ import { CategoriesService } from './categories.service'import { Category } from './category.entity'import { CreateCategory } from './dtos/create-category.dto'import { DeleteCategoryParams } from './dtos/delete-category-params.dto'+import { GetCategoryParams } from './dtos/get-category-params.dto'import { UpdateCategoryParams } from './dtos/update-category-params.dto'import { UpdateCategory } from './dtos/update-category.dto'import { ISaveCategory } from './interfaces/save-category.interface'@@ -22,6 +24,17 @@ import { ISaveCategory } from './interfaces/save-category.interface'export class CategoriesController {constructor(private readonly categoriesService: CategoriesService) {}+ @Get(':categoryId')+ async getCategory(@Param() params: GetCategoryParams): Promise<Category> {+ const category = await this.categoriesService.findById(params.categoryId)++ if (!category) {+ throw new NotFoundException('Category not found.')+ }++ return category+ }+@Post()async createCategory(@Body() body: CreateCategory,diff --git a/src/marketplace/categories/dtos/get-category-params.dto.ts b/src/marketplace/categories/dtos/get-category-params.dto.tsnew file mode 100644index 000000000..10134fd79--- /dev/null+++ b/src/marketplace/categories/dtos/get-category-params.dto.ts@@ -0,0 +1,3 @@+export class GetCategoryParams {+ readonly categoryId!: number+}