Typedef
Static Public Summary | ||
public |
Logging tool for API |
|
public |
CreateUserCallback(err: Object, id: string): Object Callback for createUser |
|
public |
Callback for deleteUser |
|
public |
EventSchema(creator: string, category: string, datetime: Date, location: string, title: string, description: string): Object Event Object |
|
public |
GetUserCallback(-: Object, -: UserSchemas): Object Callback for getUserById |
|
public |
ModifyUserCallback(-: Object, -: UserSchema): Object Callback for modifyUser |
|
public |
OnApiCallFinished(-: Object, -: number): function Promise callback for when API call finishes |
|
public |
Route-CreateEvent(req: Object, res: Object): function Route for creating a new event
|
|
public |
Route-CreateEvent(req: Object, res: Object): function Route for creating a new event
|
|
public |
Route-CreateReport(req: Object, res: Object): function Route for creating a new report
|
|
public |
Route-CreateReport(req: Object, res: Object): function Route for creating a new report
|
|
public |
Route-CreateUser(req: Object, res: Object): function Route for creating a new user API
|
|
public |
Route-CreateUser(req: Object, res: Object): function Route for creating a new user API
|
|
public |
Route-DeleteEvent(req: Object, res: Object): function Route for deleting an existing event API
|
|
public |
Route-DeleteReport(req: Object, res: Object): function Route for deleting an existing event
|
|
public |
Route-DeleteUser(req: Object, res: Object): function Route for deleting an existing user API
|
|
public |
Route-GetAllEvents(req: Object, res: Object): function Route for retrieving all events API
|
|
public |
Route-GetEventById(req: Object, res: Object): function Route for retrieving a single, existing event by its UID
|
|
public |
Route-GetReportById(req: Object, res: Object): function Route for retrieving a single, existing event by its UID
|
|
public |
Route-GetUser(req: Object, res: Object): function Route for getting an existing user API
|
|
public |
Route-ModifyEvent(req: Object, res: Object): function Route for modifying an existing event
|
|
public |
Route-ModifyReport(req: Object, res: Object): function Route for modifying an existing report
|
|
public |
Route-ModifyUser(req: Object, res: Object): function Route for modiying an existing user API
|
|
public |
UserSchema(name: string, firstName: string, lastName: string, email: string, password: string, role: string, isApproved: boolean): Object User Object |
Static Public
public -: function source
Logging tool for API
Example:
const logger = require('api/core/logger');
logger.trace('Message');
logger.debug('Message');
logger.info('Message');
logger.warn('Message');
logger.crit('Message');
logger.fatal('Message');
public EventSchema(creator: string, category: string, datetime: Date, location: string, title: string, description: string): Object source
Event Object
public OnApiCallFinished(-: Object, -: number): function source
Promise callback for when API call finishes
public Route-CreateEvent(req: Object, res: Object): function source
Route for creating a new event
- Endpoint:
/api/events
- Verb: POST
Params:
Name | Type | Attribute | Description |
req | Object | Express request object |
|
req.body | EventSchema | The event to be created |
|
res | Object | Express result object |
|
res.body | string | UID of created event or error message |
|
res.status | number | 201 on success |
public Route-CreateEvent(req: Object, res: Object): function source
Route for creating a new event
- Endpoint:
/api/events
- Verb: POST
Params:
Name | Type | Attribute | Description |
req | Object | Express request object |
|
req.body | EventSchema | The event to be created |
|
res | Object | Express result object |
|
res.body | string | UID of created event or error message |
|
res.status | number | 201 on success |
public Route-CreateReport(req: Object, res: Object): function source
Route for creating a new report
- Endpoint:
/api/reports
- Verb: POST
public Route-CreateReport(req: Object, res: Object): function source
Route for creating a new report
- Endpoint:
/api/reports
- Verb: POST
public Route-CreateUser(req: Object, res: Object): function source
Route for creating a new user
API
- Endpoint:
/api/users
- Verb: POST
- Success Code: 201
public Route-CreateUser(req: Object, res: Object): function source
Route for creating a new user
API
- Endpoint:
/api/users
- Verb: POST
- Success Code: 201
public Route-DeleteEvent(req: Object, res: Object): function source
Route for deleting an existing event
API
- Endpoint:
/api/events
- Verb: DELETE
public Route-DeleteReport(req: Object, res: Object): function source
Route for deleting an existing event
- Endpoint:
/api/reports
- Verb: DELETE
public Route-DeleteUser(req: Object, res: Object): function source
Route for deleting an existing user
API
- Endpoint:
/api/users
- Verb: DELETE
- Success Code: 200
public Route-GetAllEvents(req: Object, res: Object): function source
Route for retrieving all events
API
- Endpoint:
/api/events/all
- Verb: GET
public Route-GetEventById(req: Object, res: Object): function source
Route for retrieving a single, existing event by its UID
- Endpoint:
/api/events
- Verb: GET
public Route-GetReportById(req: Object, res: Object): function source
Route for retrieving a single, existing event by its UID
- Endpoint:
/api/reports
- Verb: GET
public Route-GetUser(req: Object, res: Object): function source
Route for getting an existing user
API
- Endpoint:
/api/users
- Verb: GET
- Success Code: 200
public Route-ModifyEvent(req: Object, res: Object): function source
Route for modifying an existing event
- Endpoint:
/api/events
- Verb: PUT
Params:
Name | Type | Attribute | Description |
req | Object | Express request object |
|
req.query.uid | string | UID of event to be updated |
|
req.query.token | string | Admin or creator of event |
|
req.body | EventSchema | Updated fields of the event |
|
res | Object | Express result object |
|
res.body | EventSchema | string | Modified event | error message |
|
res.status | number | 200 on success |
public Route-ModifyReport(req: Object, res: Object): function source
Route for modifying an existing report
- Endpoint:
/api/reports
- Verb: POST
Params:
Name | Type | Attribute | Description |
req | Object | Express request object |
|
req.query.uid | string | UID of report to be updated |
|
req.query.token | string | Admin or creator of report |
|
req.body | Object | Updated fields of the report |
|
res | Object | Express result object |
|
res.body | EventSchema | string | Modified report | error message |
|
res.status | number | 200 on success |