Skip to content

daqo98/fpwithscala-users

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CRUD with Functional Programming in Scala

Sample project for FP with Scala Course

Built With 🛠️

Deployment 🚀

  1. Go to the corresponding project's path and run the following commands:
    sbt
    compile
    run
    

HTTP METHODS

POST

/users

  • Summary: Create a user.

  • Description: Validate that the user doesn't exist in the table and then insert the new user into it.

  • Parameters: None

  • Response:

    • In positive case it returns the user in JSON format.
    • "The user with legal id already exists"
  • Example:

curl -X POST -d '{"legalId":"103","firstName":"Carlos","lastName":"Mendoza","email":"[email protected]","phone":"3158453256"}' http://localhost:8000/users

PUT

/users/

  • Summary: Update USERS table
  • Description: Validate that user exists in the database and overwrite its information with the new data in the corresponding row.
  • Parameters: legalId
  • Response: - String with validation message: "The user with legalId has been modified.". - If the user wasn't found: "Couldn't find the user with legalID "
  • Example:
    curl -X PUT -d '{"legalId":"103","firstName":"Camilo", "lastName":"Zuluaga", "email":"[email protected]", "phone":"3503247638"}' http://localhost:8000/users/103
    

GET

/users

  • Summary: Retrieve all the users.
  • Description: Retrieve all the users from the USERS table.
  • Parameters: None
  • Response:
    • A list with all the users in JSON format.
    • If there is no users it returns "There is no users created".
  • Example:
    curl http://localhost:8000/users
    

/users/

  • Summary: Retrieve the specified user.

  • Description: Retrieve the specified user from the USERS table.

  • Parameters: legalId

  • Response:

    • The user in JSON format
    • In negative case: "Couldn't find the user with legal id "
  • Example:

    curl http://localhost:8000/users/103
    

DELETE

/users/

  • Summary: Delete the specified user.

  • Description: Delete the specified user from the USERS table.

  • Parameters:

  • Response:

    • "User deleted"
    • Otherwise, it returns "Couldn't find the user with legal id "
  • Example:

    curl -X DELETE http://localhost:8000/users/103
    

Authors ✒️

  • Carlos Mendoza
  • Alejandro Rico
  • Duván Agudelo
  • David Quintero

About

Sample project for FP with Scala Course

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Scala 100.0%