Skip to content

Development: Backend: Code

vissejul edited this page May 29, 2019 · 4 revisions

Content

CampusInfoAdapter

Functions that handle all communication with CampusInfo Api.

CampusInfoAdapter.exports.getScheduleResource(route, name, startDate, days) ⇒ Promise

Async Function that gets schedule for a given user starting at start date and for the given amount of days from the Campus Api.

Kind: static method of CampusInfoAdapter
Returns: Promise - On success the promise will be resolved with a JSON object.
On error the promise will be rejected with an { status: 404 }.

Param Type Description
route string
name string
startDate Date
days number (default = 7)

CampusInfoAdapter.exports.getPossibleNames(route) ⇒ Promise

Async Function that get all the possible name for a given group (route) from the Campus Api.

Kind: static method of CampusInfoAdapter
Returns: Promise - On success the promise will be resolved with a JSON object.
On error the promise will be rejected.

Param Type Description
route string (lecturers / rooms / students)

CampusInfoAdapter.exports.getFacilities() ⇒ Promise

Async Function that gets a list of all the Mensa Facilities from the Campus Api.

Kind: static method of CampusInfoAdapter
Returns: Promise - On success the promise will be resolved with a JSON object.
On error the promise will be rejected.

CampusInfoAdapter.exports.getMensaResource(facilityId, date) ⇒ Promise

Async Function that gets Mensa menus for a given facility from the Campus Api.

Kind: static method of CampusInfoAdapter
Returns: Promise - On success the promise will be resolved with a JSON object.
On error the promise will be rejected.

Param Type
facilityId number
date Date

CampusInfoAdapter.filterMenuPlansByFacilityId(menuPlans, facilityId) ⇒

Function that filters a given list of menu plans for a facilityId.

Kind: static method of CampusInfoAdapter
Returns: Menu Plan

Param Type
menuPlans *
facilityId *

VszhawAdapter

Functions that handle all communication with the vszhaw webpage

Kind: global namespace

getVszhawRSS() ⇒ Promise

Async Function that reads rss feed from vszhaw.ch

Kind: global function
Returns: Promise - On success the promise will be resolved with a list of articles.

getVszhawEvents() ⇒ Promise

Async Function that gets all vszhaw events for the current month.

Kind: global function
Returns: Promise - On success the promise will be resolved with an array.

createFreeRoomsJson

Async Function that creates new freeRooms Object using createFreeRoomsObject and then writes it to a json file.

defaultSlots

Default slots

createFreeRoomsObject() ⇒

Async Function that creates a Object that contains all free Rooms for current day.

Kind: global function
Returns: Object containing all free Rooms

logToFile

Function used to write to log file.

Param Type
file string
text string

Clone this wiki locally