diff --git a/modules/ticket/back/models/stowaway.json b/modules/ticket/back/models/stowaway.json new file mode 100644 index 000000000..5a925cd20 --- /dev/null +++ b/modules/ticket/back/models/stowaway.json @@ -0,0 +1,36 @@ +{ + "name": "Stowaway", + "base": "VnModel", + "options": { + "mysql": { + "table": "stowaway" + } + }, + "properties": { + "id": { + "id": true, + "type": "Number", + "forceId": false + }, + "shipFk": { + "type": "Number", + "required": false + }, + "created":{ + "type": "Date", + "required": false + } + }, + "relations": { + "ship": { + "type": "belongsTo", + "model": "Ticket", + "foreignKey": "shipFk" + }, + "ticket": { + "type": "belongsTo", + "model": "Ticket", + "foreignKey": "id" + } + } +} diff --git a/modules/ticket/back/models/ticket.json b/modules/ticket/back/models/ticket.json index 3fb866cc0..bd8917f8d 100644 --- a/modules/ticket/back/models/ticket.json +++ b/modules/ticket/back/models/ticket.json @@ -44,6 +44,16 @@ "model": "Client", "foreignKey": "clientFk" }, + "ship": { + "type": "hasMany", + "model": "Stowaway", + "foreignKey": "shipFk" + }, + "stowaway": { + "type": "hasOne", + "model": "Stowaway", + "foreignKey": "id" + }, "warehouse": { "type": "belongsTo", "model": "Warehouse", diff --git a/modules/ticket/front/card/index.js b/modules/ticket/front/card/index.js index bbef4730c..cfd60800d 100644 --- a/modules/ticket/front/card/index.js +++ b/modules/ticket/front/card/index.js @@ -7,7 +7,9 @@ class Controller { this.filter = { include: [ {relation: 'warehouse', scope: {fields: ['name']}}, + {relation: 'ship'}, {relation: 'agencyMode', scope: {fields: ['name']}}, + {relation: 'stowaway'}, { relation: 'client', scope: {