Back end dependencies adjusted for #655
This commit is contained in:
parent
e1131c2c93
commit
9bc8687a85
|
@ -1,6 +1,5 @@
|
|||
module.exports = Self => {
|
||||
// Validations
|
||||
|
||||
require('../methods/claim-beginning/importToNewRefundTicket')(Self);
|
||||
Self.validatesUniquenessOf('saleFk', {
|
||||
message: `A claim with that sale already exists`
|
||||
});
|
||||
|
|
|
@ -31,6 +31,15 @@
|
|||
},
|
||||
"ticketFk": {
|
||||
"type": "Number"
|
||||
},
|
||||
"claimStateFk": {
|
||||
"type": "Number"
|
||||
},
|
||||
"clientFk": {
|
||||
"type": "Number"
|
||||
},
|
||||
"workerFk": {
|
||||
"type": "Number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
@ -48,6 +57,11 @@
|
|||
"type": "belongsTo",
|
||||
"model": "Worker",
|
||||
"foreignKey": "workerFk"
|
||||
},
|
||||
"ticket": {
|
||||
"type": "belongsTo",
|
||||
"model": "Ticket",
|
||||
"foreignKey": "ticketFk"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
Self.new = async params => {
|
||||
Self.new = async(params, transaction) => {
|
||||
let existsAddress = await Self.app.models.Address.findOne({where: {id: params.addressFk, clientFk: params.clientFk}});
|
||||
if (!existsAddress)
|
||||
throw new UserError(`This address doesn't exist`);
|
||||
|
@ -38,7 +38,7 @@ module.exports = Self => {
|
|||
params.routeFk | null,
|
||||
params.landed,
|
||||
params.userId
|
||||
]);
|
||||
], transaction);
|
||||
|
||||
return result[1][0].newTicketId;
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const UserError = require('vn-loopback/common/helpers').UserError;
|
||||
const UserError = require(`../helpers`).UserError;
|
||||
|
||||
module.exports = Self => {
|
||||
Self.rewriteDbError(function(err) {
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = function(Self) {
|
||||
require('../methods/ticket-tracking/changeState')(Self);
|
||||
require('../../../ticket/common/methods/ticket-tracking/changeState')(Self);
|
||||
|
||||
Self.validatesPresenceOf('stateFk', {message: 'State cannot be blank'});
|
||||
};
|
|
@ -173,10 +173,10 @@ module.exports = function(Self) {
|
|||
};
|
||||
};
|
||||
|
||||
Self.rawSql = function(query, params, cb) {
|
||||
Self.rawSql = function(query, params, options = {}, cb) {
|
||||
var connector = this.dataSource.connector;
|
||||
return new Promise(function(resolve, reject) {
|
||||
connector.execute(query, params, function(error, response) {
|
||||
connector.execute(query, params, options, function(error, response) {
|
||||
if (cb)
|
||||
cb(error, response);
|
||||
if (error)
|
||||
|
|
|
@ -15,6 +15,15 @@
|
|||
"ACL": {
|
||||
"dataSource": "salix"
|
||||
},
|
||||
"ObservationType": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"TicketObservation": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"TicketTracking": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"RoleMapping": {
|
||||
"dataSource": "salix"
|
||||
},
|
||||
|
|
|
@ -1,13 +1,4 @@
|
|||
{
|
||||
"TicketObservation": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"ObservationType": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"TicketTracking": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"TicketPackaging": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue