This content originally appeared on DEV Community and was authored by Carlos Estrada
Welcome to the 5 challenge of these series of backend development challenge.
This challenge will be the first part of four(5-8), so let’s begin.
Requirements to start the challenge
- PostgreSQL installed in your system (I recomend to use docker)
About the challenge
In this challenge you will have to complete the next task
- Create a database in postgresql using the next diagram
- Generate and Import data from a csv into your database
- Create the next endpoints for the next routes
- Employees
- Departments
- Employees types
Generating and importing data from a csv
Now that you have your database please generate the next data, you can use websites like mockaroo to generate the data. Or if you tech stack allows you to create seeders (like laravel) instead of generating a csv generate the according seeders for the database.
- 100 Records for employees
- 4 Records for departments
- 10 Records for vacations
- 10 Records for incapacities
- 30 Records for Employees ratings
- The employees types are the next
base
,temporary
andinter
Endpoints of the app
Here is the list of the endpoints that you need to create and the expected responses of each
- Employees
// GET api/employees
[
{
// All the data in the table employees
"employee_type": "base",
"department": "IT",
}
]
// GET api/employees/[id]
{
// all the information that you pass in the previous one plus
"ratings": [
{
// All the records in `employees_ratings` that match
// the employee_id
}
],
"incapacities": [
{
// all the information of the table incapacities
}
],
"vacations": [
{
// all the information of the vacations table
}
]
}
For the post and put, right now is just enough to only receive the data on the employees table, the image
field can be send like a simple string for example image.png
The put
and delete
methods should be called on api/employees/[id]
- Departments
// GET api/departments
[
{
// all the information on the departments table
}
]
// GET api/departments/[id]
{
// same as before
}
The put
and delete
methods should be called on api/departments/[id]
- Employees types
// GET api/employees_types
[
{
// all the information on the corresponding table
}
]
// GET api/employees_types/[id]
{
// all the information on the corresponding table
}
The put
and delete
methods should be called on api/employees_types/[id]
And this is all for this challenge, see you in the next one
This content originally appeared on DEV Community and was authored by Carlos Estrada
Carlos Estrada | Sciencx (2024-10-20T16:35:04+00:00) Backend challenge #5. Retrieved from https://www.scien.cx/2024/10/20/backend-challenge-5/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.