GithubHelp home page GithubHelp logo

expresso's People

Contributors

mkudamatsu avatar

Watchers

 avatar

expresso's Issues

Set up /api/menus/:menuId/menu-items/:menuItemId

PUT

Updates the menu item with the specified menu item ID using the information from the menuItem property of the request body and saves it to the database. Returns a 200 response with the updated menu item on the menuItem property of the response body

If any required fields are missing, returns a 400 response

If a menu with the supplied menu ID doesn’t exist, returns a 404 response

If a menu item with the supplied menu item ID doesn’t exist, returns a 404 response

DELETE

Deletes the menu item with the supplied menu item ID from the database. Returns a 204 response.

If a menu with the supplied menu ID doesn’t exist, returns a 404 response

If a menu item with the supplied menu item ID doesn’t exist, returns a 404 response

Set up /api/employees/:employeeId/timesheets/:timesheetId

PUT

Updates the timesheet with the specified timesheet ID using the information from the timesheet property of the request body and saves it to the database. Returns a 200 response with the updated timesheet on the timesheet property of the response body

If any required fields are missing, returns a 400 response

If an employee with the supplied employee ID doesn’t exist, returns a 404 response

If an timesheet with the supplied timesheet ID doesn’t exist, returns a 404 response

DELETE

Deletes the timesheet with the supplied timesheet ID from the database. Returns a 204 response.

If an employee with the supplied employee ID doesn’t exist, returns a 404 response

If an timesheet with the supplied timesheet ID doesn’t exist, returns a 404 response

Set up /api/menus/:menuId/menu-items

GET

Returns a 200 response containing all saved menu items related to the menu with the supplied menu ID on the menuItems property of the response body

If a menu with the supplied menu ID doesn’t exist, returns a 404 response

POST

Creates a new menu item, related to the menu with the supplied menu ID, with the information from the menuItem property of the request body and saves it to the database. Returns a 201 response with the newly-created menu item on the menuItem property of the response body

If any required fields are missing, returns a 400 response

If a menu with the supplied menu ID doesn’t exist, returns a 404 response

Set up /api/employees/:employeeId

GET

Returns a 200 response containing the employee with the supplied employee ID on the employee property of the response body

If an employee with the supplied employee ID doesn’t exist, returns a 404 response

PUT
Updates the employee with the specified employee ID using the information from the employee property of the request body and saves it to the database. Returns a 200 response with the updated employee on the employee property of the response body

If any required fields are missing, returns a 400 response

If an employee with the supplied employee ID doesn’t exist, returns a 404 response

DELETE

Updates the employee with the specified employee ID to be unemployed (is_current_employee equal to 0). Returns a 200 response.

If an employee with the supplied employee ID doesn’t exist, returns a 404 response

Set up /api/employees

GET
Returns a 200 response containing all saved currently-employed employees (is_current_employee is equal to 1) on the employees property of the response body

POST

Creates a new employee with the information from the employee property of the request body and saves it to the database. Returns a 201 response with the newly-created employee on the employee property of the response body

If any required fields are missing, returns a 400 response

Set up server.js

Create and export your Express app from a root-level file called server.js

Accept and set an optional port argument for your server to listen on from process.env.PORT

If process.env.PORT is not set, server should run on port 4000 (this is where the provided front-end will make requests to)

Accept and set an optional database file argument from process.env.TEST_DATABASE in all Express route files that open and modify your database

Use the root-level database.sqlite as your API’s database

Note: When loading database.sqlite in your JavaScript files, sqlite3 will always try to load database.sqlite from the root directory path, ./database.sqlite, regardless of where the current file is located. Therefore your code will always be new sqlite3.Database(process.env.TEST_DATABASE || './database.sqlite') regardless of the file you are writing in

Set up /api/employees/:employeeId/timesheets

GET

Returns a 200 response containing all saved timesheets related to the employee with the supplied employee ID on the timesheets property of the response body

If an employee with the supplied employee ID doesn’t exist, returns a 404 response

POST

Creates a new timesheet, related to the employee with the supplied employee ID, with the information from the timesheet property of the request body and saves it to the database. Returns a 201 response with the newly-created timesheet on the timesheet property of the response body

If an employee with the supplied employee ID doesn’t exist, returns a 404 response

Set up databases in migration.js

Employee

id - Integer, primary key, required
name - Text, required
position - Text, required
wage - Integer, required
is_current_employee - Integer, defaults to 1

Timesheet

id - Integer, primary key, required
hours - Integer, required
rate - Integer, required
date - Integer, required
employee_id - Integer, foreign key, required

Menu

id - Integer, primary key, required
title - Text, required

MenuItem

id - Integer, primary key, required
name - Text, required
description - Text, optional
inventory - Integer, required
price - Integer, required
menu_id - Integer, foreign key, required

Set up /api/menus/:menuId

GET

Returns a 200 response containing the menu with the supplied menu ID on the menu property of the response body

If a menu with the supplied menu ID doesn’t exist, returns a 404 response

PUT

Updates the menu with the specified menu ID using the information from the menu property of the request body and saves it to the database. Returns a 200 response with the updated menu on the menu property of the response body

If any required fields are missing, returns a 400 response

If a menu with the supplied menu ID doesn’t exist, returns a 404 response

DELETE

Deletes the menu with the supplied menu ID from the database if that menu has no related menu items. Returns a 204 response.

If the menu with the supplied menu ID has related menu items, returns a 400 response.

If a menu with the supplied menu ID doesn’t exist, returns a 404 response

Set up /api/menus

GET

Returns a 200 response containing all saved menus on the menus property of the response body

POST

Creates a new menu with the information from the menu property of the request body and saves it to the database. Returns a 201 response with the newly-created menu on the menu property of the response body

If any required fields are missing, returns a 400 response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.