Closed bglossner closed 2 years ago
@bglossner What format will the dates initially be in before they need to be converted from number?
From the server, the dates will come in as a number ((new Date).getTime()
sorta thing). You can use getTime()
on a date object to convert from date to number and can pass the number into Date (new Date(number)
) to get a date object from a number.
Assume a
isUserAdmin
middleware function works.This endpoint (
/api/new-shift
for now?) should take information as a POST request about a Shift and create that shift. Here is an example: https://github.com/hack4impact-calpoly/happy-hats/blob/173baba2ae7f17eb92ad839cf7fef506d7d6b378/backend/calendar/calendar-api.js#L108For this endpoint, make sure to do error detection and send appropriate responses back. For when this needs to interact with the database, add to the
Database
abstract class and any instances of it a new function that would be called that you can use in the endpoint code.Also need to create a shift schema:
Start datetime
End datetime
Max volunteers
title
description
event admin (probably just the creator)
getShiftTime() function that returns total time of shift (time interval type)
[x] Shift interface
[x] New shift endpoint