|
|
|
| [Home](home) | [**Escopo**](escopo) | [Processo](processo) | [Design/Mockups](design_mockups) | [Gerência](gerencia) | [Estudos](estudos) | [Arquitetura](arquitetura) | [Contratos](contratos) | [BD](banco_dados) | [Qualidade](qualidade) | [Configuração](configuracao) | [Instalação](instalacao) | [Instruções](instrucoes) | [Utilização](utilizacao) | [Analytics](Analytics) | [Infraestrutura](infraestrutura) | [Dicas](dicas) |
|
|
|
|
| :-------: | :---------------------: | :---------------: | :---------------------------: | :----------------: | :-------------: | :---------------------: | :-----------------: | :------------: | :-----------------: | :-------------------------: | :---------------------: | :---------------------: | :---------------------: | :-----------------: | :---------------------------: | :---------: |
|
|
|
|
|
|
|
|
# Categories - categorias
|
|
|
|
|
|
|
|
fields:
|
|
|
|
|
|
|
|
```js
|
|
|
|
id: number;
|
|
|
|
description: string;
|
|
|
|
active: boolean;
|
|
|
|
```
|
|
|
|
|
|
|
|
endpoints:
|
|
|
|
|
|
|
|
## FindAll
|
|
|
|
|
|
|
|
GET http://localhost:3000/categories/
|
|
|
|
|
|
|
|
response:
|
|
|
|
|
|
|
|
```json
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"id": 1,
|
|
|
|
"description": "Premium",
|
|
|
|
"active": true,
|
|
|
|
"created_at": "18/10/2024 00:09:25",
|
|
|
|
"updated_at": "18/10/2024 00:09:25"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": 2,
|
|
|
|
"description": "Importado",
|
|
|
|
"active": true,
|
|
|
|
"created_at": "18/10/2024 00:09:25",
|
|
|
|
"updated_at": "18/10/2024 00:09:25"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": 3,
|
|
|
|
"description": "Nacional",
|
|
|
|
"active": true,
|
|
|
|
"created_at": "18/10/2024 00:09:25",
|
|
|
|
"updated_at": "18/10/2024 00:09:25"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": 4,
|
|
|
|
"description": "Top Demais",
|
|
|
|
"active": true,
|
|
|
|
"created_at": "18/10/2024 00:09:25",
|
|
|
|
"updated_at": "18/10/2024 00:09:25"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": 5,
|
|
|
|
"description": "Promoção",
|
|
|
|
"active": true,
|
|
|
|
"created_at": "18/10/2024 00:09:25",
|
|
|
|
"updated_at": "18/10/2024 00:09:25"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
## FindById
|
|
|
|
|
|
|
|
GET http://localhost:3000/categories/3
|
|
|
|
|
|
|
|
response:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"id": 3,
|
|
|
|
"description": "Nacional",
|
|
|
|
"active": true,
|
|
|
|
"created_at": "18/10/2024 00:09:25",
|
|
|
|
"updated_at": "18/10/2024 00:09:25"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Create
|
|
|
|
|
|
|
|
POST http://localhost:3000/categories/
|
|
|
|
|
|
|
|
request:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"description": "Hortifruti"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
response:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"id": 6,
|
|
|
|
"description": "Hortifruti",
|
|
|
|
"active": true,
|
|
|
|
"created_at": "19/10/2024 02:59:10",
|
|
|
|
"updated_at": "19/10/2024 02:59:10"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Update
|
|
|
|
|
|
|
|
PATCH http://localhost:3000/categories/6
|
|
|
|
|
|
|
|
request:
|
|
|
|
![1729317652559](resources/images/backend/Contratosbackefront/1729317652559.png)
|
|
|
|
|
|
|
|
response:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"id": 6,
|
|
|
|
"description": "ALTEREI A DESCRIÇÃO",
|
|
|
|
"active": true,
|
|
|
|
"created_at": "19/10/2024 02:59:10",
|
|
|
|
"updated_at": "19/10/2024 03:00:12"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Delete (inactivate)
|
|
|
|
|
|
|
|
DELETE http://localhost:3000/categories/6
|
|
|
|
|
|
|
|
response:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"message": "Category with ID 6 deleted successfully"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Reactivate
|
|
|
|
|
|
|
|
POST http://localhost:3000/categories/activate/6
|
|
|
|
|
|
|
|
response:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"message": "Category ID 6 activated successfully"
|
|
|
|
}
|
|
|
|
``` |