Home Reference Source Repository

Typedef

Static Public Summary
public

Logging tool for API

public

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

Callback for modifyUser

public

Promise callback for when API call finishes

public

Route for creating a new event

  • Endpoint: /api/events
  • Verb: POST
public

Route for creating a new event

  • Endpoint: /api/events
  • Verb: POST
public

Route for creating a new report

  • Endpoint: /api/reports
  • Verb: POST
public

Route for creating a new report

  • Endpoint: /api/reports
  • Verb: POST
public

Route for creating a new user

API

  • Endpoint: /api/users
  • Verb: POST
  • Success Code: 201
public

Route for creating a new user

API

  • Endpoint: /api/users
  • Verb: POST
  • Success Code: 201
public

Route for deleting an existing event

API

  • Endpoint: /api/events
  • Verb: DELETE
public

Route for deleting an existing event

  • Endpoint: /api/reports
  • Verb: DELETE
public

Route for deleting an existing user

API

  • Endpoint: /api/users
  • Verb: DELETE
  • Success Code: 200
public

Route for retrieving all events

API

  • Endpoint: /api/events/all
  • Verb: GET
public

Route for retrieving a single, existing event by its UID

  • Endpoint: /api/events
  • Verb: GET
public

Route for retrieving a single, existing event by its UID

  • Endpoint: /api/reports
  • Verb: GET
public

Route for getting an existing user

API

  • Endpoint: /api/users
  • Verb: GET
  • Success Code: 200
public

Route for modifying an existing event

  • Endpoint: /api/events
  • Verb: PUT
public

Route for modifying an existing report

  • Endpoint: /api/reports
  • Verb: POST
public

Route for modiying an existing user

API

  • Endpoint: /api/users
  • Verb: PUT
  • Success Code: 200
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 CreateUserCallback(err: Object, id: string): Object source

Callback for createUser

public DeleteUserCallback(-: Object): Object source

Callback for deleteUser

public EventSchema(creator: string, category: string, datetime: Date, location: string, title: string, description: string): Object source

Event Object

public GetUserCallback(-: Object, -: UserSchemas): Object source

Callback for getUserById

public ModifyUserCallback(-: Object, -: UserSchema): Object source

Callback for modifyUser

public OnApiCallFinished(-: Object, -: number): function source

Promise callback for when API call finishes

Params:

NameTypeAttributeDescription
- Object

Response from API

- number

Response status code

public Route-CreateEvent(req: Object, res: Object): function source

Route for creating a new event

  • Endpoint: /api/events
  • Verb: POST

Params:

NameTypeAttributeDescription
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:

NameTypeAttributeDescription
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

Params:

NameTypeAttributeDescription
req Object

Express request object

req.body Object

The report to be created

res Object

Express result object

res.body string

UID of created report 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

Params:

NameTypeAttributeDescription
req Object

Express request object

req.body Object

The report to be created

res Object

Express result object

res.body string

UID of created report or error message

res.status number

201 on success

public Route-CreateUser(req: Object, res: Object): function source

Route for creating a new user

API

  • Endpoint: /api/users
  • Verb: POST
  • Success Code: 201

Params:

NameTypeAttributeDescription
req Object

Express request object

res Object

Express result object

public Route-CreateUser(req: Object, res: Object): function source

Route for creating a new user

API

  • Endpoint: /api/users
  • Verb: POST
  • Success Code: 201

Params:

NameTypeAttributeDescription
req Object

Express request object

res Object

Express result object

public Route-DeleteEvent(req: Object, res: Object): function source

Route for deleting an existing event

API

  • Endpoint: /api/events
  • Verb: DELETE

Params:

NameTypeAttributeDescription
req Object

Express request object

req.query.uid string

UID of event to be deleted

req.query.token string

Admin or creator of event

res Object

Express result object

res.status number

200 on success

public Route-DeleteReport(req: Object, res: Object): function source

Route for deleting an existing event

  • Endpoint: /api/reports
  • Verb: DELETE

Params:

NameTypeAttributeDescription
req Object

Express request object

res Object

Express result object

public Route-DeleteUser(req: Object, res: Object): function source

Route for deleting an existing user

API

  • Endpoint: /api/users
  • Verb: DELETE
  • Success Code: 200

Params:

NameTypeAttributeDescription
req Object

Express request object

res Object

Express result object

public Route-GetAllEvents(req: Object, res: Object): function source

Route for retrieving all events

API

  • Endpoint: /api/events/all
  • Verb: GET

Params:

NameTypeAttributeDescription
req Object

Express request object

res Object

Express result object

public Route-GetEventById(req: Object, res: Object): function source

Route for retrieving a single, existing event by its UID

  • Endpoint: /api/events
  • Verb: GET

Params:

NameTypeAttributeDescription
req Object

Express request object

req.query.uid string

UID of event to be retrieved

req.query.token string

Admin or creator of event

res Object

Express result object

res.status number

200 on success

public Route-GetReportById(req: Object, res: Object): function source

Route for retrieving a single, existing event by its UID

  • Endpoint: /api/reports
  • Verb: GET

Params:

NameTypeAttributeDescription
req Object

Express request object

req.query.uid string

UID of report to be retrieved

req.query.token string

Admin or creator of report

res Object

Express result object

res.status number

200 on success

public Route-GetUser(req: Object, res: Object): function source

Route for getting an existing user

API

  • Endpoint: /api/users
  • Verb: GET
  • Success Code: 200

Params:

NameTypeAttributeDescription
req Object

Express request object

res Object

Express result object

public Route-ModifyEvent(req: Object, res: Object): function source

Route for modifying an existing event

  • Endpoint: /api/events
  • Verb: PUT

Params:

NameTypeAttributeDescription
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:

NameTypeAttributeDescription
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

public Route-ModifyUser(req: Object, res: Object): function source

Route for modiying an existing user

API

  • Endpoint: /api/users
  • Verb: PUT
  • Success Code: 200

Params:

NameTypeAttributeDescription
req Object

Express request object

res Object

Express result object

public UserSchema(name: string, firstName: string, lastName: string, email: string, password: string, role: string, isApproved: boolean): Object source

User Object