feat: refs #8381 add agencyModeFk to travel thermograph and create AgencyModeIncoming model #3369
|
@ -0,0 +1,9 @@
|
||||||
|
CREATE OR REPLACE DEFINER=`vn`@`localhost`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn`.`agencyModeIncoming` AS
|
||||||
|
SELECT
|
||||||
|
am.id,
|
||||||
|
am.name
|
||||||
|
FROM `vn`.`agencyMode` AS am
|
||||||
|
JOIN `vn`.`agencyIncoming` AS ai
|
||||||
|
ON am.id = ai.agencyModeFk;
|
|
@ -0,0 +1,6 @@
|
||||||
|
ALTER TABLE `vn`.`agencyIncoming`
|
||||||
|
ADD CONSTRAINT `fk_agencyIncoming_agencyMode`
|
||||||
|
FOREIGN KEY (`agencyModeFk`)
|
||||||
|
REFERENCES `agencyMode`(`id`)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE;
|
|
@ -0,0 +1,7 @@
|
||||||
|
ALTER TABLE `vn`.`travelThermograph`
|
||||||
|
ADD COLUMN `agencyModeFk` INT(11) NULL AFTER `editorFk`,
|
||||||
|
ADD CONSTRAINT `travelThermograph_agencyIncoming_fk`
|
||||||
|
FOREIGN KEY (`agencyModeFk`)
|
||||||
|
REFERENCES `agencyIncoming`(`agencyModeFk`)
|
||||||
|
ON DELETE RESTRICT
|
||||||
|
ON UPDATE CASCADE;
|
|
@ -57,6 +57,10 @@ module.exports = Self => {
|
||||||
arg: 'hasFileAttached',
|
arg: 'hasFileAttached',
|
||||||
type: 'Boolean',
|
type: 'Boolean',
|
||||||
description: 'True if has an attached file'
|
description: 'True if has an attached file'
|
||||||
|
}, {
|
||||||
|
arg: 'agencyModeFk',
|
||||||
|
type: 'Number',
|
||||||
|
description: 'Carrier'
|
||||||
}],
|
}],
|
||||||
returns: {type: 'object', root: true},
|
returns: {type: 'object', root: true},
|
||||||
http: {path: `/:id/saveThermograph`, verb: 'POST'}
|
http: {path: `/:id/saveThermograph`, verb: 'POST'}
|
||||||
|
@ -76,6 +80,7 @@ module.exports = Self => {
|
||||||
reference,
|
reference,
|
||||||
description,
|
description,
|
||||||
hasFileAttached,
|
hasFileAttached,
|
||||||
|
agencyModeFk,
|
||||||
options
|
options
|
||||||
) => {
|
) => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
|
@ -119,6 +124,7 @@ module.exports = Self => {
|
||||||
minTemperature,
|
minTemperature,
|
||||||
temperatureFk,
|
temperatureFk,
|
||||||
warehouseFk: warehouseId,
|
warehouseFk: warehouseId,
|
||||||
|
agencyModeFk,
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
|
@ -22,5 +22,8 @@
|
||||||
},
|
},
|
||||||
"Temperature": {
|
"Temperature": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"AgencyModeIncoming": {
|
||||||
|
"dataSource": "vn"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"name": "AgencyModeIncoming",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "agencyModeIncoming"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"acls": [
|
||||||
|
{
|
||||||
|
"accessType": "READ",
|
||||||
|
"principalType": "ROLE",
|
||||||
|
"principalId": "$everyone",
|
||||||
|
"permission": "ALLOW"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -58,6 +58,11 @@
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Thermograph",
|
"model": "Thermograph",
|
||||||
"foreignKey": "thermographFk"
|
"foreignKey": "thermographFk"
|
||||||
|
},
|
||||||
|
"agencyMode": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "AgencyMode",
|
||||||
|
"foreignKey": "agencyModeFk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue