@hed-hog/category 0.0.274 → 0.0.276
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 +16 -27
- package/dist/category.controller.d.ts +4 -4
- package/dist/category.service.d.ts +4 -4
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -14,31 +14,29 @@ O módulo `@hed-hog/category` é responsável pela gestão de categorias no sist
|
|
|
14
14
|
|
|
15
15
|
## 3. Endpoints
|
|
16
16
|
|
|
17
|
-
| Método | Path
|
|
18
|
-
|
|
19
|
-
| GET | `/category/root`
|
|
20
|
-
| GET | `/category/stats`
|
|
21
|
-
| GET | `/category/:id`
|
|
22
|
-
| GET | `/category/parent/:categoryId` | Autenticada
|
|
23
|
-
| GET | `/category`
|
|
24
|
-
| POST | `/category`
|
|
25
|
-
| PATCH | `/category/:id`
|
|
26
|
-
| DELETE | `/category/:id`
|
|
27
|
-
|
|
28
|
-
### Detalhes dos endpoints
|
|
17
|
+
| Método | Path | Autenticação | Descrição |
|
|
18
|
+
|--------|---------------------------|----------------------------------|--------------------------------------------------|
|
|
19
|
+
| GET | `/category/root` | Autenticada (roles: admin, admin-category) | Retorna categorias raiz ativas no idioma solicitado. |
|
|
20
|
+
| GET | `/category/stats` | Autenticada (roles: admin, admin-category) | Retorna estatísticas gerais das categorias. |
|
|
21
|
+
| GET | `/category/:id` | Autenticada (roles: admin, admin-category) | Retorna categoria pelo ID com localizações. |
|
|
22
|
+
| GET | `/category/parent/:categoryId` | Autenticada (roles: admin, admin-category) | Retorna categorias filhas de uma categoria pai. |
|
|
23
|
+
| GET | `/category` | Autenticada (roles: admin, admin-category) | Lista categorias com paginação, filtro por status e categoria pai. |
|
|
24
|
+
| POST | `/category` | Autenticada (roles: admin, admin-category) | Cria uma nova categoria com localizações. |
|
|
25
|
+
| PATCH | `/category/:id` | Autenticada (roles: admin, admin-category) | Atualiza uma categoria existente parcialmente. |
|
|
26
|
+
| DELETE | `/category/:id` | Autenticada (roles: admin, admin-category) | Remove uma categoria pelo ID. |
|
|
29
27
|
|
|
30
28
|
---
|
|
31
29
|
|
|
30
|
+
### Detalhes dos endpoints
|
|
31
|
+
|
|
32
32
|
#### GET `/category/root`
|
|
33
33
|
|
|
34
34
|
- **Autenticação:** Necessária (roles: admin, admin-category)
|
|
35
|
-
- **Query:**
|
|
35
|
+
- **Query:** `locale` (string, obrigatório) — código do idioma para as localizações.
|
|
36
36
|
- **Resposta:** Lista de categorias raiz ativas com traduções no idioma solicitado.
|
|
37
37
|
- **Erros comuns:**
|
|
38
38
|
- 400 Bad Request: Locale inválido ou não encontrado.
|
|
39
39
|
|
|
40
|
-
---
|
|
41
|
-
|
|
42
40
|
#### GET `/category/stats`
|
|
43
41
|
|
|
44
42
|
- **Autenticação:** Necessária (roles: admin, admin-category)
|
|
@@ -53,35 +51,32 @@ O módulo `@hed-hog/category` é responsável pela gestão de categorias no sist
|
|
|
53
51
|
```
|
|
54
52
|
- **Erros comuns:** Nenhum específico.
|
|
55
53
|
|
|
56
|
-
---
|
|
57
|
-
|
|
58
54
|
#### GET `/category/:id`
|
|
59
55
|
|
|
60
56
|
- **Autenticação:** Necessária (roles: admin, admin-category)
|
|
61
57
|
- **Parâmetros:**
|
|
62
58
|
- `id` (number, obrigatório): ID da categoria.
|
|
59
|
+
- **Query:** `locale` (string, obrigatório) — código do idioma para as localizações.
|
|
63
60
|
- **Resposta:** Objeto categoria com localizações.
|
|
64
61
|
- **Erros comuns:**
|
|
65
62
|
- 404 Not Found: Categoria não encontrada.
|
|
66
63
|
|
|
67
|
-
---
|
|
68
|
-
|
|
69
64
|
#### GET `/category/parent/:categoryId`
|
|
70
65
|
|
|
71
66
|
- **Autenticação:** Necessária (roles: admin, admin-category)
|
|
72
67
|
- **Parâmetros:**
|
|
73
68
|
- `categoryId` (string, obrigatório): ID da categoria pai.
|
|
69
|
+
- **Query:** `locale` (string, obrigatório) — código do idioma para as localizações.
|
|
74
70
|
- **Resposta:** Lista de categorias filhas com localizações.
|
|
75
71
|
- **Erros comuns:**
|
|
76
72
|
- 400 Bad Request: Locale inválido.
|
|
77
73
|
- 404 Not Found: Categoria pai não encontrada ou sem filhos.
|
|
78
74
|
|
|
79
|
-
---
|
|
80
|
-
|
|
81
75
|
#### GET `/category`
|
|
82
76
|
|
|
83
77
|
- **Autenticação:** Necessária (roles: admin, admin-category)
|
|
84
78
|
- **Query:**
|
|
79
|
+
- `locale` (string, obrigatório) — código do idioma para as localizações.
|
|
85
80
|
- `status` (string, opcional): Filtra por status (`active`, `inactive`, `all`).
|
|
86
81
|
- `parent` (string, opcional): Filtra por categoria pai (`slug` ou `root` ou `all`).
|
|
87
82
|
- Parâmetros de paginação via cabeçalho ou query (padrão do módulo de paginação).
|
|
@@ -89,8 +84,6 @@ O módulo `@hed-hog/category` é responsável pela gestão de categorias no sist
|
|
|
89
84
|
- **Erros comuns:**
|
|
90
85
|
- 400 Bad Request: Locale inválido.
|
|
91
86
|
|
|
92
|
-
---
|
|
93
|
-
|
|
94
87
|
#### POST `/category`
|
|
95
88
|
|
|
96
89
|
- **Autenticação:** Necessária (roles: admin, admin-category)
|
|
@@ -113,8 +106,6 @@ O módulo `@hed-hog/category` é responsável pela gestão de categorias no sist
|
|
|
113
106
|
- **Erros comuns:**
|
|
114
107
|
- 400 Bad Request: Dados inválidos, locale ausente, categoria pai não encontrada.
|
|
115
108
|
|
|
116
|
-
---
|
|
117
|
-
|
|
118
109
|
#### PATCH `/category/:id`
|
|
119
110
|
|
|
120
111
|
- **Autenticação:** Necessária (roles: admin, admin-category)
|
|
@@ -126,8 +117,6 @@ O módulo `@hed-hog/category` é responsável pela gestão de categorias no sist
|
|
|
126
117
|
- 400 Bad Request: Categoria pai não encontrada, locale inválido.
|
|
127
118
|
- 404 Not Found: Categoria não encontrada.
|
|
128
119
|
|
|
129
|
-
---
|
|
130
|
-
|
|
131
120
|
#### DELETE `/category/:id`
|
|
132
121
|
|
|
133
122
|
- **Autenticação:** Necessária (roles: admin, admin-category)
|
|
@@ -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.
|
|
3
|
+
"version": "0.0.276",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
"@nestjs/core": "^11",
|
|
10
10
|
"@nestjs/jwt": "^11",
|
|
11
11
|
"@nestjs/mapped-types": "*",
|
|
12
|
-
"@hed-hog/api": "0.0.4",
|
|
13
12
|
"@hed-hog/api-prisma": "0.0.5",
|
|
13
|
+
"@hed-hog/api": "0.0.4",
|
|
14
14
|
"@hed-hog/api-locale": "0.0.13",
|
|
15
|
-
"@hed-hog/
|
|
16
|
-
"@hed-hog/
|
|
15
|
+
"@hed-hog/api-pagination": "0.0.6",
|
|
16
|
+
"@hed-hog/core": "0.0.276"
|
|
17
17
|
},
|
|
18
18
|
"exports": {
|
|
19
19
|
".": {
|