# README
Project: Flock Manager API
This is a total redesign, overhaul and improvements of the previous flockmanager repo having incorporated
design improvements from the design of the database to the flow of the API.
The project has used Docker, Github Actions, testing, SQLC, db migration, Authentication middleware and authorization rules, database mocking, Gin Gonic and spf13/viper . This has improved the performance, scalability and readability of the API.
Note: This is a replica of the original project i built for kukuchic and is currently in use!
End-point: Create Users
Create New users
Method: POST
{{baseURL}}/users
Body (raw)
{
"username": "ngenoh",
"full_name": "kevin ngenoh",
"email": "[email protected]",
"password": "secret"
}
š Authentication bearer
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: Login Users
Login in users
Method: POST
{{baseURL}}/users/login
Body (raw)
{
"username": "ngenoh",
"password": "secret"
}
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: Create Breed
Create Breed
Method: POST
{{baseURL}}/breeds
Body (raw)
{
"breed": "Layers21",
"username": "ngenoh"
}
š Authentication bearer
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: Get Breed
Get breed by ID
Method: GET
{{baseURL}}/breeds/5
Body (raw)
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: List Breeds
List Breeds by page number and size
Method: GET
{{baseURL}}/breeds?page_id=1&page_size=10
Query Params
Param | value |
---|---|
page_id | 1 |
page_size | 10 |
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: Update Breed
Update Breed
Method: PUT
{{baseURL}}/breeds/8
Body (raw)
{
"breed_name": "Kuroiler-B56"
}
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: Delete Breed
Delete breed by Id
Method: DELETE
{{baseURL}}/breeds/5
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: Create Production
Create Production
Method: POST
{{baseURL}}/production
Body (raw)
{ "breed_id": 1,
"eggs": 50620,
"dirty": 1500,
"wrong_shape": 2500,
"weak_shell": 8000,
"damaged": 6000,
"hatching_eggs": 4587482
}
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: Get Production
Get production by Id
Method: GET
{{baseURL}}/production/2
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: List Production
List Production by page number and size
Method: GET
{{baseURL}}/production?page_id=1&page_size=10
Query Params
Param | value |
---|---|
page_id | 1 |
page_size | 10 |
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: Update Production
Update production
Method: PUT
{{baseURL}}/production/50
Body (raw)
{
"eggs": 50620,
"dirty": 1502640,
"wrong_shape": 2500,
"weak_shell": 650,
"damaged": 6000,
"hatching_eggs": 4587482
}
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: Delete Production
Delete Production by ID
Method: DELETE
{{baseURL}}/production/49
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: Create Hatchery
Create a New hatchery
Method: POST
{{baseURL}}/hatchery
Body (raw)
{
"production_id": 2,
"infertile": 1232,
"early": 4745,
"middle": 450,
"late": 2500,
"dead_chicks": 2540,
"alive_chicks": 5640
}
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: Get Hatchery
Get Hatchery by ID
Method: GET
{{baseURL}}/hatchery/20
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: List Hatchery
List Hatchery by page ID and Size
Method: GET
{{baseURL}}/hatchery?page_id=1&page_size=10
Query Params
Param | value |
---|---|
page_id | 1 |
page_size | 10 |
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: Update Hatchery
Update request on Hatchery
Method: PUT
{{baseURL}}/hatchery/11
Body (raw)
{
"infertile": 45400,
"early": 450,
"middle": 78400,
"late": 1200,
"dead_chicks": 4500,
"alive_chicks": 67800
}
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: Delete Hatchery
Delete Request on Hatchery
Method: DELETE
{{baseURL}}/hatchery/4
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: Create Premise
post request on premises
Method: POST
{{baseURL}}/premise
Body (raw)
{
"breed_id": 1,
"farm": "Ndura",
"house":"A67"
}
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: Get Premise
Get request on premise
Method: GET
{{baseURL}}/premise/1
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: List Premises
List Premises by page size and Id
Method: GET
{{baseURL}}/premise?page_id=1&page_size=10
Query Params
Param | value |
---|---|
page_id | 1 |
page_size | 10 |
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: Update Premise
Update request on premise
Method: PUT
{{baseURL}}/premise/7
Body (raw)
{
"farm": "kaptagat",
"house": "B23"
}
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
End-point: Delete Premise
Delete Request on premise
Method: DELETE
{{baseURL}}/hatchery/8
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā