@universis/candidates
Version:
Universis api server plugin for study program candidates, internship selection etc
33 lines (27 loc) • 1 kB
JavaScript
import {FileSchemaLoaderStrategy, ODataModelBuilder} from "@themost/data";
import path from 'path';
export class CandidateSchemaLoader extends FileSchemaLoaderStrategy {
/**
* @param {ConfigurationBase} config
*/
constructor(config) {
super(config);
this.setModelPath(path.resolve(__dirname, 'config/models'));
}
getModelDefinition(name) {
const model = super.getModelDefinition.bind(this)(name);
if (model) {
if (Array.isArray(model.eventListeners) ) {
model.eventListeners.forEach(eventListener => {
if (eventListener.type.indexOf('.') === 0) {
eventListener.type = path.resolve(__dirname, eventListener.type);
}
});
}
if (model.classPath && model.classPath.indexOf('.')===0) {
model.classPath= path.resolve(__dirname, model.classPath);
}
}
return model;
}
}