Class

module:Expand

module:Expand(user, authorizedExpands) → {Expand}

Expand is used to process the parameter named "expand" passed in the route. These expand have the following format: tableName[~][<FILTER>].

[~]: If a tilde is added to the table name, the join is optional.

[<FILTER>]: An additional filter for this join.

Constructor

# new module:Expand(user, authorizedExpands) → {Expand}

Parameters:
Name Type Default Description
user module:LoggedUser null
authorizedExpands Array.<string> null

View Source global/Expand.js, line 45

Expand
Example
const expander = new Expand();
expander.setAuthorized(["books", "editors", "awards"]).process(["books", "editors<current>", "awards~"], expand => {
 const isRequired = expand.required ? "required" : "not required";
 const hasExtra = expand.how ? ` and have an extra filter (${expand.how})` : "";

	console.log(`The join ${expand.name} is ${isRequired}{hasExtra}.`);
	// -> The join books is required.
	// -> The join editors is required and have an extra filter(current).
	// -> The join awards is not required.
});

Members

string

# static CAMPUS

  • CAMPUS

View Source global/Expand.js, line 66

string

# static COMPTA

  • COMPTA

View Source global/Expand.js, line 71

string

# static ECTS

  • ECTS

View Source global/Expand.js, line 69

string

# static JOB

  • JOB

View Source global/Expand.js, line 70

string

# static MODULE

  • MODULE

View Source global/Expand.js, line 68

string

# static PERMISSION

  • PERMISSION

View Source global/Expand.js, line 65

string

# static STUDY

  • STUDY

View Source global/Expand.js, line 67

Methods

# async process(expands, callback)

Processes the expands and calls a callback for each of them.

Parameters:
Name Type Description
expands Array.<string>

Expands being processed

callback function

View Source global/Expand.js, line 215

# setAuthorized(tableNames) → {Expand}

Sets the authorized expands

Parameters:
Name Type Description
tableNames Array.<string>

List of authorized expand/table names

View Source global/Expand.js, line 108

Expand

# setRequestUUID(uuid) → {Expand}

Sets the UUID searched in the request. This UUID is used for permissions checks.

Parameters:
Name Type Description
uuid *

View Source global/Expand.js, line 93

Expand

# setUser(user) → {Expand}

Sets the current user for permission checks.

Parameters:
Name Type Description
user module:LoggedUser

View Source global/Expand.js, line 81

Expand