feat: refs #4988 agency add module
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Pablo Natek 2024-04-22 17:17:17 +02:00
parent 77f7348acb
commit adc3b413f5
5 changed files with 36 additions and 19 deletions

View File

@ -32,5 +32,10 @@
"model": "WorkCenter", "model": "WorkCenter",
"foreignKey": "workCenterFk" "foreignKey": "workCenterFk"
} }
},
"scope": {
"include":{
"relation": "workCenter"
}
} }
} }

View File

@ -1,6 +1,7 @@
-- vn.agencyLog definition -- vn.agencyLog definition
ALTER TABLE vn.agency ADD IF NOT EXISTS editorFk int(10) unsigned DEFAULT NULL NULL; ALTER TABLE vn.agency ADD IF NOT EXISTS editorFk int(10) unsigned DEFAULT NULL NULL;
ALTER TABLE vn.agency ADD CONSTRAINT agency_user_FK FOREIGN KEY (editorFk) REFERENCES `account`.`user`(id);
CREATE TABLE IF NOT EXISTS `vn`.`agencyLog` ( CREATE TABLE IF NOT EXISTS `vn`.`agencyLog` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int(10) unsigned NOT NULL AUTO_INCREMENT,

View File

@ -0,0 +1,18 @@
CREATE TABLE IF NOT EXISTS `agencyWorkCenter` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`agencyFk` smallint(5) unsigned NOT NULL,
`workCenterFk` int(11) NOT NULL,
`editorFk` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `agencyWorkCenter_unique` (`agencyFk`,`workCenterFk`),
KEY `agencyWorkCenter_workCenter_FK` (`workCenterFk`),
KEY `agencyWorkCenter_user_FK` (`editorFk`),
CONSTRAINT `agencyWorkCenter_agency_FK` FOREIGN KEY (`agencyFk`) REFERENCES `agency` (`id`) ON DELETE CASCADE,
CONSTRAINT `agencyWorkCenter_user_FK` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `agencyWorkCenter_workCenter_FK` FOREIGN KEY (`workCenterFk`) REFERENCES `workCenter` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #4988';
INSERT INTO vn.agencyWorkCenter (agencyFk, workCenterFk)
SELECT id, workCenterFk
FROM vn.agency
WHERE workCenterFk IS NOT NULL;

View File

@ -1,17 +0,0 @@
CREATE TABLE IF NOT EXISTS vn.agencyWorkCenter (
id INT UNSIGNED auto_increment NOT NULL,
agencyFk smallint(5) unsigned NULL,
workCenterFk int(11) NULL,
CONSTRAINT agencyWorkCenter_pk PRIMARY KEY (id),
CONSTRAINT agencyWorkCenter_agency_FK FOREIGN KEY (agencyFk) REFERENCES vn.agency(id) ON DELETE CASCADE,
CONSTRAINT agencyWorkCenter_workCenter_FK FOREIGN KEY (workCenterFk) REFERENCES vn.workCenter(id)
)
ENGINE=InnoDB
DEFAULT CHARSET=utf8mb3
COLLATE=utf8mb3_unicode_ci
COMMENT='refs #4988';
INSERT INTO vn.agencyWorkCenter (agencyFk, workCenterFk)
SELECT id, workCenterFk
FROM vn.agency
WHERE workCenterFk IS NOT NULL;

View File

@ -1,9 +1,19 @@
-- Place your SQL code here -- Place your SQL code here
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
VALUES('Agency', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('AgencyLog','*','READ','ALLOW','ROLE','employee'); VALUES ('AgencyLog','*','READ','ALLOW','ROLE','employee');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('AgencyWorkCenter','*','READ','ALLOW','ROLE','employee');
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
VALUES('AgencyMode', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
VALUES('Agency', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('Agency','*','WRITE','ALLOW','ROLE','deliveryAssistant'); VALUES ('Agency','*','WRITE','ALLOW','ROLE','deliveryAssistant');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('AgencyWorkCenter','*','WRITE','ALLOW','ROLE','deliveryAssistant');