DEV Community

Carlos Estrada
Carlos Estrada

Posted on

4 1 1

Backend challenge #5

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 and inter

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
        }
    ]
}
Enter fullscreen mode Exit fullscreen mode

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
}
Enter fullscreen mode Exit fullscreen mode

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
}
Enter fullscreen mode Exit fullscreen mode

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

Billboard image

Imagine monitoring that's actually built for developers

Join Vercel, CrowdStrike, and thousands of other teams that trust Checkly to streamline monitor creation and configuration with Monitoring as Code.

Start Monitoring

Top comments (0)

Billboard image

Try REST API Generation for Snowflake

DevOps for Private APIs. Automate the building, securing, and documenting of internal/private REST APIs with built-in enterprise security on bare-metal, VMs, or containers.

  • Auto-generated live APIs mapped from Snowflake database schema
  • Interactive Swagger API documentation
  • Scripting engine to customize your API
  • Built-in role-based access control

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay