References
Class Summary
Static Public Class Summary | ||
public |
This class allows for easy building of a request to the API. |
Function Summary
Static Public Function Summary | ||
public |
async changeEmail(email: string, storedPassword: string, password: string, newEmail: string): Promise<undefined, Error> Delete all of user's sessions from database and change their email. |
|
public |
async changePassword(email: string, storedPassword: string, password: string, newPassword: string): Promise<undefined, Error> Delete all of user's sessions from database and change their password. |
|
public |
Closes the connection from mongoose to the database, using |
|
public |
comparePassword(password: string): Promise<boolean, Error> Helper method to check users password |
|
public |
Utility function to compare against a bcrypt'd password. |
|
public |
createEvent(newEvent: EventSchema): Promise<string, Error Creates a new event on the server |
|
public |
createEvent(reqData: Object, locals: Object, createCallback: EventCallback) Creates a event using fields from the request object then calls back when the database save finishes. |
|
public |
createReport(reqData: Object, locals: Object, createCallback: reportCallback) Creates a report with the fields in the request object, and calls a callback when the database save finishes. |
|
public |
createReport(newReport: Object): Promise<string, Error Creates a new report on the server |
|
public |
createUser(data: Object, next: CreateUserCallback) Given User information, create a User. |
|
public |
createUser(newUser: UserSchema): Promise<string, Error> Creates a new user on the server |
|
public |
deleteEvent(eventUid: string, locals: Object, deleteCallback: EventCallback) Deletes a specific event and calls back once database deletion finishes. |
|
public |
deleteReport(reportUid: string, locals: Object, deleteCallback: reportCallback) Deletes a specific report, and calls a callback once the database deletion finishes. |
|
public |
async deleteSessionsByEmail(email: string): Promise<Object, Error> Utility function to delete all sessions for a given user's email. |
|
public |
deleteUser(userUid: string): Promise<Error> Deletes a user from the server |
|
public |
deleteUser(userUid: string, locals: Object, deleteCallback: DeleteUserCallback) Deletes the user from the database. |
|
public |
errorHandler(err: Object, onError: OnApiCallFinished) Handles errors from API and logs them |
|
public |
getAllEvents(): Promise<Object, Error Retrieves all events from the server. |
|
public |
getAllReports(): Promise<Object, Error Retrieves all reports from the server. |
|
public |
getAllReports(reqData: Object, locals: Object, queryCallback: multipleReportsCallback) Finds all reports, and calls a callback once all reports are found. |
|
public |
Utility function to get a MongoClient collection instance from Mongoose. |
|
public |
Retrieves an event from the server by its UID |
|
public |
getEventById(eventUid: string, locals: Object, getCallback: EventCallback) Finds a specific event and calls back once find operation finishes. |
|
public |
Retrieves an report from the server by its UID |
|
public |
getReportById(reportUid: string, locals: Object, queryCallback: reportCallback) Finds a specific report, and calls a callback once the report is found. |
|
public |
Retrieves a user from the server |
|
public |
getUserById(userUid: string, locals: Object, queryCallback: GetUserCallback) Retrieves the user. |
|
public |
Given a valid email/password, generates a session and returns the id. |
|
public |
Attempt to login using email and password. |
|
public |
Delete a specific session from the database. |
|
public |
Attempt to logout. |
|
public |
modifyEvent(event: string, reqData: Object, locals: Object, modifyCallback: EventCallback) Modifies a specific event with the fields in the request object then calls back when the database update finishes. |
|
public |
modifyEvent(uid: string, updatedEvent: EventSchema): Promise<EventSchema, Error> Modifies an event on the server. |
|
public |
modifyReport(reportUid: string, reqData: Object, locals: Object, modifyCallback: reportCallback) Modifies a specific report according to the fields in the request object, and calls a callback when the database save finishes. |
|
public |
Modifies an report on the server. |
|
public |
modifyUser(userUid: string, reqData: Object, locals: Object, modifyCallback: ModifyUserCallback) Updates the user with the passed in values. |
|
public |
modifyUser(data: Object, userUid: string): Promise<UserSchema, Error> Modifies a user on the server |
|
public |
newIfPresent(newValue: T, oldValue: T): T If the new value is defined and non-null, returns the new value. |
|
public |
Opens a connection from mongoose to the database, wrapping it with
mockgoose if |
|
public |
removeEvent(uid: string): Promise<, Error>,> Removes an event on the server. |
|
public |
removeReport(uid: string): Promise<, Error>,> Removes an report on the server. |
|
public |
Middleware to determine whether the session is verified. |
Variable Summary
Static Public Variable Summary | ||
public |
The connection information for the server hosting the API. |
Typedef Summary
Static Public Typedef 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 |