Namespace: serverStub

serverStub

Server stub for lab 2 of TDDD83 - Kandidatprojekt datateknik.
Since:
  • 2020-01-12
Author:
  • Niklas Granander (nikgr117@student.liu.se)
Source:

Methods

addCar(make, model, customer_idopt) → {Car}

Stub for POST /cars
Adds a car to memory and returns it
Parameters:
Name Type Attributes Default Description
make string The manufacturer/brand of the car
model string Model name of the car
customer_id number <optional>
null Id of a Customer
Source:
Returns:
Type
Car

addCustomer(name, email) → {Customer}

Stub for POST /customers
Adds a customer to memory and returns it
Parameters:
Name Type Description
name string The name of the customer
email string The email address of the customer
Source:
Returns:
Type
Customer

deleteCar(id) → {boolean}

Stub for DELETE /car/
Deletes a car from memory with the given id or returns false if not found
Parameters:
Name Type Description
id number id of car to delete
Source:
Returns:
Type
boolean

deleteCustomer(id) → {boolean}

Stub for DELETE /customers/
Deletes a customer from memory with the given id. Destroys relationships between the given customer and cars.
Parameters:
Name Type Description
id number id of customer to delete
Source:
Returns:
Type
boolean

getCar(id) → {Car|boolean}

Stub for GET /car/
Returns a Car with the given id or false if not found
Parameters:
Name Type Description
id number id of car to return
Source:
Returns:
Type
Car | boolean

getCars() → {Array.<Car>}

Stub for GET /cars
Gets all cars (or empty list)
Source:
Returns:
Type
Array.<Car>

getCustomer(id) → {Customer|boolean}

Stub for GET /customers/
Returns a customer with the given id or false if not found
Parameters:
Name Type Description
id number id of customer to return
Source:
Returns:
Type
Customer | boolean

getCustomers() → {Array.<Customer>}

Stub for GET /customers
Gets all customers from memory (or empty list)
Source:
Returns:
Type
Array.<Customer>

updateCar(id, make, model, customer_idopt) → {Car|boolean}

Stub for PUT /cars/
Updates a car with the given id and returns it. Returns false if not found.
Parameters:
Name Type Attributes Default Description
id number id of car to update
make string The manufacturer/brand of the car
model string Model name of the car
customer_id number <optional>
null Id of a Customer
Source:
Returns:
Type
Car | boolean

updateCustomer(id, name, email) → {Customer|boolean}

Stub for PUT /customers/
Updates a customer with the given id and returns it. Returns false if not found.
Parameters:
Name Type Description
id number id of customer to update
name string The name of the customer
email string The email address of the customer
Source:
Returns:
Type
Customer | boolean