- Clone the repository
git clone https://github.com/mmjck/backend_challenge_carbigdata.git
- Build Application image on Docker
docker-compose build -d
Application will be running http://localhost:8080/
✅
See file to example of how to use api
- It is necessary create a bucket first to upload images
- Access http://localhost:9001/# with and input this credentiais
- username: username
- password: password
Create bucket with this name
occurrences-images
The REST API app is described below.
POST /api/v1/auth/register
{
"name": "Joao das silva",
"birth_date": "2000-01-01T10:00:00",
"cpf": "00000000000",
"password": "teste123"
}
POST /api/v1/auth/#
{
"cpf": "00000000000",
"password": "teste123"
}
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJtcy1zZXJ2aWNlIiwic3ViIjoiMDI2ODMxMDkyMDIiLCJleHAiOjE3MjIyMDMxODZ9.oDNyay6YTZokNIavC5l_O0DjjElUQ14fU7pUMWoqb5s"
}
PUT /api/v1/client/{id}
{
"name": "Joao das silva",
"birth_date": "2000-01-01T10:00:00",
"cpf": "00000000000",
}
GET /api/v1/client/{id}
Example os response
{
"id": 1,
"fullName": "Maria das silva",
"cpf": "00000000000",
"birthDate": "2000-01-01T10:00:00",
"createdAt": "2024-07-28T14:46:26.450442"
}
DELETE /api/v1/client/{id}
POST /api/v1/address
{
"zip_code": "123123",
"steet": "street",
"city": "city",
"state": "State",
"district": "district"
}
PUT /api/v1/address
body:
{
"zip_code": "123123",
"steet": "street",
"city": "city",
"state": "State",
"district": "district"
}
GET /api/v1/address/{id}
Example of response:
{
"id": 2,
"state": "state",
"city": "city",
"zipCode": "zipCode",
"district": "district",
"createdAt": "2024-07-28T13:41:34.976314"
}
DELETE /api/v1/address/{id}
POST /api/v1/occurrence-images
This is multipart/form-data
request
You need includ some fields:
occurrence_id: {occurrenceId}
files: array of images
- Only can update images
POST /api/v1/occurrence-images/{id}
This is multipart/form-data
request
You need includ some fields:
occurrence_id: {occurrenceId}
files: array of images
GET /api/v1/occurrence-images/{id}
Example of response
{
"id": 4,
"occurrenceId": 4,
"hash": "<path>",
"path": "<url>",
"createdAt": "2024-07-28T15:35:19.153032"
}
DELETE /api/v1/occurrence-images/{id}
POST api/v1/occurrence
This is multipart/form-data
request
You need includ some fields:
body:
{
"zip_code": "<zipcode>",
"steet": "<steet>",
"city": "<city>",
"state": "<state>",
"district": "<district>",
"cpf": "<cpf>",
"full_name": "<full_name>"
}
files: array of images
GET /api/v1/occurrence/list
[
{
"id": "4",
"state": "<state>",
"createdAt": "2024-07-28 15:35:19.134404",
"status": "ACTIVE",
"cpf": "<cpf>",
"district": "<district>",
"city": "<city>",
"fullName": "<fullname>",
"zipCode": "<zicode>",
"clientId": 1,
"images": [
{
"hash": "<hash>",
"path": "<hash>"
},
]
}
]
GET /api/v1/occurrence/finish/{id}
-
Ordering the list of occurrences by creation date
- ASC
- DESC
-
Ordering the list of occurrences by city name
- ASC
- DESC
-
Update field occurrence_id by endpoint api/v1/occurrence-images
-
Update related fields from api/v1/occurrence