Class: trainings

trainings(logger)

Class represents training objects in core database and offers methods for handling of this training objects.

Constructor

new trainings(logger)

Parameters:
Name Type Description
logger object logger to be used for output of the class instance (usually req.app.logger)
Source:

Methods

addTraining(reqBody, callback)

Parameters:
Name Type Description
reqBody object req.body with form content
callback function success, true or false
Source:

getListOfTrainingsForCalendar(month, year, callback)

Returns trainings for month in year
Parameters:
Name Type Description
month integer
year integer
callback function rows or null
Source:

getListOfTrainingsForUI(callback)

Returns list of Trainings for ui view
Parameters:
Name Type Description
callback function rows or null
Source:

getListOfTrainingsStatus(callback)

Returns list of training states from core database
Parameters:
Name Type Description
callback function rows or null
Source:

getNextTraining(callback)

returns the next upcoming training as a row
Parameters:
Name Type Description
callback function row or null
Source:

getTraining(trainingId, callback)

Returns a training from core database
Parameters:
Name Type Description
trainingId integer
callback * row or null
Source:

getTrainingAttendeesforTrainingId(trainingId, callback)

Returns rows for training attendence from core database
Parameters:
Name Type Description
trainingId integer id of training object in core database
callback function rows or null
Source:

getTrainingHistoryforBasedataId(basedataId, callback)

returns training history for a given basedata id from core database
Parameters:
Name Type Description
basedataId integer basedata id history should be returned for from core database
callback * rows or null
Source:

removeTraining(trainingId, callback)

Deletes a training object from core database
Parameters:
Name Type Description
trainingId integer id of training in core database to be deleted
callback * success (true or false)
Source:

setTrainingAttendance(basedataIdArray, trainingscheduleId, setByBaseDataId, attendanceState, callback)

sets the attendence state of users (basedata) for a training
Parameters:
Name Type Description
basedataIdArray array basedataid which attends the training
trainingscheduleId integer id of training to be updated for
setByBaseDataId integer basedata id of the user making this change
attendanceState integer state of attendence
callback function success (true or false)
Source:

updateTraining(reqBody, trainingId, callback)

Parameters:
Name Type Description
reqBody object req.body with form fields of training edit form
trainingId integer id of trainig to be updated
callback function success, true or false
Source: