|
|
| [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) |
|
|
|
| :-------: | :---------------------: | :---------------: | :---------------------------: | :----------------: | :-------------: | :---------------------: | :-----------------: | :------------: | :-----------------: | :-------------------------: | :---------------------: | :---------------------: | :---------------------: | :-----------------: | :---------------------------: | :---------: |
|
|
|
|
|
|
# Persons - pessoas (fornecedor, cliente)
|
|
|
|
|
|
fields:
|
|
|
|
|
|
```js
|
|
|
id: number;
|
|
|
name: string;
|
|
|
type: Person_Type;
|
|
|
active: boolean;
|
|
|
```
|
|
|
|
|
|
endpoints:
|
|
|
|
|
|
## FindAll
|
|
|
|
|
|
GET http://localhost:3000/persons/
|
|
|
response:
|
|
|
|
|
|
```json
|
|
|
[
|
|
|
{
|
|
|
"id": 1,
|
|
|
"name": "Pedro Cabral",
|
|
|
"active": true,
|
|
|
"created_at": "18/10/2024 00:09:25",
|
|
|
"updated_at": "18/10/2024 00:09:25"
|
|
|
},
|
|
|
{
|
|
|
"id": 2,
|
|
|
"name": "Machado Assis",
|
|
|
"active": true,
|
|
|
"created_at": "18/10/2024 00:09:25",
|
|
|
"updated_at": "18/10/2024 00:09:25"
|
|
|
},
|
|
|
{
|
|
|
"id": 3,
|
|
|
"name": "Clarice Lispector",
|
|
|
"active": true,
|
|
|
"created_at": "18/10/2024 00:09:25",
|
|
|
"updated_at": "18/10/2024 00:09:25"
|
|
|
},
|
|
|
{
|
|
|
"id": 4,
|
|
|
"name": "Sebastião Costa",
|
|
|
"active": true,
|
|
|
"created_at": "18/10/2024 00:09:25",
|
|
|
"updated_at": "18/10/2024 00:09:25"
|
|
|
},
|
|
|
{
|
|
|
"id": 5,
|
|
|
"name": "Produtor Rural",
|
|
|
"active": true,
|
|
|
"created_at": "18/10/2024 00:09:25",
|
|
|
"updated_at": "18/10/2024 00:09:25"
|
|
|
},
|
|
|
{
|
|
|
"id": 6,
|
|
|
"name": "Ecologia na Veia",
|
|
|
"active": true,
|
|
|
"created_at": "18/10/2024 00:09:25",
|
|
|
"updated_at": "18/10/2024 00:09:25"
|
|
|
}
|
|
|
]
|
|
|
```
|
|
|
|
|
|
## FindById
|
|
|
|
|
|
GET http://localhost:3000/persons/2
|
|
|
response:
|
|
|
|
|
|
```json
|
|
|
{
|
|
|
"id": 2,
|
|
|
"name": "Machado Assis",
|
|
|
"active": true,
|
|
|
"created_at": "18/10/2024 00:09:25",
|
|
|
"updated_at": "18/10/2024 00:09:25"
|
|
|
}
|
|
|
```
|
|
|
|
|
|
## Create
|
|
|
|
|
|
POST http://localhost:3000/persons/
|
|
|
request:
|
|
|
|
|
|
```json
|
|
|
{
|
|
|
"name": "Fruteira do Ifood"
|
|
|
}
|
|
|
```
|
|
|
|
|
|
response:
|
|
|
|
|
|
```json
|
|
|
{
|
|
|
"id": 7,
|
|
|
"name": "Fruteira do Ifood",
|
|
|
"active": true,
|
|
|
"created_at": "19/10/2024 04:03:03",
|
|
|
"updated_at": "19/10/2024 04:03:03"
|
|
|
}
|
|
|
```
|
|
|
|
|
|
## Update
|
|
|
|
|
|
PATCH http://localhost:3000/persons/7
|
|
|
request:
|
|
|
![1729321540482](resources/images/backend/Contratosbackefront/1729321540482.png)
|
|
|
response:
|
|
|
|
|
|
```json
|
|
|
{
|
|
|
"id": 7,
|
|
|
"name": "Restaurante Nova Brécia",
|
|
|
"active": true,
|
|
|
"created_at": "19/10/2024 04:03:03",
|
|
|
"updated_at": "19/10/2024 04:05:18"
|
|
|
}
|
|
|
```
|
|
|
|
|
|
## Delete
|
|
|
|
|
|
DELETE http://localhost:3000/persons/7
|
|
|
response:
|
|
|
|
|
|
```json
|
|
|
{
|
|
|
"message": "Person with ID 7 deleted successfully"
|
|
|
}
|
|
|
```
|
|
|
|
|
|
## Reactivate
|
|
|
|
|
|
POST http://localhost:3000/persons/activate/7
|
|
|
response:
|
|
|
|
|
|
```json
|
|
|
{
|
|
|
"message": "Person ID 7 activated successfully"
|
|
|
}
|
|
|
``` |