Members
Methods
# static buildPermissions(user) → {Object}
Flatten the permission array to keep only names
Parameters:
| Name | Type | Description |
|---|---|---|
user |
Model
|
Object
# async static generateJWT(user) → {Promise.<string>}
Generate a JWT token
Parameters:
| Name | Type | Description |
|---|---|---|
user |
User
|
Promise.<string>
# async inner add(newUser) → {Promise.<APIResp>}
Add a new user
Parameters:
| Name | Type | Description |
|---|---|---|
newUser |
NewUser
|
APIError
Promise.<APIResp>
# async inner addSCTFromETL(newSct, modules, campusID) → {Promise.<APIResp>}
Add a new student
Parameters:
| Name | Type | Description |
|---|---|---|
newSct |
newSCTFromETL
|
|
modules |
Array.<number>
|
|
campusID |
number
|
Promise.<APIResp>
# async inner addStaffFromETL(newStaff, positionID) → {Promise.<APIResp>}
Add a new staff members
Parameters:
| Name | Type | Description |
|---|---|---|
newStaff |
newStaffFromETL
|
|
positionID |
number
|
Promise.<APIResp>
# async inner addStudentFromETL(newStudent) → {Promise.<APIResp>}
Add a new student
Parameters:
| Name | Type | Description |
|---|---|---|
newStudent |
NewStudentFromETL
|
Promise.<APIResp>
# inner arePasswordsSame(password1, password2) → {boolean}
Checks if the password is identical to the password confirmation
Parameters:
| Name | Type | Description |
|---|---|---|
password1 |
string
|
Password |
password2 |
string
|
Password confirmation |
boolean
# async inner getAllSCTs(currUser, filters) → {Promise.<APIResp>}
Get all SCTs
Parameters:
| Name | Type | Description |
|---|---|---|
currUser |
module:LoggedUser
|
|
filters |
SCTsFilters
|
Promise.<APIResp>
# async inner getAllStudents(currUser, filters) → {Promise.<APIResp>}
Get all student
Parameters:
| Name | Type | Description |
|---|---|---|
currUser |
module:LoggedUser
|
|
filters |
StudentFilters
|
Promise.<APIResp>
# async inner getByID(currUser, userID, filters) → {Promise.<APIResp>}
Get one user by its id
Parameters:
| Name | Type | Description |
|---|---|---|
currUser |
module:LoggedUser
|
|
userID |
number
|
|
filters |
object
|
APIError
Promise.<APIResp>
# async inner getByUUID(currUser, uuid, filters) → {Promise.<APIResp>}
Get one user by its uuid
Parameters:
| Name | Type | Description |
|---|---|---|
currUser |
module:LoggedUser
|
|
uuid |
string
|
|
filters |
StudentFilters
|
APIError
Promise.<APIResp>
# async inner getStudentByUUID(currUser, uuid, filters) → {Promise.<APIResp>}
Get a student by its UUID
Parameters:
| Name | Type | Description |
|---|---|---|
currUser |
module:LoggedUser
|
|
uuid |
string
|
|
filters |
StudentFilters
|
Promise.<APIResp>
# async inner getStudentsAtResit(currUser, filters) → {Promise.<APIResp>}
Get all students at resit
Parameters:
| Name | Type | Description |
|---|---|---|
currUser |
module:LoggedUser
|
|
filters |
StudentFilters
|
Promise.<APIResp>
# async inner hashPassword(password) → {Promise.<string>}
Hash a password
Parameters:
| Name | Type | Description |
|---|---|---|
password |
string
|
Error
Promise.<string>
# inner isPasswordSafe(password) → {boolean}
Checks if the password is safe
Parameters:
| Name | Type | Description |
|---|---|---|
password |
string
|
boolean
# async inner login(user) → {Promise.<APIResp>}
Login a user
Parameters:
| Name | Type | Description |
|---|---|---|
user |
LoggingUser
|
APIError
Promise.<APIResp>
# async inner passwordMatchHash(password, hash) → {Promise.<boolean>}
Compares a plaintext password to a hash
Parameters:
| Name | Type | Description |
|---|---|---|
password |
string
|
Plaintext password |
hash |
string
|
Hashed password |
Error
Promise.<boolean>
# async inner processSCTFilters(currUser, filters, disabledExpandsopt) → {SeqSCTsFilters}
Transform URI query params to sequelize where and include clauses.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
currUser |
module:LoggedUser
|
||
filters |
SCTsFilters
|
||
disabledExpands |
Array.<string>
|
<optional> |
List of expand to not include in the clauses |
SeqSCTsFilters
# async inner processStudentFilters(currUser, filters, disabledExpandsopt) → {SeqStudentFilters}
Transform URI query params to sequelize where and include clauses.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
currUser |
module:LoggedUser
|
||
filters |
StudentFilters
|
||
disabledExpands |
Array.<string>
|
<optional> |
List of expand to not include in the clauses |
SeqStudentFilters
# async inner processUserFilters(currUser, filters, uuid, disabledExpandsopt) → {SeqUserFilters}
Transform URI query params to sequelize where and include clauses.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
currUser |
module:LoggedUser
|
||
filters |
UserFilters
|
||
uuid |
string
|
||
disabledExpands |
Array.<string>
|
<optional> |
List of expand to not include in the clauses |
SeqUserFilters
Type Definitions
Object
# newSCTFromETL
Properties:
| Name | Type | Description |
|---|---|---|
first_name |
string
|
|
last_name |
string
|
|
email |
string
|
|
birth_date |
Date
|
string
|
|
modules |
string
|
|
Section |
string
|
|
gender |
string
|
|
region |
string
|
Object
# newStaffFromETL
Properties:
| Name | Type | Description |
|---|---|---|
first_name |
string
|
|
last_name |
string
|
|
email |
string
|
|
birth_date |
Date
|
string
|
|
gender |
string
|
|
region |
string
|
Object
# NewStudentFromETL
Properties:
| Name | Type | Description |
|---|---|---|
first_name |
string
|
|
last_name |
string
|
|
birth_date |
Date
|
string
|
|
email |
string
|
|
gender |
string
|
|
region |
string
|
|
campus_id |
string
|
number
|
Object
# NewUser
Properties:
| Name | Type | Description |
|---|---|---|
first_name |
string
|
|
last_name |
string
|
|
birth_date |
Date
|
string
|
|
email |
string
|
|
password1 |
string
|
|
password2 |
string
|
|
address |
UserAddress
|
|
gender |
string
|
|
region |
string
|
|
campus |
string
|
Object
# SCTsFilters
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
campus |
string
|
<optional> |
|
expand |
array.<("campus"|"module")>
|
<optional> |
Object
# SeqSCTsFilters
Properties:
| Name | Type | Description |
|---|---|---|
where |
Object
|
Where clause |
include |
Array.<{model: Object, where: Object, required: boolean}>
|
Include clause |
Object
# SeqStudentFilters
Properties:
| Name | Type | Description |
|---|---|---|
where |
Object
|
Where clause |
include |
Array.<{model: Object, where: Object, required: boolean}>
|
Include clause |
Object
# SeqUserFilters
Properties:
| Name | Type | Description |
|---|---|---|
where |
Object
|
Where clause |
include |
Array.<{model: Object, where: Object, required: boolean}>
|
Include clause |
Object
# StudentFilters
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
campus |
string
|
<optional> |
|
onlyOld |
"true"
|
"false"
|
string
|
<optional> |
|
expand |
array.<("campus"|"module"|"ects"|"job"|"compta")>
|
<optional> |
Object
# User
Properties:
| Name | Type | Description |
|---|---|---|
user_id |
number
|
|
uuid |
string
|
|
first_name |
string
|
|
last_name |
string
|
|
birth_date |
Date
|
string
|
|
email |
string
|
|
password |
string
|
|
address |
UserAddress
|
|
gender |
string
|
|
region |
string
|
|
campus |
string
|
|
study |
Study
|
Object
# UserFilters
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
campus |
string
|
<optional> |
|
expand |
array.<("permission"|"campus"|"study"|"module"|"ects"|"job"|"compta")>
|
<optional> |