function DevopsSettingsService(databaseConnector) {
this.databaseConnector = databaseConnector;
console.log(databaseConnector)
this.createDevopsSettings = async (params) => {
if (typeof params == "undefined") {
throw new Error("params is required");
}
if (typeof params.repositoryName == "undefined") {
throw new Error("repositoryName is required");
}
if (typeof params.branchFilter == "undefined") {
throw new Error("branchFilter is required");
}
if (typeof params.yaml == "undefined") {
throw new Error("yaml is required");
}
let id;
try {
id = await this.databaseConnector('devops_settings').insert(params)
} catch (e) {
console.log(e);
throw new Error("Failed while devops settings was being created");
}
return id[0];
}
}
module.exports = DevopsSettingsService;
function databaseConnectorMock() {
function knexCore(){
this.insert = () => {
return [666];
}
}
return new knexCore();
}