@hed-hog/category 0.0.275 → 0.0.278

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,4 @@
1
+ ```markdown
1
2
  # @hed-hog/category
2
3
 
3
4
  ## 1. Visão geral do módulo
@@ -14,31 +15,29 @@ O módulo `@hed-hog/category` é responsável pela gestão de categorias no sist
14
15
 
15
16
  ## 3. Endpoints
16
17
 
17
- | Método | Path | Autenticação | Descrição |
18
- |--------|---------------------------|-----------------------|--------------------------------------------------|
19
- | GET | `/category/root` | Autenticada (admin, admin-category) | Retorna categorias raiz ativas no idioma solicitado. |
20
- | GET | `/category/stats` | Autenticada (admin, admin-category) | Retorna estatísticas gerais das categorias. |
21
- | GET | `/category/:id` | Autenticada (admin, admin-category) | Retorna categoria pelo ID com localizações. |
22
- | GET | `/category/parent/:categoryId` | Autenticada (admin, admin-category) | Retorna categorias filhas de uma categoria pai. |
23
- | GET | `/category` | Autenticada (admin, admin-category) | Lista categorias com paginação, filtro por status e categoria pai. |
24
- | POST | `/category` | Autenticada (admin, admin-category) | Cria uma nova categoria com localizações. |
25
- | PATCH | `/category/:id` | Autenticada (admin, admin-category) | Atualiza uma categoria existente parcialmente. |
26
- | DELETE | `/category/:id` | Autenticada (admin, admin-category) | Remove uma categoria pelo ID. |
27
-
28
- ### Detalhes dos endpoints
18
+ | Método | Path | Autenticação | Descrição |
19
+ |--------|---------------------------|----------------------------------|--------------------------------------------------|
20
+ | GET | `/category/root` | Autenticada (roles: admin, admin-category) | Retorna categorias raiz ativas no idioma solicitado. |
21
+ | GET | `/category/stats` | Autenticada (roles: admin, admin-category) | Retorna estatísticas gerais das categorias. |
22
+ | GET | `/category/:id` | Autenticada (roles: admin, admin-category) | Retorna categoria pelo ID com localizações. |
23
+ | GET | `/category/parent/:categoryId` | Autenticada (roles: admin, admin-category) | Retorna categorias filhas de uma categoria pai. |
24
+ | GET | `/category` | Autenticada (roles: admin, admin-category) | Lista categorias com paginação, filtro por status e categoria pai. |
25
+ | POST | `/category` | Autenticada (roles: admin, admin-category) | Cria uma nova categoria com localizações. |
26
+ | PATCH | `/category/:id` | Autenticada (roles: admin, admin-category) | Atualiza uma categoria existente parcialmente. |
27
+ | DELETE | `/category/:id` | Autenticada (roles: admin, admin-category) | Remove uma categoria pelo ID. |
29
28
 
30
29
  ---
31
30
 
31
+ ### Detalhes dos endpoints
32
+
32
33
  #### GET `/category/root`
33
34
 
34
35
  - **Autenticação:** Necessária (roles: admin, admin-category)
35
- - **Query:** Nenhuma
36
+ - **Query:** `locale` (string, obrigatório) — código do idioma para as localizações.
36
37
  - **Resposta:** Lista de categorias raiz ativas com traduções no idioma solicitado.
37
38
  - **Erros comuns:**
38
39
  - 400 Bad Request: Locale inválido ou não encontrado.
39
40
 
40
- ---
41
-
42
41
  #### GET `/category/stats`
43
42
 
44
43
  - **Autenticação:** Necessária (roles: admin, admin-category)
@@ -53,35 +52,32 @@ O módulo `@hed-hog/category` é responsável pela gestão de categorias no sist
53
52
  ```
54
53
  - **Erros comuns:** Nenhum específico.
55
54
 
56
- ---
57
-
58
55
  #### GET `/category/:id`
59
56
 
60
57
  - **Autenticação:** Necessária (roles: admin, admin-category)
61
58
  - **Parâmetros:**
62
59
  - `id` (number, obrigatório): ID da categoria.
60
+ - **Query:** `locale` (string, obrigatório) — código do idioma para as localizações.
63
61
  - **Resposta:** Objeto categoria com localizações.
64
62
  - **Erros comuns:**
65
63
  - 404 Not Found: Categoria não encontrada.
66
64
 
67
- ---
68
-
69
65
  #### GET `/category/parent/:categoryId`
70
66
 
71
67
  - **Autenticação:** Necessária (roles: admin, admin-category)
72
68
  - **Parâmetros:**
73
69
  - `categoryId` (string, obrigatório): ID da categoria pai.
70
+ - **Query:** `locale` (string, obrigatório) — código do idioma para as localizações.
74
71
  - **Resposta:** Lista de categorias filhas com localizações.
75
72
  - **Erros comuns:**
76
73
  - 400 Bad Request: Locale inválido.
77
74
  - 404 Not Found: Categoria pai não encontrada ou sem filhos.
78
75
 
79
- ---
80
-
81
76
  #### GET `/category`
82
77
 
83
78
  - **Autenticação:** Necessária (roles: admin, admin-category)
84
79
  - **Query:**
80
+ - `locale` (string, obrigatório) — código do idioma para as localizações.
85
81
  - `status` (string, opcional): Filtra por status (`active`, `inactive`, `all`).
86
82
  - `parent` (string, opcional): Filtra por categoria pai (`slug` ou `root` ou `all`).
87
83
  - Parâmetros de paginação via cabeçalho ou query (padrão do módulo de paginação).
@@ -89,8 +85,6 @@ O módulo `@hed-hog/category` é responsável pela gestão de categorias no sist
89
85
  - **Erros comuns:**
90
86
  - 400 Bad Request: Locale inválido.
91
87
 
92
- ---
93
-
94
88
  #### POST `/category`
95
89
 
96
90
  - **Autenticação:** Necessária (roles: admin, admin-category)
@@ -113,8 +107,6 @@ O módulo `@hed-hog/category` é responsável pela gestão de categorias no sist
113
107
  - **Erros comuns:**
114
108
  - 400 Bad Request: Dados inválidos, locale ausente, categoria pai não encontrada.
115
109
 
116
- ---
117
-
118
110
  #### PATCH `/category/:id`
119
111
 
120
112
  - **Autenticação:** Necessária (roles: admin, admin-category)
@@ -126,8 +118,6 @@ O módulo `@hed-hog/category` é responsável pela gestão de categorias no sist
126
118
  - 400 Bad Request: Categoria pai não encontrada, locale inválido.
127
119
  - 404 Not Found: Categoria não encontrada.
128
120
 
129
- ---
130
-
131
121
  #### DELETE `/category/:id`
132
122
 
133
123
  - **Autenticação:** Necessária (roles: admin, admin-category)
@@ -330,3 +320,4 @@ Authorization: Bearer <token>
330
320
  ---
331
321
 
332
322
  Este módulo é essencial para a organização e categorização dos conteúdos e produtos no sistema HedHog, garantindo flexibilidade e suporte multilíngue com controle de acesso robusto.
323
+ ```
@@ -25,9 +25,9 @@ export declare class CategoryController {
25
25
  updated_at: Date;
26
26
  slug: string;
27
27
  status: import("@prisma/client").$Enums.category_status_enum | null;
28
+ category_id: number | null;
28
29
  icon: string | null;
29
30
  color: string | null;
30
- category_id: number | null;
31
31
  }>;
32
32
  getByParent(categoryId: string, locale: string): Promise<any[]>;
33
33
  findAll(paginationParams: any, locale: string, status: string, parent: string): Promise<{
@@ -45,9 +45,9 @@ export declare class CategoryController {
45
45
  updated_at: Date;
46
46
  slug: string;
47
47
  status: import("@prisma/client").$Enums.category_status_enum | null;
48
+ category_id: number | null;
48
49
  icon: string | null;
49
50
  color: string | null;
50
- category_id: number | null;
51
51
  }>;
52
52
  create(localeStr: string, { locale, slug, category_id, color, icon, status }: CategoryDTO): Promise<{
53
53
  id: number;
@@ -55,9 +55,9 @@ export declare class CategoryController {
55
55
  updated_at: Date;
56
56
  slug: string;
57
57
  status: import("@prisma/client").$Enums.category_status_enum | null;
58
+ category_id: number | null;
58
59
  icon: string | null;
59
60
  color: string | null;
60
- category_id: number | null;
61
61
  }>;
62
62
  update(localeStr: string, id: number, { locale, slug, category_id, color, icon, status }: Partial<CategoryDTO>): Promise<{
63
63
  category_locale: {
@@ -74,9 +74,9 @@ export declare class CategoryController {
74
74
  updated_at: Date;
75
75
  slug: string;
76
76
  status: import("@prisma/client").$Enums.category_status_enum | null;
77
+ category_id: number | null;
77
78
  icon: string | null;
78
79
  color: string | null;
79
- category_id: number | null;
80
80
  }>;
81
81
  }
82
82
  //# sourceMappingURL=category.controller.d.ts.map
@@ -28,9 +28,9 @@ export declare class CategoryService {
28
28
  updated_at: Date;
29
29
  slug: string;
30
30
  status: import("@prisma/client").$Enums.category_status_enum | null;
31
+ category_id: number | null;
31
32
  icon: string | null;
32
33
  color: string | null;
33
- category_id: number | null;
34
34
  }>;
35
35
  getRootCategories(locale: string): Promise<any[]>;
36
36
  getByParent(id: string, locale: string): Promise<any[]>;
@@ -49,9 +49,9 @@ export declare class CategoryService {
49
49
  updated_at: Date;
50
50
  slug: string;
51
51
  status: import("@prisma/client").$Enums.category_status_enum | null;
52
+ category_id: number | null;
52
53
  icon: string | null;
53
54
  color: string | null;
54
- category_id: number | null;
55
55
  }>;
56
56
  create(localeStr: string, { locale, slug, category_id, color, icon, status }: CategoryDTO): Promise<{
57
57
  id: number;
@@ -59,9 +59,9 @@ export declare class CategoryService {
59
59
  updated_at: Date;
60
60
  slug: string;
61
61
  status: import("@prisma/client").$Enums.category_status_enum | null;
62
+ category_id: number | null;
62
63
  icon: string | null;
63
64
  color: string | null;
64
- category_id: number | null;
65
65
  }>;
66
66
  update(localeStr: string, id: number, { locale, slug, category_id, color, icon, status }: Partial<CategoryDTO>): Promise<{
67
67
  category_locale: {
@@ -78,9 +78,9 @@ export declare class CategoryService {
78
78
  updated_at: Date;
79
79
  slug: string;
80
80
  status: import("@prisma/client").$Enums.category_status_enum | null;
81
+ category_id: number | null;
81
82
  icon: string | null;
82
83
  color: string | null;
83
- category_id: number | null;
84
84
  }>;
85
85
  }
86
86
  //# sourceMappingURL=category.service.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hed-hog/category",
3
- "version": "0.0.275",
3
+ "version": "0.0.278",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "dependencies": {
@@ -9,10 +9,10 @@
9
9
  "@nestjs/core": "^11",
10
10
  "@nestjs/jwt": "^11",
11
11
  "@nestjs/mapped-types": "*",
12
+ "@hed-hog/api-prisma": "0.0.5",
12
13
  "@hed-hog/api": "0.0.4",
13
14
  "@hed-hog/api-locale": "0.0.13",
14
- "@hed-hog/api-prisma": "0.0.5",
15
- "@hed-hog/core": "0.0.275",
15
+ "@hed-hog/core": "0.0.278",
16
16
  "@hed-hog/api-pagination": "0.0.6"
17
17
  },
18
18
  "exports": {