Skip to content

DoofApp is an RESTful API capable of managing restaurants and consumers

Notifications You must be signed in to change notification settings

RuannJS/doof-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

Doof App is a Node.js-based RESTful API. The goal is to manage information about restaurants and their respective menus.

Techologies Used

API Documentation

Consumer

Consumer Data

  • id: string
  • firstName: string
  • lastName: string
  • email: string
  • password: string
  • address: string

Create a Consumer

Endpoint: POST /consumer

Request Body:

{
  "firstName": "string",
  "lastName": "string",
  "email": "string",
  "password": "string",
  "address": "string"
}

Response: Returns a single consumer.

Authenticate Consumer

Endpoint: POST /consumer/auth

Request Body:

{
  "email": "string",
  "password": "string"
}

Response: Returns a bearer token.

List All Consumers

Endpoint: GET /consumer

Response: Returns an array of consumers.

Update a Consumer

REQUIRES CONSUMER BEARER TOKEN

Endpoint: PUT /consumer

Request Body:

Optional

{
  "firstName": "string",
  "lastName": "string",
  "email": "string",
  "password": "string",
  "address": "string"
}

Response: Returns a single consumer.

Delete a Consumer

REQUIRES CONSUMER BEARER TOKEN

Endpoint: Delete /consumer

Response:

true if deleted

false if not deleted

Owner

Owner Data

  • id: string
  • firstName: string
  • lastName: string
  • email: string
  • password: string
  • restaurants: Restaurant[]

Create an Owner

Endpoint: POST /owner

Request Body:

{
  "firstName": "string",
  "lastName": "string",
  "email": "string",
  "password": "string"
}

Response: Returns a single owner.

Authenticate Owner

Endpoint: POST /owner/auth

Request Body:

{
  "email": "string",
  "password": "string"
}

Response: Returns a bearer token.

List All Owners

Endpoint: GET /owner

Response: Returns an array of owners.

Update an Owner

REQUIRES OWNER BEARER TOKEN

Endpoint: PUT /owner

Request Body:

Optional

{
  "firstName": "string",
  "lastName": "string",
  "email": "string",
  "password": "string"
}

Response: Returns a single owner.

Delete an Owner

REQUIRES OWNER BEARER TOKEN

Endpoint: Delete /owner

Also deletes all restaurants associated to its Owner

Response:

true if deleted

false if not deleted

Product

Product Data

  • id: string
  • name: string
  • price: number
  • category: ProductCategory
  • imageUrl: string
  • restaurantId: string
  • isDiscount: boolean
  • discountPrice?: number
  • discountStart?: Datetime
  • discountEnd?: Datetime
  • discountText?: string

Create a Product

REQUIRES OWNER BEARER TOKEN

Endpoint: POST /product

Request Body:

{
"name": "string",
"price": "number",
"category": "ProductCategory",
"imageUrl": "string",
"restaurantId": "string",
"isDiscount": "boolean",

_OPTIONAL_

"discountPrice": "number",
"discountTime": "Date",
"discountText": "string"
}

Response: Returns a single product.

Update a Product

REQUIRES OWNER BEARER TOKEN

Endpoint: PUT /product/${productId}

Request Body:

Optional

{
  "name": "string",
  "price": "number",
  "category": "ProductCategory",
  "imageUrl": "string",
  "restaurantId": "string",
  "isDiscount": "boolean",
  "discountPrice": "number",
  "discountTime": "Date",
  "discountText": "string"
}

Response: Returns a single product.

Delete a Product

REQUIRES OWNER BEARER TOKEN

Endpoint: Delete /product/${productId}

Response:

true if deleted

false if not deleted

Restaurant

Restaurant Data

  • id: string
  • name: string
  • address: string
  • imageUrl: string
  • weekOpeningTime: Date
  • weekClosingTime: Date
  • weekendOpeningTime: Date
  • weekendClosingTime: Date
  • ownerId: string

List all Restaurants

Endpoint: GET /restaurant

Response: Returns an array of restaurants.

Create a Restaurant

REQUIRES OWNER BEARER TOKEN

Endpoint: POST /restaurant

Request Body:

{
"name": "string",
"address": "string",
"imageUrl": "string",
"weekOpeningTime": "Date",
"weekClosingTime": "Date",
"weekendOpeningTime": "Date"
"weekendClosingTime": "Date"

Response: Returns a single restaurant.

Update a Restaurant

REQUIRES OWNER BEARER TOKEN

Endpoint: PUT /restaurant/${restaurantId}

Request Body:

Optional

{
"name": "string",
"address": "string",
"imageUrl": "string",
"weekOpeningTime": "Date",
"weekClosingTime": "Date",
"weekendOpeningTime": "Date"
"weekendClosingTime": "Date"
}

Response: Returns a single restaurant.

Delete a Restaurant

REQUIRES OWNER BEARER TOKEN

Endpoint: Delete /restaurant/${restaurantId}

Response:

true if deleted

false if not deleted

Order

Order Data

  • id: string
  • createdAt: Date
  • updatedAt: Date
  • state: OrderState
  • consumerId: string
  • restaurantId: string
  • products: Product[ ]

List Orders by Restaurant ID

REQUIRES OWNER BEARER TOKEN

Endpoint: GET /order/${restaurantId}

Response: Returns an array of orders made to a single restaurant.

Create Order

REQUIRES CONSUMER BEARER TOKEN

Endpoint: POST /order/${restaurantId}

Request Body:

{
"ids": "string[ ]"
}

Response: Returns a single order.

Update an Order

REQUIRES OWNER BEARER TOKEN

Endpoint: PUT /order/${orderId}

Request Body:

{
"state": "OrderState"
}

Response: Returns a single order

About

DoofApp is an RESTful API capable of managing restaurants and consumers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published