From 7c23acde64977267f770e773254daf55c8d34bcb Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 26 Sep 2024 09:08:42 +0200 Subject: [PATCH] feat: refs #7874 add observationTypeFk col --- .../00-addClientObservationType.sql | 21 +++--------------- .../back/models/client-observation.json | 22 +++++++++++++------ 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/db/versions/11230-brownEucalyptus/00-addClientObservationType.sql b/db/versions/11230-brownEucalyptus/00-addClientObservationType.sql index 05376710a..699d0bea4 100644 --- a/db/versions/11230-brownEucalyptus/00-addClientObservationType.sql +++ b/db/versions/11230-brownEucalyptus/00-addClientObservationType.sql @@ -1,18 +1,3 @@ --- vn.clientObservationType -CREATE TABLE IF NOT EXISTS vn.clientObservationType( - id tinyint(3) unsigned NOT NULL AUTO_INCREMENT, - clientFk int(11) NOT NULL, - observationTypeFk tinyint(3) unsigned NOT NULL, - description varchar(50) NOT NULL, - PRIMARY KEY (id), - CONSTRAINT `clientFgn` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `clientObservationFgn` FOREIGN KEY (`observationTypeFk`) REFERENCES `observationType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -); - -INSERT INTO salix.ACL - SET model = 'ClientObservationType', - property = '*', - accessType = 'READ', - permission = 'ALLOW', - principalType = 'ROLE', - principalId = 'employee'; \ No newline at end of file +ALTER TABLE vn.clientObservation + ADD COLUMN observationTypeFk TINYINT(3) UNSIGNED, + ADD CONSTRAINT clientObservationTypeFk FOREIGN KEY (observationTypeFk) REFERENCES vn.observationType(id); \ No newline at end of file diff --git a/modules/client/back/models/client-observation.json b/modules/client/back/models/client-observation.json index b204ebeb4..86351862d 100644 --- a/modules/client/back/models/client-observation.json +++ b/modules/client/back/models/client-observation.json @@ -1,10 +1,10 @@ { - "name": "ClientObservation", + "name": "ClientObservation", "description": "Client notes", "base": "VnModel", - "mixins": { - "Loggable": true - }, + "mixins": { + "Loggable": true + }, "options": { "mysql": { "table": "clientObservation" @@ -26,6 +26,10 @@ "created": { "type": "date", "description": "Creation date and time" + }, + "observationTypeFk": { + "type": "number", + "description": "Type of observation" } }, "relations": { @@ -44,14 +48,18 @@ "include": { "relation": "worker", "scope": { - "fields": ["id"], + "fields": [ + "id" + ], "include": { "relation": "user", "scope": { - "fields": ["nickname"] + "fields": [ + "nickname" + ] } } } } } -} +} \ No newline at end of file