From d469296bfccc0599b5461fb62d5e8882ff4e8a39 Mon Sep 17 00:00:00 2001 From: Ethan Kromhout Date: Wed, 26 Jun 2019 13:53:28 -0400 Subject: [PATCH] Add more complete sentrifugo configuration and update trigger --- Sources/HR/sentrifugo_server/step5.sql | 15 +++++++++++++++ Sources/HR/sentrifugo_server/trigger.sql | 5 ++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Sources/HR/sentrifugo_server/step5.sql b/Sources/HR/sentrifugo_server/step5.sql index 6f05952..bec228e 100644 --- a/Sources/HR/sentrifugo_server/step5.sql +++ b/Sources/HR/sentrifugo_server/step5.sql @@ -1 +1,16 @@ update main_users set emppassword = 'af31300a65ad8e2668302dab2e6e7908' where id = 1; +INSERT INTO `main_jobtitles` VALUES (1,'DEV','Developer',NULL,NULL,'D6','1',NULL,1,1,'2019-05-20 12:57:53','2019-05-20 12:57:53',1),(2,'DEVMGR','Development Manager',NULL,NULL,'M6','1',NULL,1,1,'2019-05-20 12:58:05','2019-05-20 12:58:05',1); +INSERT INTO `main_organisationinfo` VALUES (1,'UNC Chapel Hill',NULL,NULL,'www.unc.edu',NULL,5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,224,1313,3854,NULL,NULL,NULL,NULL,NULL,NULL,1,1,'2019-05-15 18:58:31','2019-05-15 18:58:31',1); +INSERT INTO `main_payfrequency` VALUES (1,'monthly','MM',NULL,1,1,'2019-05-20 12:57:24','2019-05-20 12:57:24',1); +INSERT INTO `main_businessunits` VALUES (1,'ITS','WANM',NULL,NULL,224,1313,3854,'440 West Franklin Street\nChapel Hill, NC 27599',NULL,NULL,1,NULL,1,1,1,'2019-05-13 14:17:15','2019-05-13 14:17:15',1); +INSERT INTO `main_departments` VALUES (1,'ITS Franklin','ZLYE',NULL,NULL,224,1313,3854,'440 West Franklin\r\nChapel Hill, NC 27510',NULL,NULL,1,NULL,1,1,1,'2019-05-13 14:17:53','2019-05-13 14:17:53',1); +INSERT INTO `main_jobtitles` VALUES (1,'DEVMGR','Development Manager',NULL,NULL,'M6','1',NULL,1,1,'2019-05-13 14:20:45','2019-05-13 14:20:45',1),(2,'DEV','Developer',NULL,NULL,'D6','1',NULL,1,1,'2019-05-13 14:22:29','2019-05-13 14:22:29',1); +INSERT INTO `main_positions` VALUES (1,'Developer Manager 1',1,NULL,1,1,'2019-05-13 14:21:00','2019-05-13 14:21:00',1),(2,'Developer 1',2,NULL,1,1,'2019-05-13 14:22:50','2019-05-13 14:22:50',1) +INSERT INTO `main_states` VALUES (1,224,'North Carolina','',1313,1,1,'2019-05-15 18:57:59','2019-05-15 18:57:59',1); +INSERT INTO `main_timezone` VALUES (1,152,'America/New_York','EDT','-04:00','',1,1,'2019-05-15 18:59:24','2019-05-15 18:59:24',1); +INSERT INTO `main_cities` VALUES (1,224,1313,'Raleigh',3854,1,1,'2019-05-15 18:58:11','2019-05-15 18:58:11',1); +INSERT INTO `main_countries` VALUES (1,'United States','USA',NULL,1,1,'2019-05-15 18:57:38','2019-05-15 18:57:38',1,224); +INSERT INTO `main_departments` VALUES (1,'Research Computing','RC',NULL,NULL,224,1313,3854,'211 Manning Drive\r\nChapel Hill NC 27599',NULL,NULL,1,NULL,1,1,1,'2019-05-20 13:01:12','2019-05-20 13:01:12',1); +INSERT INTO `main_organisationinfo` VALUES (1,'UNC Chapel Hill',NULL,NULL,'www.unc.edu',NULL,5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,224,1313,3854,NULL,NULL,NULL,NULL,NULL,NULL,1,1,'2019-05-15 18:58:31','2019-05-15 18:58:31',1); +INSERT INTO `main_employmentstatus` VALUES (1,'P',3,0,NULL,1,1,'2019-05-20 12:59:01','2019-05-20 12:59:01',1); + diff --git a/Sources/HR/sentrifugo_server/trigger.sql b/Sources/HR/sentrifugo_server/trigger.sql index 3f0caea..c96b56a 100644 --- a/Sources/HR/sentrifugo_server/trigger.sql +++ b/Sources/HR/sentrifugo_server/trigger.sql @@ -1,5 +1,8 @@ DELIMITER ;; -CREATE TRIGGER after_insert_on_main_users AFTER INSERT ON main_users FOR EACH ROW BEGIN SET @message_id = (SELECT lib_mysqludf_amqp_sendjson('amqp://mysql:5ecr3t@mq', 'sor', 'sor_person', json_object('payload',json_object('id',NEW.employeeId,'names',json_array(json_object('givenName',NEW.firstname,'familyName',NEW.lastname,'formatted',NEW.userfullname)),'emails',json_array(json_object('value',NEW.emailaddress,'type','primary')),'phoneNumbers',json_array(json_object('value','9194450056')))))); END;; +CREATE TRIGGER after_insert_on_main_employees_summary AFTER INSERT ON main_employees_summary FOR EACH ROW BEGIN SET @message_id = (SELECT lib_mysqludf_amqp_sendjson('amqp://mysql:5ecr3t@mq', 'sor', 'sor_person', json_object('payload',json_object('sourceId',json_array(json_object('id',NEW.employeeId,'source','HR')),'name',json_array(json_object('givenName',NEW.firstname,'familyName',NEW.lastname)),'email',json_array(json_object('emailAddress',NEW.emailaddress,'emailType','primary')),'phone',json_array(json_object('phoneNumber',NEW.office_number,'phoneType','Work'),json_object('phoneNumber',NEW.contactnumber,'phoneType','Mobile')))))); END;; + + +CREATE TRIGGER after_update_on_main_employees_summary AFTER UPDATE ON main_employees_summary FOR EACH ROW BEGIN SET @message_id = (SELECT lib_mysqludf_amqp_sendjson('amqp://mysql:5ecr3t@mq', 'sor', 'sor_person', json_object('payload',json_object('sourceId',json_array(json_object('id',NEW.employeeId,'source','HR')),'name',json_array(json_object('givenName',NEW.firstname,'familyName',NEW.lastname)),'email',json_array(json_object('emailAddress',NEW.emailaddress,'emailType','primary')),'phone',json_array(json_object('phoneNumber',NEW.office_number,'phoneType','Work'),json_object('phoneNumber',NEW.contactnumber,'phoneType','Mobile')))))); END;; DELIMITER ;