Added models
gitea/salix/2003-adress_validate_uee_members This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-01-23 14:59:37 +01:00
parent 6c0cc3d204
commit deada69ca4
8 changed files with 198 additions and 77 deletions

View File

@ -0,0 +1,13 @@
CREATE TABLE `vn`.`customsAgent` (
`id` int(11) NOT NULL,
`fiscalName` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`street` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`nif` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`phone` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL,
`email` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
ALTER TABLE `vn`.`customsAgent`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `nif_UNIQUE` (`nif`);
COMMIT;

View File

@ -0,0 +1,10 @@
CREATE TABLE `vn`.`incoterms` (
`code` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL,
`name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Internacional Commercial Terms';
ALTER TABLE `vn`.`incoterms`
ADD PRIMARY KEY (`code`);
REPLACE INTO `vn`.`incoterms` (`code`, `name`) VALUES
('FAS', 'Free Alongside Ship');

View File

@ -0,0 +1,26 @@
ALTER TABLE `vn`.`address`
ADD COLUMN `customsAgentFk` INT NULL DEFAULT NULL AFTER `isEqualizated`;
ALTER TABLE `vn`.`address`
ADD COLUMN `incotermsFk` VARCHAR(3) NULL DEFAULT NULL AFTER `customsAgentFk`;
ALTER TABLE `vn`.`address`
ADD INDEX `address_customsAgentFk_idx` (`customsAgentFk` ASC);
ALTER TABLE `vn`.`address`
ADD INDEX `address_incotermsFk_idx` (`incotermsFk` ASC);
ALTER TABLE `vn`.`address`
ADD CONSTRAINT `address_customsAgentFk`
FOREIGN KEY (`customsAgentFk`)
REFERENCES `vn`.`customsAgent` (`id`)
ON DELETE RESTRICT
ON UPDATE CASCADE;
ALTER TABLE `vn`.`address`
ADD CONSTRAINT `address_incotermsFk`
FOREIGN KEY (`incotermsFk`)
REFERENCES `vn`.`incoterms` (`code`)
ON DELETE RESTRICT
ON UPDATE CASCADE;

View File

@ -1960,4 +1960,8 @@ INSERT INTO `vn`.`travelThermograph`(`thermographFk`, `created`, `warehouseFk`,
('TL.BBA85422', CURDATE(), 2, 1, 'COOL', 'can not read the temperature', NULL),
('TZ1905012010', CURDATE(), 1, 1, 'WARM', 'Temperature in range', 5),
('138350-0', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 'WARM', NULL, 5),
('138350-0', CURDATE(), 1, NULL, 'COOL', NULL, NULL);
('138350-0', CURDATE(), 1, NULL, 'COOL', NULL, NULL);
INSERT INTO `vn`.`incoterms` (`code`, `name`)
VALUES
('FAS', 'Free Alongside Ship');

View File

@ -97,5 +97,11 @@
},
"ClientDms": {
"dataSource": "vn"
},
"CustomsAgent": {
"dataSource": "vn"
},
"Incoterms": {
"dataSource": "vn"
}
}

View File

@ -1,78 +1,88 @@
{
"name": "Address",
"description": "Client addresses",
"base": "Loggable",
"log": {
"model": "ClientLog",
"relation": "client",
"showField": "nickname"
},
"options": {
"mysql": {
"table": "address"
"name": "Address",
"description": "Client addresses",
"base": "Loggable",
"log": {
"model": "ClientLog",
"relation": "client",
"showField": "nickname"
},
"options": {
"mysql": {
"table": "address"
}
},
"properties": {
"id": {
"type": "Number",
"id": true,
"description": "Identifier"
},
"nickname": {
"type": "string",
"required": true
},
"street": {
"type": "string",
"required": true
},
"city": {
"type": "string",
"required": true
},
"postalCode": {
"type": "string"
},
"phone": {
"type": "string"
},
"mobile": {
"type": "string"
},
"isActive": {
"type": "boolean"
},
"longitude": {
"type": "Number"
},
"latitude": {
"type": "Number"
},
"isEqualizated": {
"type": "boolean"
}
},
"validations": [],
"relations": {
"province": {
"type": "belongsTo",
"model": "Province",
"foreignKey": "provinceFk"
},
"client": {
"type": "belongsTo",
"model": "Client",
"foreignKey": "clientFk"
},
"agencyMode": {
"type": "belongsTo",
"model": "AgencyMode",
"foreignKey": "agencyModeFk"
},
"observations": {
"type": "hasMany",
"model": "AddressObservation",
"foreignKey": "addressFk"
},
"incoterms": {
"type": "belongsTo",
"model": "Incoterm",
"foreignKey": "incotermsFk"
},
"customsAgent": {
"type": "belongsTo",
"model": "CustomsAgent",
"foreignKey": "customsAgentFk"
}
}
},
"properties": {
"id": {
"type": "Number",
"id": true,
"description": "Identifier"
},
"nickname": {
"type": "string",
"required": true
},
"street": {
"type": "string",
"required": true
},
"city": {
"type": "string",
"required": true
},
"postalCode": {
"type": "string"
},
"phone": {
"type": "string"
},
"mobile": {
"type": "string"
},
"isActive": {
"type": "boolean"
},
"longitude": {
"type": "Number"
},
"latitude": {
"type": "Number"
},
"isEqualizated": {
"type": "boolean"
}
},
"validations": [],
"relations": {
"province": {
"type": "belongsTo",
"model": "Province",
"foreignKey": "provinceFk"
},
"client": {
"type": "belongsTo",
"model": "Client",
"foreignKey": "clientFk"
},
"agencyMode": {
"type": "belongsTo",
"model": "AgencyMode",
"foreignKey": "agencyModeFk"
},
"observations": {
"type": "hasMany",
"model": "AddressObservation",
"foreignKey": "addressFk"
}
}
}
}

View File

@ -0,0 +1,33 @@
{
"name": "CustomsAgent",
"base": "VnModel",
"options": {
"mysql": {
"table": "customsAgent"
}
},
"properties": {
"id": {
"type": "Number",
"description": "Identifier",
"id": true
},
"fiscalName": {
"type": "String",
"required": true
},
"street": {
"type": "String"
},
"nif": {
"type": "String",
"required": true
},
"phone": {
"type": "String"
},
"email": {
"type": "String"
}
}
}

View File

@ -0,0 +1,19 @@
{
"name": "Incoterms",
"base": "VnModel",
"options": {
"mysql": {
"table": "incoterms"
}
},
"properties": {
"code": {
"type": "String",
"description": "Identifier",
"id": true
},
"name": {
"type": "String"
}
}
}