From ee7282c4ca238fb845ffb0ab20a53dc901e3fa15 Mon Sep 17 00:00:00 2001 From: Martin Fritz Date: Tue, 28 Nov 2023 14:17:36 +0100 Subject: [PATCH] Create additional test data (#57) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [DO-4349][minor] Additional test data for assets asBuilt and asPlanned, alerts, and quality investigations. --------- Co-authored-by: Heinrich Götzger <145972012+hgo-ds@users.noreply.github.com> --- .../main/resources/application-testdata.yml | 125 +++++++++++++++--- .../afterMigrate__010_asset_as_built.sql | 42 ++++-- ...fterMigrate__011_asset_as_built_childs.sql | 4 +- ...terMigrate__012_asset_as_built_parents.sql | 4 +- .../afterMigrate__020_asset_as_planned.sql | 42 ++++-- ...erMigrate__021_asset_as_planned_childs.sql | 4 +- ...30_received_alert_on_as_built_received.sql | 40 ++++++ ...031_received_alert_on_as_build_receive.sql | 40 ------ ...eceived_alert_on_as_built_acknowledged.sql | 56 ++++++++ ...received_alert_on_as_build_acknowledge.sql | 56 -------- ...32_received_alert_on_as_built_accepted.sql | 56 ++++++++ ...33_received_alert_on_as_built_declined.sql | 56 ++++++++ ..._034_received_alert_on_as_built_closed.sql | 56 ++++++++ ...e__040_sent_alert_on_as_built_created.sql} | 13 +- ...ived_investigation_on_as_build_receive.sql | 40 ------ ...rate__041_sent_alert_on_as_built_sent.sql} | 8 +- ..._investigation_on_as_build_acknowledge.sql | 55 -------- ...42_sent_alert_on_as_built_acknowledged.sql | 55 ++++++++ ...e__043_sent_alert_on_as_built_accepted.sql | 55 ++++++++ ...e__044_sent_alert_on_as_built_declined.sql | 55 ++++++++ ...send_investigation_on_as_build_created.sql | 40 ------ ...e__045_sent_alert_on_as_built_canceled.sql | 41 ++++++ ...46_send_investigation_on_as_build_sent.sql | 40 ------ ...ate__046_sent_alert_on_as_built_closed.sql | 55 ++++++++ ...ved_investigation_on_as_built_received.sql | 40 ++++++ ...investigation_on_as_built_acknowledged.sql | 55 ++++++++ ...ved_investigation_on_as_built_accepted.sql | 55 ++++++++ ...ved_investigation_on_as_built_declined.sql | 55 ++++++++ ...eived_investigation_on_as_built_closed.sql | 55 ++++++++ ...sent_investigation_on_as_built_created.sql | 40 ++++++ ...61_sent_investigation_on_as_built_sent.sql | 40 ++++++ ...investigation_on_as_built_acknowledged.sql | 54 ++++++++ ...ent_investigation_on_as_built_accepted.sql | 54 ++++++++ ...ent_investigation_on_as_built_declined.sql | 54 ++++++++ ...ent_investigation_on_as_built_canceled.sql | 42 ++++++ ..._sent_investigation_on_as_built_closed.sql | 54 ++++++++ 36 files changed, 1306 insertions(+), 330 deletions(-) create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__030_received_alert_on_as_built_received.sql delete mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__031_received_alert_on_as_build_receive.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__031_received_alert_on_as_built_acknowledged.sql delete mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__032_received_alert_on_as_build_acknowledge.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__032_received_alert_on_as_built_accepted.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__033_received_alert_on_as_built_declined.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__034_received_alert_on_as_built_closed.sql rename tx-backend/src/main/resources/db/testdata/{afterMigrate__035_send_alert_on_as_build_created.sql => afterMigrate__040_sent_alert_on_as_built_created.sql} (65%) delete mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__041_received_investigation_on_as_build_receive.sql rename tx-backend/src/main/resources/db/testdata/{afterMigrate__036_send_alert_on_as_build_sent.sql => afterMigrate__041_sent_alert_on_as_built_sent.sql} (67%) delete mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__042_received_investigation_on_as_build_acknowledge.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__042_sent_alert_on_as_built_acknowledged.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__043_sent_alert_on_as_built_accepted.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__044_sent_alert_on_as_built_declined.sql delete mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__045_send_investigation_on_as_build_created.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__045_sent_alert_on_as_built_canceled.sql delete mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__046_send_investigation_on_as_build_sent.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__046_sent_alert_on_as_built_closed.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__050_received_investigation_on_as_built_received.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__051_received_investigation_on_as_built_acknowledged.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__052_received_investigation_on_as_built_accepted.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__053_received_investigation_on_as_built_declined.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__054_received_investigation_on_as_built_closed.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__060_sent_investigation_on_as_built_created.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__061_sent_investigation_on_as_built_sent.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__062_sent_investigation_on_as_built_acknowledged.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__063_sent_investigation_on_as_built_accepted.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__064_sent_investigation_on_as_built_declined.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__065_sent_investigation_on_as_built_canceled.sql create mode 100644 tx-backend/src/main/resources/db/testdata/afterMigrate__066_sent_investigation_on_as_built_closed.sql diff --git a/tx-backend/src/main/resources/application-testdata.yml b/tx-backend/src/main/resources/application-testdata.yml index 774985ad54..43466cefa9 100644 --- a/tx-backend/src/main/resources/application-testdata.yml +++ b/tx-backend/src/main/resources/application-testdata.yml @@ -33,6 +33,26 @@ spring: assetAsBuiltId08: "'urn:uuid:6d547770-01f5-4618-b055-4f0b86e2924f'" assetAsBuiltId09: "'urn:uuid:c09aa1f9-c8f4-4e92-935a-ea64ac703e33'" assetAsBuiltId10: "'urn:uuid:135249bf-2a52-499f-a686-1377ecc38ab7'" + assetAsBuiltId11: "'urn:uuid:2bb95b83-4136-4d1b-a97b-ecbc2814369e'" + assetAsBuiltId12: "'urn:uuid:cfbc8379-eaa1-4374-b472-09c0c9b50a0a'" + assetAsBuiltId13: "'urn:uuid:6e082245-7171-4593-8038-d3b15c27b5f9'" + assetAsBuiltId14: "'urn:uuid:059bd389-e7fb-4127-991f-d8b36353975c'" + assetAsBuiltId15: "'urn:uuid:0f643092-1c2e-453e-8cf1-4069fd055111'" + assetAsBuiltId16: "'urn:uuid:998ab013-0cdc-41b2-9abc-8e6e5d6ba974'" + assetAsBuiltId17: "'urn:uuid:907d3ec4-f91c-434d-b46a-34fb0250e05b'" + assetAsBuiltId18: "'urn:uuid:1e04733b-741e-4bed-a4b5-9c4b0fa0860c'" + assetAsBuiltId19: "'urn:uuid:91a8d11a-e5f6-40e8-a187-8b9f7eecdc57'" + assetAsBuiltId20: "'urn:uuid:614bdfcf-6e86-43f5-a295-f791a92859f1'" + assetAsBuiltId21: "'urn:uuid:9e85f88a-2e6b-40fe-a7b2-1a0c64ea0ad4'" + assetAsBuiltId22: "'urn:uuid:b69cb0d1-0cbe-4f47-ac34-a4b7ef5cd6ff'" + assetAsBuiltId23: "'urn:uuid:3d0e7c0d-6aa1-43f7-8fe5-88d7e71da4f7'" + assetAsBuiltId24: "'urn:uuid:dbffab7f-4fcd-4d09-bd35-fedd5dd2f141'" + assetAsBuiltId25: "'urn:uuid:11b5fa3a-f5ab-471b-885b-70949a41c179'" + assetAsBuiltId26: "'urn:uuid:db5ea31d-cbd7-45ff-b079-2a8ad2093a92'" + assetAsBuiltId27: "'urn:uuid:6bebac2c-ef0e-4a8d-a9f3-ad144af875a9'" + assetAsBuiltId28: "'urn:uuid:524918bd-8550-47cb-9a72-2c52765df25e'" + assetAsBuiltId29: "'urn:uuid:e0a485de-c989-4afa-966f-f3d5553bdbcb'" + assetAsBuiltId30: "'urn:uuid:828c01ba-3a03-43b6-b71b-b86a4a2d9549'" assetAsPlannedId01: "'urn:uuid:e97699c1-89c1-474b-8a92-c3a887c6b4c0'" assetAsPlannedId02: "'urn:uuid:78e5523d-73b6-4770-b5f5-5ea314c33674'" @@ -44,26 +64,95 @@ spring: assetAsPlannedId08: "'urn:uuid:2af628f6-522f-4eb9-aeff-2e52ed619548'" assetAsPlannedId09: "'urn:uuid:e266a50e-174d-4e73-9158-3a98eac1ad58'" assetAsPlannedId10: "'urn:uuid:c8d6ebd6-f205-430f-93d1-d09a1540d307'" + assetAsPlannedId11: "'urn:uuid:d1421674-bef8-4cfe-996e-8a261979647a'" + assetAsPlannedId12: "'urn:uuid:2a107d93-8401-4684-ac51-449026ee8242'" + assetAsPlannedId13: "'urn:uuid:d77e93ea-a4ea-4749-90e2-53233628427d'" + assetAsPlannedId14: "'urn:uuid:f40306d8-b968-48a7-908e-dbcc52548047'" + assetAsPlannedId15: "'urn:uuid:44120129-a42c-4178-9ce0-0ad0c92dba6e'" + assetAsPlannedId16: "'urn:uuid:986fbb89-3074-4508-af6b-c563dfc5b89f'" + assetAsPlannedId17: "'urn:uuid:c658a87e-320a-4986-bee0-49b5651a6d2c'" + assetAsPlannedId18: "'urn:uuid:4a7601b3-38ff-40e6-91c5-cfcc993fc7bf'" + assetAsPlannedId19: "'urn:uuid:6b3aac2d-1c90-4f40-abec-9171009c8d59'" + assetAsPlannedId20: "'urn:uuid:058ee79f-1996-4d85-9ac9-2e9bcca9e744'" + assetAsPlannedId21: "'urn:uuid:2e4bd1cb-5017-44ca-b1af-eb72f901d772'" + assetAsPlannedId22: "'urn:uuid:8f34a5c5-97a8-4a3a-ad41-71797a815daa'" + assetAsPlannedId23: "'urn:uuid:49aa542f-49a8-42ef-ba6a-6dbc3ba17e9f'" + assetAsPlannedId24: "'urn:uuid:48654605-b474-4117-98df-2731e215ea9d'" + assetAsPlannedId25: "'urn:uuid:0af36a03-73a5-4cda-9c4f-9e2fdc4b83b6'" + assetAsPlannedId26: "'urn:uuid:ebfae9ab-8d7d-49d4-a235-194ca25e3996'" + assetAsPlannedId27: "'urn:uuid:dff741cd-111a-4c46-a3a0-162516258f69'" + assetAsPlannedId28: "'urn:uuid:84a2c8ac-b05d-447f-8879-3ab1f9ade76c'" + assetAsPlannedId29: "'urn:uuid:6fe70423-5e1d-4b2f-b946-3d526f6a869b'" + assetAsPlannedId30: "'urn:uuid:26032839-8ca6-43d5-81c7-f51868321119'" - alertId1: 1 - alertId2: 2 - alertId3: 3 - alertId4: 4 + alertSentId1: 1 + alertSentId2: 2 + alertSentId3: 3 + alertSentId4: 4 + alertSentId5: 5 + alertSentId6: 6 + alertSentId7: 7 - alertNotificationId1: "'4939c189-b75d-4647-94cb-a75b83a92313'" - alertNotificationId2a: "'e3de866d-044b-4db9-9349-841365189a9b'" - alertNotificationId2b: "'98d5107c-f11b-4a69-9207-906c660be7f6'" - alertNotificationId3: "'df5b7e53-5b5e-445b-adbe-0fe6dabc05e3'" - alertNotificationId4: "'fef2174d-4ea6-4b06-b189-6f7fe7809418'" + alertReceivedId1: 11 + alertReceivedId2: 12 + alertReceivedId3: 13 + alertReceivedId4: 14 + alertReceivedId5: 15 - investigationId1: 1 - investigationId2: 2 - investigationId3: 3 - investigationId4: 4 + alertNotificationSentId1: "'4939c189-b75d-4647-94cb-a75b83a92313'" + alertNotificationSentId2: "'a15583ac-101e-44e0-9fba-33ceaa4d3540'" + alertNotificationSentId3a: "'8b1319a4-4ba8-46bc-a0b0-1c71d9186d25'" + alertNotificationSentId3b: "'cab39b22-3938-4b27-9a78-68ef980147dc'" + alertNotificationSentId4a: "'86ef99d6-15c9-4bb0-87ee-9828fe06a3d2'" + alertNotificationSentId4b: "'c8216fd5-88cf-44eb-baa5-c942912cae7e'" + alertNotificationSentId5a: "'3d5a6398-c807-4bb8-9a8c-7bc436988964'" + alertNotificationSentId5b: "'35b7e479-7469-4b83-bfc1-0f0c13ad09f6'" + alertNotificationSentId6: "'0b2ee6b3-6bc8-487d-b8f2-75c027e51b26'" + alertNotificationSentId7a: "'21bc7f55-59ae-4711-b961-6af1a7c25757'" + alertNotificationSentId7b: "'f03a4de5-0820-45bb-828e-96e38d433c87'" - investigationNotificationId1: "'7486286d-a098-4617-81ea-3015bc866a7e'" - investigationNotificationId2a: "'94032934-8ec8-4f97-a38d-6b16d448cbfb'" - investigationNotificationId2b: "'36e270c0-4a40-4516-b2f0-c21f8c033f2b'" - investigationNotificationId3: "'b5b4612e-6ed6-47c2-8f52-adefe3d5b99a'" - investigationNotificationId4: "'62eea0b3-c8b1-48d9-a220-cb01c3a3f4fe'" + alertNotificationReceivedId1: "'e3de866d-044b-4db9-9349-841365189a9b'" + alertNotificationReceivedId2a: "'98d5107c-f11b-4a69-9207-906c660be7f6'" + alertNotificationReceivedId2b: "'194b32b5-8b28-40d8-a29a-58a30a1ac2c5'" + alertNotificationReceivedId3a: "'df5b7e53-5b5e-445b-adbe-0fe6dabc05e3'" + alertNotificationReceivedId3b: "'d51d8ea4-67b1-49ed-a0c0-b40a452362db'" + alertNotificationReceivedId4a: "'fef2174d-4ea6-4b06-b189-6f7fe7809418'" + alertNotificationReceivedId4b: "'cf6e4290-6d86-4a8e-94f1-8fee275ce133'" + alertNotificationReceivedId5a: "'38c47db2-9f92-4e58-9d5b-3245c064d0fa'" + alertNotificationReceivedId5b: "'317fa3d4-126a-424d-a030-aa53384573fd'" + investigationSentId1: 1 + investigationSentId2: 2 + investigationSentId3: 3 + investigationSentId4: 4 + investigationSentId5: 5 + investigationSentId6: 6 + investigationSentId7: 7 + + investigationReceivedId1: 11 + investigationReceivedId2: 12 + investigationReceivedId3: 13 + investigationReceivedId4: 14 + investigationReceivedId5: 15 + + investigationNotificationSentId1: "'7486286d-a098-4617-81ea-3015bc866a7e'" + investigationNotificationSentId2: "'94032934-8ec8-4f97-a38d-6b16d448cbfb'" + investigationNotificationSentId3a: "'b5b4612e-6ed6-47c2-8f52-adefe3d5b99a'" + investigationNotificationSentId3b: "'62eea0b3-c8b1-48d9-a220-cb01c3a3f4fe'" + investigationNotificationSentId4a: "'36e270c0-4a40-4516-b2f0-c21f8c033f2b'" + investigationNotificationSentId4b: "'317fa3d4-126a-424d-a030-aa53384573fd'" + investigationNotificationSentId5a: "'531ca5d8-3634-4439-8090-743a7a63be75'" + investigationNotificationSentId5b: "'a5444374-a0a6-452a-9d45-079930468800'" + investigationNotificationSentId6: "'54511ec0-304b-41ef-8426-6585a1ee1558'" + investigationNotificationSentId7a: "'6adc3d93-7efb-4c2b-bd9d-bbb1b61549f0'" + investigationNotificationSentId7b: "'8e866bf4-fa92-43fb-a012-a27556659579'" + + investigationNotificationReceivedId1: "'0678b9c6-a9c4-4ff9-a5e2-c6cd19c5f8c6'" + investigationNotificationReceivedId2a: "'3fbd0206-2507-445c-aa6b-ec726d0eeae2'" + investigationNotificationReceivedId2b: "'989ae19d-d682-4c1b-baaf-4bb779d91d8d'" + investigationNotificationReceivedId3a: "'7561d71a-0706-4dd9-bf7e-29d8be482e19'" + investigationNotificationReceivedId3b: "'2dae86e5-77b6-449c-b51d-6031e39f0fcb'" + investigationNotificationReceivedId4a: "'907e4a54-7855-454b-a8e7-5be3d46496c9'" + investigationNotificationReceivedId4b: "'829f95f4-38a8-4678-b761-ff66346a047e'" + investigationNotificationReceivedId5a: "'55781066-d7ae-41f2-8adb-133983f18c2a'" + investigationNotificationReceivedId5b: "'a9c8fa69-5e6b-4adc-99a2-307bf3a83f5d'" diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__010_asset_as_built.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__010_asset_as_built.sql index 1a25d70eec..58a095c11f 100644 --- a/tx-backend/src/main/resources/db/testdata/afterMigrate__010_asset_as_built.sql +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__010_asset_as_built.sql @@ -3,15 +3,35 @@ -- it is only intended for usage in local or test environments insert into assets_as_built - (id , customer_part_id, id_short , manufacturer_id , manufacturer_name, manufacturer_part_id, manufacturing_country, name_at_customer , name_at_manufacturer , quality_type, van , owner , in_investigation, active_alert, semantic_model_id , semantic_data_model, classification, product_type, traction_battery_code, manufacturing_date) + (id , customer_part_id, id_short , manufacturer_id , manufacturer_name, manufacturer_part_id, manufacturing_country, name_at_customer , name_at_manufacturer , quality_type, van , owner , in_investigation, active_alert, semantic_model_id , semantic_data_model, classification, product_type, traction_battery_code, manufacturing_date) values - (${assetAsBuiltId01}, '95657762-59' , 'H-LeftHeadLight' , 'BPNL000000000001', 'Hella' , 'XH4711' , 'DEU' , 'Xenon Headlights left' , 'Xenon Left-Headlights' , 'OK' , '--', 'OWN' , False , False , 'NO-613963493493659233961306', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-02-04T13:48:54'), - (${assetAsBuiltId02}, '95657762-60' , 'H-RightHeadLight', 'BPNL000000000001', 'Hella' , 'XH4712' , 'DEU' , 'Xenon Headlights right', 'Xenon Right-Headlights' , 'OK' , '--', 'OWN' , False , False , 'NO-613963493493659233961307', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-02-04T13:48:54'), - (${assetAsBuiltId03}, '95657762-61' , 'O-LeftHeadBulb' , 'BPNL000SUPPLIER1', 'Osram' , 'LBH815' , 'DEU' , 'Head Light Bulb left' , 'Osram Front Left-AX400' , 'OK' , '--', 'SUPPLIER', False , False , 'NO-613963493493659233961308', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-02-04T13:48:54'), - (${assetAsBuiltId04}, '95657762-62' , 'O-RightHeadBulb' , 'BPNL000SUPPLIER1', 'Osram' , 'LBH816' , 'DEU' , 'Head Light Bulb right' , 'Osram Front Right-AX400' , 'OK' , '--', 'SUPPLIER', False , False , 'NO-613963493493659233961309', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-02-04T13:48:54'), - (${assetAsBuiltId05}, '95657762-63' , 'P-LeftHeadBulb' , 'BPNL000SUPPLIER2', 'Phillips' , 'D3HPHL' , 'DEU' , 'Head Light Bulb left' , 'Phillips Front Left-D3H' , 'OK' , '--', 'SUPPLIER', False , False , 'NO-613963493493659233961318', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-02-04T13:48:54'), - (${assetAsBuiltId06}, '95657762-64' , 'P-RightHeadBulb' , 'BPNL000SUPPLIER2', 'Phillips' , 'D3HPHR' , 'DEU' , 'Head Light Bulb right' , 'Phillips Front Right-D3H', 'OK' , '--', 'SUPPLIER', False , False , 'NO-613963493493659233961319', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-02-04T13:48:54'), - (${assetAsBuiltId07}, '95657762-65' , 'BMW-Z1' , 'BPNL000CUSTOMER1', 'BMW AG' , 'Z1ABC' , 'DEU' , 'BMW Z1' , 'Z1' , 'OK' , '--', 'CUSTOMER', False , False , 'NO-613963493493659233961300', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-02-04T13:48:54'), - (${assetAsBuiltId08}, '95657762-66' , 'BMW-Z4' , 'BPNL000CUSTOMER1', 'BMW AG' , 'Z4ABC' , 'DEU' , 'BMW Z3' , 'Z3' , 'OK' , '--', 'CUSTOMER', False , False , 'NO-613963493493659233961301', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-02-04T13:48:54'), - (${assetAsBuiltId09}, '95657762-67' , 'Audi-A7' , 'BPNL000CUSTOMER2', 'Audi AG' , 'A7XXX' , 'DEU' , 'Audi A7' , 'A7' , 'OK' , '--', 'CUSTOMER', False , False , 'NO-613963493493659233961302', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-02-04T13:48:54'), - (${assetAsBuiltId10}, '95657762-68' , 'Audi-A8' , 'BPNL000CUSTOMER2', 'Audi AG' , 'A8XXX' , 'DEU' , 'Audi A8' , 'A8' , 'OK' , '--', 'CUSTOMER', False , False , 'NO-613963493493659233961303', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-02-04T13:48:54'); + (${assetAsBuiltId01}, '95657762-59' , 'H-LeftHeadLight' , 'BPNL000000000001', 'Hella' , 'XH4711' , 'DEU' , 'Xenon Headlights left' , 'Xenon Left-Headlights' , 'OK' , '--', 'OWN' , False , False , 'NO-613963493493659233961306', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-03-04T13:48:54'), + (${assetAsBuiltId02}, '95657762-60' , 'H-RightHeadLight' , 'BPNL000000000001', 'Hella' , 'XH4712' , 'DEU' , 'Xenon Headlights right', 'Xenon Right-Headlights' , 'OK' , '--', 'OWN' , False , False , 'NO-613963493493659233961307', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-03-04T13:55:00'), + (${assetAsBuiltId03}, '95657762-61' , 'O-LeftHeadBulb' , 'BPNL000SUPPLIER1', 'Osram' , 'LBH815' , 'DEU' , 'Head Light Bulb left' , 'Osram Front Left-AX400' , 'OK' , '--', 'SUPPLIER', False , False , 'NO-613963493493659233961308', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-02-05T08:22:00'), + (${assetAsBuiltId04}, '95657762-62' , 'O-RightHeadBulb' , 'BPNL000SUPPLIER1', 'Osram' , 'LBH816' , 'DEU' , 'Head Light Bulb right' , 'Osram Front Right-AX400' , 'OK' , '--', 'SUPPLIER', False , False , 'NO-613963493493659233961309', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-02-05T09:45:30'), + (${assetAsBuiltId05}, '95657762-63' , 'P-LeftHeadBulb' , 'BPNL000SUPPLIER2', 'Philips' , 'D3HPHL' , 'DEU' , 'Head Light Bulb left' , 'Philips Front Left-D3H' , 'OK' , '--', 'SUPPLIER', False , False , 'NO-613963493493659233961318', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-02-17T06:22:00'), + (${assetAsBuiltId06}, '95657762-64' , 'P-RightHeadBulb' , 'BPNL000SUPPLIER2', 'Philips' , 'D3HPHR' , 'DEU' , 'Head Light Bulb right' , 'Philips Front Right-D3H' , 'OK' , '--', 'SUPPLIER', False , False , 'NO-613963493493659233961319', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-02-19T13:50:25'), + (${assetAsBuiltId07}, '95657762-65' , 'BMW-Z1' , 'BPNL000CUSTOMER1', 'BMW AG' , 'Z1ABC' , 'DEU' , 'BMW Z1' , 'Z1' , 'OK' , '--', 'CUSTOMER', False , False , 'NO-613963493493659233961300', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-07-30T15:00:00'), + (${assetAsBuiltId08}, '95657762-66' , 'BMW-Z4' , 'BPNL000CUSTOMER1', 'BMW AG' , 'Z4ABC' , 'DEU' , 'BMW Z3' , 'Z3' , 'OK' , '--', 'CUSTOMER', False , False , 'NO-613963493493659233961301', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-07-31T00:00:00'), + (${assetAsBuiltId09}, '95657762-67' , 'Audi-A7' , 'BPNL000CUSTOMER2', 'Audi AG' , 'A7XXX' , 'DEU' , 'Audi A7' , 'A7' , 'OK' , '--', 'CUSTOMER', False , False , 'NO-613963493493659233961302', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-08-10T10:15:00'), + (${assetAsBuiltId10}, '95657762-68' , 'Audi-A8' , 'BPNL000CUSTOMER2', 'Audi AG' , 'A8XXX' , 'DEU' , 'Audi A8' , 'A8' , 'OK' , '--', 'CUSTOMER', False , False , 'NO-613963493493659233961303', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-08-10T05:30:00'), + (${assetAsBuiltId11}, '95657762-69' , 'H-LeftTurningLight' , 'BPNL000000000001', 'Hella' , 'XH4713' , 'DEU' , 'Turning lights left' , 'Left Turning Lights' , 'OK' , '--', 'OWN' , False , False , 'NO-613963493493659233961401', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-03-01T05:30:00'), + (${assetAsBuiltId12}, '95657762-70' , 'H-RightTurningLight' , 'BPNL000000000001', 'Hella' , 'XH4714' , 'DEU' , 'Turning lights right' , 'Right Turning Lights' , 'OK' , '--', 'OWN' , False , False , 'NO-613963493493659233961402', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-03-03T05:30:00'), + (${assetAsBuiltId13}, '95657762-71' , 'H-LeftBrakeLight' , 'BPNL000000000001', 'Hella' , 'XH4715' , 'DEU' , 'Brake lights left' , 'Left Brake Lights' , 'OK' , '--', 'OWN' , False , False , 'NO-613963493493659233961403', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-03-05T05:30:00'), + (${assetAsBuiltId14}, '95657762-72' , 'H-RightBrakeLight' , 'BPNL000000000001', 'Hella' , 'XH4716' , 'DEU' , 'Brake lights right' , 'Right Brake Lights' , 'OK' , '--', 'OWN' , False , False , 'NO-613963493493659233961404', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-03-07T05:30:00'), + (${assetAsBuiltId15}, '95657762-73' , 'H-LeftFogLight' , 'BPNL000000000001', 'Hella' , 'XH4717' , 'DEU' , 'Fog lights left' , 'Left Fog Lights' , 'OK' , '--', 'OWN' , False , False , 'NO-613963493493659233961405', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-03-02T05:30:00'), + (${assetAsBuiltId16}, '95657762-74' , 'H-RightFogLight' , 'BPNL000000000001', 'Hella' , 'XH4718' , 'DEU' , 'Fog lights right' , 'Right Fog Lights' , 'OK' , '--', 'OWN' , False , False , 'NO-613963493493659233961406', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-03-04T05:30:00'), + (${assetAsBuiltId17}, '95657762-75' , 'H-LeftHighBeam' , 'BPNL000000000001', 'Hella' , 'XH4719' , 'DEU' , 'High beam left' , 'Left High Beam' , 'OK' , '--', 'OWN' , False , False , 'NO-613963493493659233961407', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-03-06T05:30:00'), + (${assetAsBuiltId18}, '95657762-76' , 'H-RightHighBeam' , 'BPNL000000000001', 'Hella' , 'XH4720' , 'DEU' , 'High beam right' , 'Right High Beam' , 'OK' , '--', 'OWN' , False , False , 'NO-613963493493659233961408', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-03-08T05:30:00'), + (${assetAsBuiltId19}, '95657762-77' , 'O-TurningLight' , 'BPNL000SUPPLIER1', 'Osram' , 'OTLB1' , 'DEU' , 'Turning Light Bulb' , 'Osram Turning Light Bulb' , 'OK' , '--', 'SUPPLIER', False , False , 'NO-613963493493659233961501', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-02-01T05:30:00'), + (${assetAsBuiltId20}, '95657762-78' , 'O-BrakeLight' , 'BPNL000SUPPLIER1', 'Osram' , 'OBLB1' , 'DEU' , 'Brake Light Bulb' , 'Osram Brake Light Bulb' , 'OK' , '--', 'SUPPLIER', False , False , 'NO-613963493493659233961502', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-02-03T05:30:00'), + (${assetAsBuiltId21}, '95657762-79' , 'P-TurningLight' , 'BPNL000SUPPLIER2', 'Philips' , 'PTLB1' , 'DEU' , 'Turning Light Bulb' , 'Philips Turning Light Bulb' , 'OK' , '--', 'SUPPLIER', False , False , 'NO-613963493493659233961503', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-02-07T05:30:00'), + (${assetAsBuiltId22}, '95657762-80' , 'P-BrakeLight' , 'BPNL000SUPPLIER2', 'Philips' , 'PBLB1' , 'DEU' , 'Brake Light Bulb' , 'Philips Brake Light Bulb' , 'OK' , '--', 'SUPPLIER', False , False , 'NO-613963493493659233961504', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-02-02T05:30:00'), + (${assetAsBuiltId23}, '95657762-81' , 'W-FogLight' , 'BPNL000SUPPLIER3', 'Würth' , 'WFLB1' , 'DEU' , 'Fog Light Bulb' , 'Würth Fog Light Bulb' , 'OK' , '--', 'SUPPLIER', False , False , 'NO-613963493493659233961505', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-02-04T05:30:00'), + (${assetAsBuiltId24}, '95657762-82' , 'W-HighBeam' , 'BPNL000SUPPLIER3', 'Würth' , 'WHBB1' , 'DEU' , 'High Beam Bulb' , 'Würth High Beam Bulb' , 'OK' , '--', 'SUPPLIER', False , False , 'NO-613963493493659233961506', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-02-06T05:30:00'), + (${assetAsBuiltId25}, '95657762-83' , 'BMW-X1' , 'BPNL000CUSTOMER1', 'BMW AG' , 'X1ABC' , 'DEU' , 'BMW X1' , 'X1' , 'OK' , '--', 'CUSTOMER', False , False , 'NO-613963493493659233961601', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-08-02T05:30:00'), + (${assetAsBuiltId26}, '95657762-84' , 'BMW-X3' , 'BPNL000CUSTOMER1', 'BMW AG' , 'X3ABC' , 'DEU' , 'BMW X3' , 'X3' , 'OK' , '--', 'CUSTOMER', False , False , 'NO-613963493493659233961602', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-08-03T05:30:00'), + (${assetAsBuiltId27}, '95657762-85' , 'Audi-Q7' , 'BPNL000CUSTOMER2', 'Audi AG' , 'Q7XXX' , 'DEU' , 'Audi Q7' , 'Q7' , 'OK' , '--', 'CUSTOMER', False , False , 'NO-613963493493659233961603', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-08-04T05:30:00'), + (${assetAsBuiltId28}, '95657762-86' , 'Audi-Q8' , 'BPNL000CUSTOMER2', 'Audi AG' , 'Q8XXX' , 'DEU' , 'Audi Q8' , 'Q8' , 'OK' , '--', 'CUSTOMER', False , False , 'NO-613963493493659233961604', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-08-05T05:30:00'), + (${assetAsBuiltId29}, '95657762-87' , 'VW-ID.4' , 'BPNL000CUSTOMER3', 'VW AG' , 'ID4YZ' , 'DEU' , 'VW ID.4' , 'ID.4' , 'OK' , '--', 'CUSTOMER', False , False , 'NO-613963493493659233961605', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-08-06T05:30:00'), + (${assetAsBuiltId30}, '95657762-88' , 'VW-ID.5' , 'BPNL000CUSTOMER3', 'VW AG' , 'ID5YZ' , 'DEU' , 'VW ID.5' , 'ID.5' , 'OK' , '--', 'CUSTOMER', False , False , 'NO-613963493493659233961606', 'SERIALPART' , 'component' , 'AS_BUILT' , '--' , '2022-08-07T05:30:00'); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__011_asset_as_built_childs.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__011_asset_as_built_childs.sql index 2ea6a29cf0..542f22d96c 100644 --- a/tx-backend/src/main/resources/db/testdata/afterMigrate__011_asset_as_built_childs.sql +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__011_asset_as_built_childs.sql @@ -7,9 +7,9 @@ insert into assets_as_built_childs values -- supplier is child of owner (${assetAsBuiltId03}, ${assetAsBuiltId01}, 'H-LeftHeadLight'), -- Osram Front Left-AX400 isChildOf Xenon Left-Headlights - (${assetAsBuiltId05}, ${assetAsBuiltId01}, 'H-LeftHeadLight'), -- Phillips Front Left-D3H isChildOf Xenon Left-Headlights + (${assetAsBuiltId05}, ${assetAsBuiltId01}, 'H-LeftHeadLight'), -- Philips Front Left-D3H isChildOf Xenon Left-Headlights (${assetAsBuiltId04}, ${assetAsBuiltId02}, 'H-RightHeadLight'), -- Osram Front Right-AX400 isChildOf Xenon Right-Headlights - (${assetAsBuiltId06}, ${assetAsBuiltId02}, 'H-RightHeadLight'), -- Phillips Front Right-D3H isChildOf Xenon Right-Headlights + (${assetAsBuiltId06}, ${assetAsBuiltId02}, 'H-RightHeadLight'), -- Philips Front Right-D3H isChildOf Xenon Right-Headlights -- owner is child of customer (${assetAsBuiltId01}, ${assetAsBuiltId07}, 'BMW-Z1'), -- Xenon Left-Headlights isChildOf Z1 diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__012_asset_as_built_parents.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__012_asset_as_built_parents.sql index a024344e97..841c8c1ff1 100644 --- a/tx-backend/src/main/resources/db/testdata/afterMigrate__012_asset_as_built_parents.sql +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__012_asset_as_built_parents.sql @@ -11,6 +11,6 @@ values -- owner is parent of supplier (${assetAsBuiltId01}, ${assetAsBuiltId03}, 'O-LeftHeadBulb'), -- Xenon Left-Headlights isParentOf Osram Front Left-AX400 - (${assetAsBuiltId01}, ${assetAsBuiltId05}, 'P-LeftHeadBulb'), -- Xenon Left-Headlights isParentOf Phillips Front Left-D3H + (${assetAsBuiltId01}, ${assetAsBuiltId05}, 'P-LeftHeadBulb'), -- Xenon Left-Headlights isParentOf Philips Front Left-D3H (${assetAsBuiltId02}, ${assetAsBuiltId04}, 'O-RightHeadBulb'), -- Xenon Right-Headlights isParentOf Osram Front Right-AX400 - (${assetAsBuiltId02}, ${assetAsBuiltId06}, 'P-RightHeadBulb'); -- Xenon Right-Headlights isParentOf Phillips Front Right-D3H + (${assetAsBuiltId02}, ${assetAsBuiltId06}, 'P-RightHeadBulb'); -- Xenon Right-Headlights isParentOf Philips Front Right-D3H diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__020_asset_as_planned.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__020_asset_as_planned.sql index 36fdc96dff..66a07b25cf 100644 --- a/tx-backend/src/main/resources/db/testdata/afterMigrate__020_asset_as_planned.sql +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__020_asset_as_planned.sql @@ -3,15 +3,35 @@ -- it is only intended for usage in local or test environments insert into assets_as_planned - (id , id_short , manufacturer_part_id, name_at_manufacturer , quality_type, classification, owner , semantic_data_model, function , manufacturer_name, van , semantic_model_id , catenax_site_id , function_valid_from , function_valid_until , validity_period_from , validity_period_to) + (id , id_short , manufacturer_part_id, name_at_manufacturer , quality_type, classification, owner , semantic_data_model , function , manufacturer_name, van , semantic_model_id , catenax_site_id , function_valid_from , function_valid_until , validity_period_from , validity_period_to) values - (${assetAsPlannedId01}, 'H-LeftTailLight' , 'XT2309' , 'Xenon Left-Taillights' , 'OK' , 'C-Level' , 'OWN' , 'SERIALPART' , 'production', 'Hella' , '--', '5739525733343254979259249', 'urn:uuid:bd7b648a-29eb-46ba-8da2-3221463bf5e2', '2019-02-04T10:00:00', '2025-02-04T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), - (${assetAsPlannedId02}, 'H-RightTailLight', 'XT2310' , 'Xenon Right-Taillights' , 'OK' , 'C-Level' , 'OWN' , 'SERIALPART' , 'production', 'Hella' , '--', '3555795495432474727732252', 'urn:uuid:12c75a3b-b207-4415-b93a-3e0d1b3b145e', '2019-02-04T10:00:00', '2025-02-04T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), - (${assetAsPlannedId03}, 'O-LeftTailBulb' , 'LBT910' , 'Osram Rear Left-ZX500' , 'OK' , 'C-Level' , 'SUPPLIER', 'SERIALPART' , 'production', 'Osram' , '--', '7557973754595993573779235', 'urn:uuid:f4280b3f-01d3-4259-a3ee-b51b8748a0e3', '2019-02-04T10:00:00', '2025-02-04T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), - (${assetAsPlannedId04}, 'O-RightTailBulb' , 'LBT920' , 'Osram Rear Right-ZX500' , 'OK' , 'C-Level' , 'SUPPLIER', 'SERIALPART' , 'production', 'Osram' , '--', '7724524552224773742557429', 'urn:uuid:9751d1c3-a092-4e51-9ce2-c3353be307ff', '2019-02-04T10:00:00', '2025-02-04T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), - (${assetAsPlannedId05}, 'P-LeftTailBulb' , 'C4RPTL' , 'Phillips Rear Left-C4R' , 'OK' , 'C-Level' , 'SUPPLIER', 'SERIALPART' , 'production', 'Phillips' , '--', '7259534753592972592444239', 'urn:uuid:141499f8-5762-44dc-8d7f-0f598ff94208', '2019-02-04T10:00:00', '2025-02-04T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), - (${assetAsPlannedId06}, 'P-RightTailBulb' , 'C4RPTR' , 'Phillips Rear Right-C4R', 'OK' , 'C-Level' , 'SUPPLIER', 'SERIALPART' , 'production', 'Phillips' , '--', '4922952344449439397957339', 'urn:uuid:f8629534-ae9e-4350-8c0f-6874f88fca4e', '2019-02-04T10:00:00', '2025-02-04T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), - (${assetAsPlannedId07}, 'BMW-Z1' , 'Z1ABC' , 'Z1' , 'OK' , 'C-Level' , 'CUSTOMER', 'SERIALPART' , 'production', 'BMW AG' , '--', '7922333444399397355743927', 'urn:uuid:7368dd7a-f442-4124-b31f-ae48b67e966a', '2019-02-04T10:00:00', '2025-02-04T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), - (${assetAsPlannedId08}, 'BMW-Z4' , 'Z4ABC' , 'Z3' , 'OK' , 'C-Level' , 'CUSTOMER', 'SERIALPART' , 'production', 'BMW AG' , '--', '4943443393237449573773535', 'urn:uuid:47c8f2d5-472d-4a24-8772-b388603ef1b1', '2019-02-04T10:00:00', '2025-02-04T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), - (${assetAsPlannedId09}, 'Audi-A7' , 'A7XXX' , 'A7' , 'OK' , 'C-Level' , 'CUSTOMER', 'SERIALPART' , 'production', 'Audi AG' , '--', '9923399774344455937394339', 'urn:uuid:bf23b459-d3cc-445e-8839-3fe7f49d8cc5', '2019-02-04T10:00:00', '2025-02-04T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), - (${assetAsPlannedId10}, 'Audi-A8' , 'A8XXX' , 'A8' , 'OK' , 'C-Level' , 'CUSTOMER', 'SERIALPART' , 'production', 'Audi AG' , '--', '5422724375732744449977947', 'urn:uuid:28ddd434-fabc-4e82-bfe9-d2aab5d64251', '2019-02-04T10:00:00', '2025-02-04T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'); + (${assetAsPlannedId01}, 'H-LeftTailLight' , 'XT2309' , 'Xenon Left-Taillights' , 'OK' , 'C-Level' , 'OWN' , 'PARTASPLANNED' , 'production', 'Hella' , '--', '5739525733343254979259249', 'BPNL000000000001', '2019-03-04T10:00:00', '2025-03-04T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId02}, 'H-RightTailLight' , 'XT2310' , 'Xenon Right-Taillights' , 'OK' , 'C-Level' , 'OWN' , 'PARTASPLANNED' , 'production', 'Hella' , '--', '3555795495432474727732252', 'BPNL000000000001', '2019-03-04T16:00:00', '2025-03-04T16:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId03}, 'O-LeftTailBulb' , 'LBT910' , 'Osram Rear Left-ZX500' , 'OK' , 'C-Level' , 'SUPPLIER', 'PARTASPLANNED' , 'production', 'Osram' , '--', '7557973754595993573779235', 'BPNL000SUPPLIER1', '2019-02-05T10:00:00', '2025-02-05T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId04}, 'O-RightTailBulb' , 'LBT920' , 'Osram Rear Right-ZX500' , 'OK' , 'C-Level' , 'SUPPLIER', 'PARTASPLANNED' , 'production', 'Osram' , '--', '7724524552224773742557429', 'BPNL000SUPPLIER1', '2019-02-05T16:00:00', '2025-02-05T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId05}, 'P-LeftTailBulb' , 'C4RPTL' , 'Philips Rear Left-C4R' , 'OK' , 'C-Level' , 'SUPPLIER', 'PARTASPLANNED' , 'production', 'Philips' , '--', '7259534753592972592444239', 'BPNL000SUPPLIER2', '2019-02-08T10:00:00', '2025-02-08T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId06}, 'P-RightTailBulb' , 'C4RPTR' , 'Philips Rear Right-C4R' , 'OK' , 'C-Level' , 'SUPPLIER', 'PARTASPLANNED' , 'production', 'Philips' , '--', '4922952344449439397957339', 'BPNL000SUPPLIER2', '2019-02-08T10:00:00', '2025-02-08T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId07}, 'BMW-Z1' , 'Z1ABC' , 'Z1' , 'OK' , 'C-Level' , 'CUSTOMER', 'PARTASPLANNED' , 'production', 'BMW AG' , '--', '7922333444399397355743927', 'BPNL000CUSTOMER1', '2019-07-30T10:00:00', '2025-07-30T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId08}, 'BMW-Z4' , 'Z4ABC' , 'Z3' , 'OK' , 'C-Level' , 'CUSTOMER', 'PARTASPLANNED' , 'production', 'BMW AG' , '--', '4943443393237449573773535', 'BPNL000CUSTOMER1', '2019-07-31T10:00:00', '2025-07-31T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId09}, 'Audi-A7' , 'A7XXX' , 'A7' , 'OK' , 'C-Level' , 'CUSTOMER', 'PARTASPLANNED' , 'production', 'Audi AG' , '--', '9923399774344455937394339', 'BPNL000CUSTOMER2', '2019-08-10T10:00:00', '2025-08-10T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId10}, 'Audi-A8' , 'A8XXX' , 'A8' , 'OK' , 'C-Level' , 'CUSTOMER', 'PARTASPLANNED' , 'production', 'Audi AG' , '--', '5422724375732744449977947', 'BPNL000CUSTOMER2', '2019-08-10T10:00:00', '2025-08-10T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId11}, 'H-LeftTurningLight' , 'XH4713' , 'Left Turning Lights' , 'OK' , 'C-Level' , 'OWN' , 'PARTASPLANNED' , 'production', 'Hella' , '--', '9497103120176833301945729', 'BPNL000000000001', '2019-03-04T10:00:00', '2025-03-04T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId12}, 'H-RightTurningLight', 'XH4714' , 'Right Turning Lights' , 'OK' , 'C-Level' , 'OWN' , 'PARTASPLANNED' , 'production', 'Hella' , '--', '6804027053225747089496937', 'BPNL000000000001', '2019-03-04T16:00:00', '2025-03-04T16:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId13}, 'H-LeftBrakeLight' , 'XH4715' , 'Left Brake Lights' , 'OK' , 'C-Level' , 'OWN' , 'PARTASPLANNED' , 'production', 'Hella' , '--', '4761635332437340935030188', 'BPNL000000000001', '2019-03-05T10:00:00', '2025-03-05T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId14}, 'H-RightBrakeLight' , 'XH4716' , 'Right Brake Lights' , 'OK' , 'C-Level' , 'OWN' , 'PARTASPLANNED' , 'production', 'Hella' , '--', '7258414561754525565313752', 'BPNL000000000001', '2019-03-05T16:00:00', '2025-03-05T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId15}, 'H-LeftFogLight' , 'XH4717' , 'Left Fog Lights' , 'OK' , 'C-Level' , 'OWN' , 'PARTASPLANNED' , 'production', 'Hella' , '--', '2039029959807211381794213', 'BPNL000000000001', '2019-03-08T10:00:00', '2025-03-08T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId16}, 'H-RightFogLight' , 'XH4718' , 'Right Fog Lights' , 'OK' , 'C-Level' , 'OWN' , 'PARTASPLANNED' , 'production', 'Hella' , '--', '7453407329689001534982316', 'BPNL000000000001', '2019-03-08T10:00:00', '2025-03-08T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId17}, 'H-LeftHighBeam' , 'XH4719' , 'Left High Beam' , 'OK' , 'C-Level' , 'OWN' , 'PARTASPLANNED' , 'production', 'Hella' , '--', '7675764145648317995475091', 'BPNL000000000001', '2019-03-30T10:00:00', '2025-03-30T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId18}, 'H-RightHighBeam' , 'XH4720' , 'Right High Beam' , 'OK' , 'C-Level' , 'OWN' , 'PARTASPLANNED' , 'production', 'Hella' , '--', '3706347239409133257103018', 'BPNL000000000001', '2019-03-31T10:00:00', '2025-03-31T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId19}, 'O-TurningLight' , 'OTLB1' , 'Osram Turning Light Bulb' , 'OK' , 'C-Level' , 'SUPPLIER', 'PARTASPLANNED' , 'production', 'Osram' , '--', '2085860340477158419407610', 'BPNL000SUPPLIER1', '2019-02-10T10:00:00', '2025-02-10T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId20}, 'O-BrakeLight' , 'OBLB1' , 'Osram Brake Light Bulb' , 'OK' , 'C-Level' , 'SUPPLIER', 'PARTASPLANNED' , 'production', 'Osram' , '--', '9067830022928159098792041', 'BPNL000SUPPLIER1', '2019-02-10T10:00:00', '2025-02-10T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId21}, 'P-TurningLight' , 'PTLB1' , 'Philips Turning Light Bulb' , 'OK' , 'C-Level' , 'SUPPLIER', 'PARTASPLANNED' , 'production', 'Philips' , '--', '0756674361050961274380060', 'BPNL000SUPPLIER2', '2019-02-04T10:00:00', '2025-02-04T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId22}, 'P-BrakeLight' , 'PBLB1' , 'Philips Brake Light Bulb' , 'OK' , 'C-Level' , 'SUPPLIER', 'PARTASPLANNED' , 'production', 'Philips' , '--', '6577291375491729147886674', 'BPNL000SUPPLIER2', '2019-02-04T16:00:00', '2025-02-04T16:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId23}, 'W-FogLight' , 'WFLB1' , 'Würth Fog Light Bulb' , 'OK' , 'C-Level' , 'SUPPLIER', 'PARTASPLANNED' , 'production', 'Würth' , '--', '0662207279882485880581971', 'BPNL000SUPPLIER3', '2019-02-05T10:00:00', '2025-02-05T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId24}, 'W-HighBeam' , 'WHBB1' , 'Würth High Beam Bulb' , 'OK' , 'C-Level' , 'SUPPLIER', 'PARTASPLANNED' , 'production', 'Würth' , '--', '0468074420786359082535855', 'BPNL000SUPPLIER3', '2019-02-05T16:00:00', '2025-02-05T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId25}, 'BMW-X1' , 'X1ABC' , 'X1' , 'OK' , 'C-Level' , 'CUSTOMER', 'PARTASPLANNED' , 'production', 'BMW AG' , '--', '2909308002296183400800584', 'BPNL000CUSTOMER1', '2019-08-08T10:00:00', '2025-08-08T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId26}, 'BMW-X3' , 'X3ABC' , 'X3' , 'OK' , 'C-Level' , 'CUSTOMER', 'PARTASPLANNED' , 'production', 'BMW AG' , '--', '0926935142628387651207558', 'BPNL000CUSTOMER1', '2019-08-08T10:00:00', '2025-08-08T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId27}, 'Audi-Q7' , 'Q7XXX' , 'Q7' , 'OK' , 'C-Level' , 'CUSTOMER', 'PARTASPLANNED' , 'production', 'Audi AG' , '--', '4892854584899578888039556', 'BPNL000CUSTOMER2', '2019-08-30T10:00:00', '2025-08-30T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId28}, 'Audi-Q8' , 'Q8XXX' , 'Q8' , 'OK' , 'C-Level' , 'CUSTOMER', 'PARTASPLANNED' , 'production', 'Audi AG' , '--', '2846299600736237305284278', 'BPNL000CUSTOMER2', '2019-08-31T10:00:00', '2025-08-31T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId29}, 'VW-ID.4' , 'ID4YZ' , 'ID.4' , 'OK' , 'C-Level' , 'CUSTOMER', 'PARTASPLANNED' , 'production', 'VW AG' , '--', '2712617812070054607743714', 'BPNL000CUSTOMER3', '2019-08-10T10:00:00', '2025-08-10T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'), + (${assetAsPlannedId30}, 'VW-ID.5' , 'ID5YZ' , 'ID.5' , 'OK' , 'C-Level' , 'CUSTOMER', 'PARTASPLANNED' , 'production', 'VW AG' , '--', '0728960475743273447132197', 'BPNL000CUSTOMER3', '2019-08-10T10:00:00', '2025-08-10T10:00:00', '2022-02-04T08:00:00', '2024-02-04T08:00:00'); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__021_asset_as_planned_childs.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__021_asset_as_planned_childs.sql index fbe27f1e05..f3830a48a1 100644 --- a/tx-backend/src/main/resources/db/testdata/afterMigrate__021_asset_as_planned_childs.sql +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__021_asset_as_planned_childs.sql @@ -7,9 +7,9 @@ insert into assets_as_planned_childs values -- supplier is child of owner (${assetAsPlannedId03}, ${assetAsPlannedId01}, 'H-LeftTailLight'), -- Osram Rear Left-ZX500 isChildOf Xenon Left-Taillights - (${assetAsPlannedId05}, ${assetAsPlannedId01}, 'H-LeftTailLight'), -- Phillips Rear Left-C4R isChildOf Xenon Left-Taillights + (${assetAsPlannedId05}, ${assetAsPlannedId01}, 'H-LeftTailLight'), -- Philips Rear Left-C4R isChildOf Xenon Left-Taillights (${assetAsPlannedId04}, ${assetAsPlannedId02}, 'H-RightTailLight'), -- Osram Rear Right-ZX500 isChildOf Xenon Right-Taillights - (${assetAsPlannedId06}, ${assetAsPlannedId02}, 'H-RightTailLight'), -- Phillips Rear Right-C4R isChildOf Xenon Right-Taillights + (${assetAsPlannedId06}, ${assetAsPlannedId02}, 'H-RightTailLight'), -- Philips Rear Right-C4R isChildOf Xenon Right-Taillights -- owner is child of customer (${assetAsPlannedId01}, ${assetAsPlannedId09}, 'Audi-A7'), -- Xenon Left-Taillights isChildOf A7 diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__030_received_alert_on_as_built_received.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__030_received_alert_on_as_built_received.sql new file mode 100644 index 0000000000..7bf4b42a54 --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__030_received_alert_on_as_built_received.sql @@ -0,0 +1,40 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an alert in state RECEIVED in Severity Critical for asBuilt asset Osram Front Left-AX400 which is sent from BPNL000SUPPLIER1 to BPNL000000000001 + +--- +insert into alert + (id , bpn , close_reason, created , description , status , side , accept_reason, decline_reason, updated, error_message) +values + (${alertReceivedId1}, 'BPNL000SUPPLIER1', null , current_timestamp - interval '2 days', 'Alert about Left O Light Bulbs', 'RECEIVED', 'RECEIVER', null , null , null , null); + +--- +-- reset sequence to highest next-val +select setval('alert_id_seq', (select max(a.id) from alert a), true); + +--- +insert into alert_notification + (id , alert_id , contract_agreement_id, edc_url, notification_reference_id , created_by , send_to , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated, message_id , is_initial) +values + (${alertNotificationReceivedId1}, ${alertReceivedId1}, null , null , 'ded38f08-1b9c-497d-b994-6feba92b7f41', 'BPNL000SUPPLIER1', 'BPNL000000000001', current_timestamp + interval '1 month', 2 , 'Osram' , 'Hella' , 'ded38f08-1b9c-497d-b994-6feba92b7f41', 2 , current_timestamp - interval '1 day', null , '7d0891d2-4940-4802-b0bc-cc30f9e94e76', false); + +--- +-- join notification to asset +insert into asset_as_built_alert_notifications + (alert_notification_id , asset_id) +values + (${alertNotificationReceivedId1}, ${assetAsBuiltId03}); + +--- +-- join alert to asset +insert into assets_as_built_alerts + (alert_id , asset_id) +values + (${alertReceivedId1}, ${assetAsBuiltId03}); + +--- +update assets_as_built + set active_alert = true + where id in (${assetAsBuiltId03}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__031_received_alert_on_as_build_receive.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__031_received_alert_on_as_build_receive.sql deleted file mode 100644 index e7baae90a1..0000000000 --- a/tx-backend/src/main/resources/db/testdata/afterMigrate__031_received_alert_on_as_build_receive.sql +++ /dev/null @@ -1,40 +0,0 @@ --- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied --- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). --- it is only intended for usage in local or test environments - --- This creates an alert in state RECEIVED in Severity Critical for asBuilt asset Osram Front Left-AX400 which is sent from BPNL000SUPPLIER1 to BPNL000000000001 - ---- -insert into alert - (id , bpn , close_reason, created , description , status , side , accept_reason, decline_reason, updated, error_message) -values - (${alertId1}, 'BPNL000SUPPLIER1', null , current_timestamp - interval '2 days', 'Alert about Left O Light Bulbs', 'RECEIVED', 'RECEIVER', null , null , null , null); - ---- --- reset sequence to highest next-val -select setval('alert_id_seq', (select max(a.id) from alert a), true); - ---- -insert into alert_notification - (id , alert_id , contract_agreement_id, edc_url, notification_reference_id , created_by , send_to , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated, message_id , is_initial) -values - (${alertNotificationId1}, ${alertId1}, null , null , 'ded38f08-1b9c-497d-b994-6feba92b7f41', 'BPNL000SUPPLIER1', 'BPNL000000000001', current_timestamp + interval '1 month', 2 , 'Osram' , 'Hella' , 'ded38f08-1b9c-497d-b994-6feba92b7f41', '2' , current_timestamp - interval '1 day', null , '7d0891d2-4940-4802-b0bc-cc30f9e94e76', false); - ---- --- join notification to asset -insert into asset_as_built_alert_notifications - (alert_notification_id , asset_id) -values - (${alertNotificationId1}, ${assetAsBuiltId03}); - ---- --- join alert to asset -insert into assets_as_built_alerts - (alert_id , asset_id) -values - (${alertId1}, ${assetAsBuiltId03}); - ---- -update assets_as_built - set active_alert = true - where id in (${assetAsBuiltId03}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__031_received_alert_on_as_built_acknowledged.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__031_received_alert_on_as_built_acknowledged.sql new file mode 100644 index 0000000000..d24e3d45e5 --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__031_received_alert_on_as_built_acknowledged.sql @@ -0,0 +1,56 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an alert in state ACKNOWLEDGED with Severity Life threatening for asBuilt asset Philips Front Right-D3H which is sent from BPNL000SUPPLIER2 to BPNL000000000001 + +--- +insert into alert + (id , bpn , close_reason, created , description , status , side , accept_reason, decline_reason, updated, error_message) +values + (${alertReceivedId2}, 'BPNL000SUPPLIER2', null , current_timestamp - interval '3 days', 'Alert about Right P Light Bulbs', 'ACKNOWLEDGED', 'RECEIVER', null , null , null , null); + +--- +-- reset sequence to highest next-val +select setval('alert_id_seq', (select max(a.id) from alert a), true); + +--- +-- initial message +insert into alert_notification + (id , alert_id , contract_agreement_id, edc_url, notification_reference_id , created_by , send_to , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${alertNotificationReceivedId2a}, ${alertReceivedId2}, null , null , 'cc49777f-3c8b-47d6-b1cf-f51783737292', 'BPNL000SUPPLIER2', 'BPNL000000000001', current_timestamp + interval '1 month', 3 , 'Philips' , 'Hella' , 'cc49777f-3c8b-47d6-b1cf-f51783737292', 2 , current_timestamp - interval '2 days', current_timestamp, '68ebeb5f-158d-480e-b466-24304842c22c', false); + +--- +-- join initial notification to asset +insert into asset_as_built_alert_notifications + (alert_notification_id , asset_id) +values + (${alertNotificationReceivedId2a}, ${assetAsBuiltId06}); + +--- +-- join alert to asset +insert into assets_as_built_alerts + (alert_id , asset_id) +values + (${alertReceivedId2}, ${assetAsBuiltId06}); + +--- +update assets_as_built + set active_alert = true + where id in (${assetAsBuiltId06}); + +--- +--- +-- ACK by receiver notification message +insert into alert_notification + (id , alert_id , contract_agreement_id, edc_url , notification_reference_id , created_by , send_to , target_date , severity , created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${alertNotificationReceivedId2b}, ${alertReceivedId2}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', 'cc49777f-3c8b-47d6-b1cf-f51783737292', 'BPNL000000000001', 'BPNL000SUPPLIER2', current_timestamp + interval '1 month', 3 , 'Hella' , 'Philips' , 'cc49777f-3c8b-47d6-b1cf-f51783737292', 3 , current_timestamp - interval '12 hours' , current_timestamp - interval '12 hours', 'f305046d-333a-4d44-ba3e-9a4ef1337ba6', false); + +--- +-- join ACK notification to asset +insert into asset_as_built_alert_notifications + (alert_notification_id , asset_id) +values + (${alertNotificationReceivedId2b}, ${assetAsBuiltId06}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__032_received_alert_on_as_build_acknowledge.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__032_received_alert_on_as_build_acknowledge.sql deleted file mode 100644 index 97d2cc36e4..0000000000 --- a/tx-backend/src/main/resources/db/testdata/afterMigrate__032_received_alert_on_as_build_acknowledge.sql +++ /dev/null @@ -1,56 +0,0 @@ --- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied --- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). --- it is only intended for usage in local or test environments - --- This creates an alert in state ACKNOWLEDGED with Severity Life threatening for asBuilt asset Phillips Front Right-D3H which is sent from BPNL000SUPPLIER2 to BPNL000000000001 - ---- -insert into alert - (id , bpn , close_reason, created , description , status , side , accept_reason, decline_reason, updated, error_message) -values - (${alertId2}, 'BPNL000SUPPLIER2', null , current_timestamp - interval '3 days', 'Alert about Right P Light Bulbs', 'ACKNOWLEDGED', 'RECEIVER', null , null , null , null); - ---- --- reset sequence to highest next-val -select setval('alert_id_seq', (select max(a.id) from alert a), true); - ---- --- initial message -insert into alert_notification - (id , alert_id , contract_agreement_id, edc_url, notification_reference_id , created_by , send_to , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) -values - (${alertNotificationId2a}, ${alertId2}, null , null , 'cc49777f-3c8b-47d6-b1cf-f51783737292', 'BPNL000SUPPLIER2', 'BPNL000000000001', current_timestamp + interval '1 month', 3 , 'Osram' , 'Hella' , 'cc49777f-3c8b-47d6-b1cf-f51783737292', '2' , current_timestamp - interval '1 day', current_timestamp, '68ebeb5f-158d-480e-b466-24304842c22c', false); - ---- --- join initial notification to asset -insert into asset_as_built_alert_notifications - (alert_notification_id , asset_id) -values - (${alertNotificationId2a}, ${assetAsBuiltId03}); - ---- --- join alert to asset -insert into assets_as_built_alerts - (alert_id , asset_id) -values - (${alertId2}, ${assetAsBuiltId06}); - ---- -update assets_as_built - set active_alert = true - where id in (${assetAsBuiltId03}); - ---- ---- --- ACK by receiver notification message -insert into alert_notification - (id , alert_id , contract_agreement_id, edc_url , notification_reference_id , created_by , send_to , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) -values - (${alertNotificationId2b}, ${alertId2}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', 'cc49777f-3c8b-47d6-b1cf-f51783737292', 'BPNL000000000001', 'BPNL000SUPPLIER2', current_timestamp + interval '1 month', 3 , 'Osram' , 'Hella' , 'cc49777f-3c8b-47d6-b1cf-f51783737292', '3' , current_timestamp - interval '12 hours', current_timestamp - interval '12 hours', 'f305046d-333a-4d44-ba3e-9a4ef1337ba6', false); - ---- --- join ACK notification to asset -insert into asset_as_built_alert_notifications - (alert_notification_id , asset_id) -values - (${alertNotificationId2b}, ${assetAsBuiltId03}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__032_received_alert_on_as_built_accepted.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__032_received_alert_on_as_built_accepted.sql new file mode 100644 index 0000000000..c8920dd2e0 --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__032_received_alert_on_as_built_accepted.sql @@ -0,0 +1,56 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an alert in state ACCEPTED with Severity Minor for asBuilt asset Philips P-TurningLight which is sent from BPNL000SUPPLIER2 to BPNL000000000001 + +--- +insert into alert + (id , bpn , close_reason, created , description , status , side , accept_reason, decline_reason, updated, error_message) +values + (${alertReceivedId3}, 'BPNL000SUPPLIER2', null , current_timestamp - interval '4 days', 'Alert about P-TurningLight', 'ACCEPTED', 'RECEIVER', 'Part has been replaced' , null , null , null); + +--- +-- reset sequence to highest next-val +select setval('alert_id_seq', (select max(a.id) from alert a), true); + +--- +-- initial message +insert into alert_notification + (id , alert_id , contract_agreement_id, edc_url, notification_reference_id , created_by , send_to , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${alertNotificationReceivedId3a}, ${alertReceivedId3}, null , null , 'cc49777f-3c8b-47d6-b1cf-f51783737292', 'BPNL000SUPPLIER2', 'BPNL000000000001', current_timestamp + interval '1 month', 0 , 'Philips' , 'Hella' , 'cc49777f-3c8b-47d6-b1cf-f51783737292', 2 , current_timestamp - interval '3 days', current_timestamp, '68ebeb5f-158d-480e-b466-24304842c22c', false); + +--- +-- join initial notification to asset +insert into asset_as_built_alert_notifications + (alert_notification_id , asset_id) +values + (${alertNotificationReceivedId3a}, ${assetAsBuiltId21}); + +--- +-- join alert to asset +insert into assets_as_built_alerts + (alert_id , asset_id) +values + (${alertReceivedId3}, ${assetAsBuiltId21}); + +--- +update assets_as_built + set active_alert = true + where id in (${assetAsBuiltId21}); + +--- +--- +-- ACCEPTED by receiver notification message +insert into alert_notification + (id , alert_id , contract_agreement_id, edc_url , notification_reference_id , created_by , send_to , target_date , severity , created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${alertNotificationReceivedId3b}, ${alertReceivedId3}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', 'cc49777f-3c8b-47d6-b1cf-f51783737292', 'BPNL000000000001', 'BPNL000SUPPLIER2', current_timestamp + interval '1 month', 0 , 'Hella' , 'Philips' , 'cc49777f-3c8b-47d6-b1cf-f51783737292', 4 , current_timestamp - interval '12 hours', current_timestamp - interval '12 hours', 'f305046d-333a-4d44-ba3e-9a4ef1337ba6', false); + +--- +-- join ACCEPTED notification to asset +insert into asset_as_built_alert_notifications + (alert_notification_id , asset_id) +values + (${alertNotificationReceivedId3b}, ${assetAsBuiltId21}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__033_received_alert_on_as_built_declined.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__033_received_alert_on_as_built_declined.sql new file mode 100644 index 0000000000..77f22df47a --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__033_received_alert_on_as_built_declined.sql @@ -0,0 +1,56 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an alert in state DECLINED with Severity Major for asBuilt asset Würth W-FogLight which is sent from BPNL000SUPPLIER3 to BPNL000000000001 + +--- +insert into alert + (id , bpn , close_reason, created , description , status , side , accept_reason, decline_reason, updated, error_message) +values + (${alertReceivedId4}, 'BPNL000SUPPLIER3', null , current_timestamp - interval '5 days', 'Alert about W-FogLight' , 'DECLINED', 'RECEIVER', null , 'Not relevant for us' , null , null); + +--- +-- reset sequence to highest next-val +select setval('alert_id_seq', (select max(a.id) from alert a), true); + +--- +-- initial message +insert into alert_notification + (id , alert_id , contract_agreement_id, edc_url, notification_reference_id , created_by , send_to , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${alertNotificationReceivedId4a}, ${alertReceivedId4}, null , null , 'cc49777f-3c8b-47d6-b1cf-f51783737292', 'BPNL000SUPPLIER3', 'BPNL000000000001', current_timestamp + interval '1 month', 1 , 'Würth' , 'Hella' , 'cc49777f-3c8b-47d6-b1cf-f51783737292', 2 , current_timestamp - interval '4 days', current_timestamp, '68ebeb5f-158d-480e-b466-24304842c22c', false); + +--- +-- join initial notification to asset +insert into asset_as_built_alert_notifications + (alert_notification_id , asset_id) +values + (${alertNotificationReceivedId4a}, ${assetAsBuiltId23}); + +--- +-- join alert to asset +insert into assets_as_built_alerts + (alert_id , asset_id) +values + (${alertReceivedId4}, ${assetAsBuiltId23}); + +--- +update assets_as_built + set active_alert = true + where id in (${assetAsBuiltId23}); + +--- +--- +-- DECLINED by receiver notification message +insert into alert_notification + (id , alert_id , contract_agreement_id, edc_url , notification_reference_id , created_by , send_to , target_date , severity , created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${alertNotificationReceivedId4b}, ${alertReceivedId4}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', 'cc49777f-3c8b-47d6-b1cf-f51783737292', 'BPNL000000000001', 'BPNL000SUPPLIER3', current_timestamp + interval '1 month', 1 , 'Hella' , 'Würth' , 'cc49777f-3c8b-47d6-b1cf-f51783737292', 4 , current_timestamp - interval '12 hours', current_timestamp - interval '12 hours', 'f305046d-333a-4d44-ba3e-9a4ef1337ba6', false); + +--- +-- join DECLINED notification to asset +insert into asset_as_built_alert_notifications + (alert_notification_id , asset_id) +values + (${alertNotificationReceivedId4b}, ${assetAsBuiltId23}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__034_received_alert_on_as_built_closed.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__034_received_alert_on_as_built_closed.sql new file mode 100644 index 0000000000..8486d2df7e --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__034_received_alert_on_as_built_closed.sql @@ -0,0 +1,56 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an alert in state CLOSED with Severity Critical for asBuilt asset Philips P-BrakeLight which is sent from BPNL000SUPPLIER2 to BPNL000000000001 + +--- +insert into alert + (id , bpn , close_reason, created , description , status , side , accept_reason, decline_reason, updated, error_message) +values + (${alertReceivedId5}, 'BPNL000SUPPLIER2', 'Issue has been resolved' , current_timestamp - interval '6 days', 'Alert about P-BrakeLight' , 'CLOSED', 'RECEIVER', null , null , null , null); + +--- +-- reset sequence to highest next-val +select setval('alert_id_seq', (select max(a.id) from alert a), true); + +--- +-- initial message +insert into alert_notification + (id , alert_id , contract_agreement_id, edc_url, notification_reference_id , created_by , send_to , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${alertNotificationReceivedId5a}, ${alertReceivedId5}, null , null , 'cc49777f-3c8b-47d6-b1cf-f51783737292', 'BPNL000SUPPLIER2', 'BPNL000000000001', current_timestamp + interval '1 month', 2 , 'Philips' , 'Hella' , 'cc49777f-3c8b-47d6-b1cf-f51783737292', 7 , current_timestamp - interval '5 days', current_timestamp, '68ebeb5f-158d-480e-b466-24304842c22c', false); + +--- +-- join initial notification to asset +insert into asset_as_built_alert_notifications + (alert_notification_id , asset_id) +values + (${alertNotificationReceivedId5a}, ${assetAsBuiltId22}); + +--- +-- join alert to asset +insert into assets_as_built_alerts + (alert_id , asset_id) +values + (${alertReceivedId5}, ${assetAsBuiltId22}); + +--- +update assets_as_built + set active_alert = false + where id in (${assetAsBuiltId22}); + +--- +--- +-- CLOSED by sender notification message +insert into alert_notification + (id , alert_id , contract_agreement_id, edc_url , notification_reference_id , created_by , send_to , target_date , severity , created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${alertNotificationReceivedId5b}, ${alertReceivedId5}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', 'cc49777f-3c8b-47d6-b1cf-f51783737292', 'BPNL000SUPPLIER2', 'BPNL000000000001', current_timestamp + interval '1 month', 2 , 'Philips' , 'Hella' , 'cc49777f-3c8b-47d6-b1cf-f51783737292', 7 , current_timestamp - interval '12 hours', current_timestamp - interval '12 hours', 'f305046d-333a-4d44-ba3e-9a4ef1337ba6', false); + +--- +-- join CLOSED notification to asset +insert into asset_as_built_alert_notifications + (alert_notification_id , asset_id) +values + (${alertNotificationReceivedId5b}, ${assetAsBuiltId22}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__035_send_alert_on_as_build_created.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__040_sent_alert_on_as_built_created.sql similarity index 65% rename from tx-backend/src/main/resources/db/testdata/afterMigrate__035_send_alert_on_as_build_created.sql rename to tx-backend/src/main/resources/db/testdata/afterMigrate__040_sent_alert_on_as_built_created.sql index 4aa21ef1b1..4cbae76ee2 100644 --- a/tx-backend/src/main/resources/db/testdata/afterMigrate__035_send_alert_on_as_build_created.sql +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__040_sent_alert_on_as_built_created.sql @@ -4,16 +4,11 @@ -- This creates an alert in state CREATED with Severity Minor for asBuilt asset Left Headlights which is sent from BPNL000000000001 to BPNL000CUSTOMER1 -insert into asset_as_built_alert_notifications - (alert_notification_id , asset_id) -values - (${alertNotificationId2b}, ${assetAsBuiltId03}); - --- insert into alert (id , bpn , close_reason, created , description , status , side , accept_reason, decline_reason, updated, error_message) values - (${alertId3}, 'BPNL000000000001 ', null , current_timestamp, 'Alert about Left Headlights', 'CREATED', 'SENDER', null , null , null , null); + (${alertSentId1}, 'BPNL000000000001', null , current_timestamp, 'Second Alert about Left Headlights', 'CREATED', 'SENDER', null , null , null , null); --- -- reset sequence to highest next-val @@ -24,21 +19,21 @@ select setval('alert_id_seq', (select max(a.id) from alert a), true); insert into alert_notification (id , alert_id , contract_agreement_id, edc_url, notification_reference_id, created_by , send_to , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) values - (${alertNotificationId3}, ${alertId3}, null , null , 'null' , 'BPNL000000000001', 'BPNL000CUSTOMER1', current_timestamp + interval '1 month', 0 , 'Hella' , 'BMW AG' , ${alertNotificationId3}, 0 , current_timestamp - interval '1 seconds', current_timestamp, '42e28782-bf4c-45a2-82b7-1757aa4b8772', true); + (${alertNotificationSentId1}, ${alertSentId1}, null , null , 'null' , 'BPNL000000000001', 'BPNL000CUSTOMER1', current_timestamp + interval '1 month', 0 , 'Hella' , 'BMW AG' , ${alertNotificationSentId1}, 0 , current_timestamp - interval '1 seconds', current_timestamp, '42e28782-bf4c-45a2-82b7-1757aa4b8772', true); --- -- join initial notification to asset insert into asset_as_built_alert_notifications (alert_notification_id , asset_id) values - (${alertNotificationId3}, ${assetAsBuiltId01}); + (${alertNotificationSentId1}, ${assetAsBuiltId01}); --- -- join alert to asset insert into assets_as_built_alerts (alert_id , asset_id) values - (${alertId3}, ${assetAsBuiltId01}); + (${alertSentId1}, ${assetAsBuiltId01}); --- update assets_as_built diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__041_received_investigation_on_as_build_receive.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__041_received_investigation_on_as_build_receive.sql deleted file mode 100644 index 88a6d81fca..0000000000 --- a/tx-backend/src/main/resources/db/testdata/afterMigrate__041_received_investigation_on_as_build_receive.sql +++ /dev/null @@ -1,40 +0,0 @@ --- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied --- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). --- it is only intended for usage in local or test environments - --- This creates an investigation in state RECEIVED in Severity Major for asBuilt asset Xenon Left-Headlights which is sent from BPNL000CUSTOMER1 to BPNL000000000001 - ---- -insert into investigation - (id , bpn , close_reason, created , description , status , side , accept_reason, decline_reason, updated, error_message) -values - (${investigationId1}, 'BPNL000CUSTOMER1', null , current_timestamp - interval '2 hours', 'Investigation on Xenon Left-Headlights due to malfunction.', 'RECEIVED', 'RECEIVER', null , null , null , null); - ---- --- reset sequence to highest next-val -select setval('investigation_id_seq', (select max(i.id) from investigation i), true); - ---- -insert into investigation_notification - (id , contract_agreement_id, edc_url, notification_reference_id , send_to , created_by , investigation_id , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) -values - (${investigationNotificationId1}, null , null , '8925f21f-09eb-4789-81fb-ec221e9e1561', 'BPNL000000000001', 'BPNL000CUSTOMER1', ${investigationId1}, current_timestamp + interval '1 week', 1 , 'BMW AG' , 'Hella' , '8925f21f-09eb-4789-81fb-ec221e9e1561', '2' , current_timestamp - interval '2 hours', current_timestamp - interval '2 hours', 'e04f75e8-d37b-42e4-8cf7-6127f35f3ed5', false); - ---- --- join investigation to asset -insert into assets_as_built_notifications - (notification_id , asset_id) -values - (${investigationNotificationId1}, ${assetAsBuiltId01}); - ---- --- join investigation to asset -insert into assets_as_built_investigations - (investigation_id , asset_id) -values - (${investigationId1}, ${assetAsBuiltId01}); - ---- -update assets_as_built - set in_investigation = true - where id in (${assetAsBuiltId01}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__036_send_alert_on_as_build_sent.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__041_sent_alert_on_as_built_sent.sql similarity index 67% rename from tx-backend/src/main/resources/db/testdata/afterMigrate__036_send_alert_on_as_build_sent.sql rename to tx-backend/src/main/resources/db/testdata/afterMigrate__041_sent_alert_on_as_built_sent.sql index db9568bcee..a36bf818eb 100644 --- a/tx-backend/src/main/resources/db/testdata/afterMigrate__036_send_alert_on_as_build_sent.sql +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__041_sent_alert_on_as_built_sent.sql @@ -8,7 +8,7 @@ insert into alert (id , bpn , close_reason, created , description , status, side , accept_reason, decline_reason, updated , error_message) values - (${alertId4}, 'BPNL000000000001 ', null , current_timestamp, 'Alert about Left Headlights', 'SENT', 'SENDER', null , null , current_timestamp, null); + (${alertSentId2}, 'BPNL000000000001', null , current_timestamp - interval '1 day', 'First Alert about Left Headlights', 'SENT', 'SENDER', null , null , current_timestamp, null); --- -- reset sequence to highest next-val @@ -19,21 +19,21 @@ select setval('alert_id_seq', (select max(a.id) from alert a), true); insert into alert_notification (id , alert_id , contract_agreement_id, edc_url , notification_reference_id, created_by , send_to , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) values - (${alertNotificationId4}, ${alertId4}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', 'null' , 'BPNL000000000001', 'BPNL000CUSTOMER1', current_timestamp + interval '1 month', 1 , 'Hella' , 'BMW AG' , ${alertNotificationId4}, 0 , current_timestamp - interval '2 seconds', current_timestamp, '2cf84b7c-5e42-46f2-8869-12b053b9a276', true); + (${alertNotificationSentId2}, ${alertSentId2}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', 'null' , 'BPNL000000000001', 'BPNL000CUSTOMER1', current_timestamp + interval '1 week', 1 , 'Hella' , 'BMW AG' , ${alertNotificationSentId2}, 0 , current_timestamp - interval '1 day', current_timestamp, '2cf84b7c-5e42-46f2-8869-12b053b9a276', true); --- -- join initial notification to asset insert into asset_as_built_alert_notifications (alert_notification_id , asset_id) values - (${alertNotificationId4}, ${assetAsBuiltId01}); + (${alertNotificationSentId2}, ${assetAsBuiltId01}); --- -- join alert to asset insert into assets_as_built_alerts (alert_id , asset_id) values - (${alertId4}, ${assetAsBuiltId01}); + (${alertSentId2}, ${assetAsBuiltId01}); --- update assets_as_built diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__042_received_investigation_on_as_build_acknowledge.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__042_received_investigation_on_as_build_acknowledge.sql deleted file mode 100644 index d58ca6ed2b..0000000000 --- a/tx-backend/src/main/resources/db/testdata/afterMigrate__042_received_investigation_on_as_build_acknowledge.sql +++ /dev/null @@ -1,55 +0,0 @@ --- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied --- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). --- it is only intended for usage in local or test environments - --- This creates an investigation in state ACKNOWLEDGED in Severity Minor for asBuilt asset Xenon Right-Headlights which is sent from BPNL000CUSTOMER1 to BPNL000000000001 - ---- -insert into investigation - (id , bpn , close_reason, created , description , status , side , accept_reason, decline_reason, updated , error_message) -values - (${investigationId2}, 'BPNL000CUSTOMER1', null , current_timestamp - interval '2 hours', 'Investigation on Xenon Right-Headlights due to malfunction.', 'ACKNOWLEDGED', 'RECEIVER', null , null , current_timestamp - interval '1 hours', null); - ---- --- reset sequence to highest next-val -select setval('investigation_id_seq', (select max(i.id) from investigation i), true); - ---- -insert into investigation_notification - (id , contract_agreement_id, edc_url, notification_reference_id , send_to , created_by , investigation_id , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) -values - (${investigationNotificationId2a}, null , null , '8925f21f-09eb-4789-81fb-ec221e9e1561', 'BPNL000000000001', 'BPNL000CUSTOMER1', ${investigationId2}, current_timestamp + interval '1 week', 0 , 'BMW AG' , 'Hella' , '8925f21f-09eb-4789-81fb-ec221e9e1561', '2' , current_timestamp - interval '2 hours', current_timestamp - interval '2 hours', 'e04f75e8-d37b-42e4-8cf7-6127f35f3ed5', false); - ---- --- join investigation to asset -insert into assets_as_built_notifications - (notification_id , asset_id) -values - (${investigationNotificationId2a}, ${assetAsBuiltId02}); - ---- --- join investigation to asset -insert into assets_as_built_investigations - (investigation_id , asset_id) -values - (${investigationId2}, ${assetAsBuiltId02}); - ---- -update assets_as_built - set in_investigation = true - where id in (${assetAsBuiltId02}); - ---- ---- --- ACK by receiver notification message -insert into investigation_notification - (id , contract_agreement_id, edc_url , notification_reference_id, send_to , created_by , investigation_id , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) -values - (${investigationNotificationId2b}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', null , 'BPNL000CUSTOMER1', 'BPNL000000000001', ${investigationId2}, current_timestamp + interval '1 week', 1 , 'Hella' , 'BMW AG' , '8925f21f-09eb-4789-81fb-ec221e9e1561', '3' , current_timestamp - interval '2 hours', current_timestamp - interval '1 hour', '207ba6cf-217b-401d-a5da-69cac8b154a5', false); - ---- --- join ACK notification to asset -insert into assets_as_built_notifications - (notification_id , asset_id) -values - (${investigationNotificationId2b}, ${assetAsBuiltId02}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__042_sent_alert_on_as_built_acknowledged.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__042_sent_alert_on_as_built_acknowledged.sql new file mode 100644 index 0000000000..24184480d9 --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__042_sent_alert_on_as_built_acknowledged.sql @@ -0,0 +1,55 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an alert in state ACKNOWLEDGED with Severity Life-threatening for asBuilt asset Brake lights left which is sent from BPNL000000000001 to BPNL000CUSTOMER2 + +--- +insert into alert + (id , bpn , close_reason, created , description , status, side , accept_reason, decline_reason, updated , error_message) +values + (${alertSentId3}, 'BPNL000000000001', null , current_timestamp - interval '1 day', 'Alert about Brake lights left', 'ACKNOWLEDGED', 'SENDER', null , null , current_timestamp, null); + +--- +-- reset sequence to highest next-val +select setval('alert_id_seq', (select max(a.id) from alert a), true); + +--- +-- initial message +insert into alert_notification + (id , alert_id , contract_agreement_id, edc_url , notification_reference_id, created_by , send_to , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${alertNotificationSentId3a}, ${alertSentId3}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', 'null' , 'BPNL000000000001', 'BPNL000CUSTOMER2', current_timestamp + interval '1 day', 3 , 'Hella' , 'Audi AG' , ${alertNotificationSentId3a}, 0 , current_timestamp - interval '1 day', current_timestamp, '2cf84b7c-5e42-46f2-8869-12b053b9a276', true); + +--- +-- join initial notification to asset +insert into asset_as_built_alert_notifications + (alert_notification_id , asset_id) +values + (${alertNotificationSentId3a}, ${assetAsBuiltId13}); + +--- +-- join alert to asset +insert into assets_as_built_alerts + (alert_id , asset_id) +values + (${alertSentId3}, ${assetAsBuiltId13}); + +--- +update assets_as_built + set active_alert = true + where id in (${assetAsBuiltId13}); + +--- +-- ACK by receiver notification message +insert into alert_notification + (id , alert_id , contract_agreement_id, edc_url , notification_reference_id , created_by , send_to , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${alertNotificationSentId3b}, ${alertSentId3}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', 'cc49777f-3c8b-47d6-b1cf-f51783737292', 'BPNL000CUSTOMER2', 'BPNL000000000001', current_timestamp + interval '1 day', 3 , 'Audi AG' , 'Hella' , 'cc49777f-3c8b-47d6-b1cf-f51783737292', 3 , current_timestamp - interval '12 hours', current_timestamp - interval '12 hours', 'f305046d-333a-4d44-ba3e-9a4ef1337ba6', false); + +--- +-- join ACK notification to asset +insert into asset_as_built_alert_notifications + (alert_notification_id , asset_id) +values + (${alertNotificationSentId3b}, ${assetAsBuiltId13}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__043_sent_alert_on_as_built_accepted.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__043_sent_alert_on_as_built_accepted.sql new file mode 100644 index 0000000000..744521d68b --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__043_sent_alert_on_as_built_accepted.sql @@ -0,0 +1,55 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an alert in state ACCEPTED with Severity Minor for asBuilt asset Turning lights left which is sent from BPNL000000000001 to BPNL000CUSTOMER2 + +--- +insert into alert + (id , bpn , close_reason, created , description , status , side , accept_reason , decline_reason, updated , error_message) +values + (${alertSentId4}, 'BPNL000000000001', null , current_timestamp - interval '5 days', 'Alert about Turning lights left', 'ACCEPTED', 'SENDER', 'Thanks for letting us know. We''ll check' , null , current_timestamp, null); + +--- +-- reset sequence to highest next-val +select setval('alert_id_seq', (select max(a.id) from alert a), true); + +--- +-- initial message +insert into alert_notification + (id , alert_id , contract_agreement_id, edc_url , notification_reference_id, created_by , send_to , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${alertNotificationSentId4a}, ${alertSentId4}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', 'null' , 'BPNL000000000001', 'BPNL000CUSTOMER2', current_timestamp + interval '1 month', 0 , 'Hella' , 'Audi AG' , ${alertNotificationSentId4a}, 0 , current_timestamp - interval '5 days', current_timestamp, '2cf84b7c-5e42-46f2-8869-12b053b9a276', true); + +--- +-- join initial notification to asset +insert into asset_as_built_alert_notifications + (alert_notification_id , asset_id) +values + (${alertNotificationSentId4a}, ${assetAsBuiltId13}); + +--- +-- join alert to asset +insert into assets_as_built_alerts + (alert_id , asset_id) +values + (${alertSentId4}, ${assetAsBuiltId13}); + +--- +update assets_as_built + set active_alert = true + where id in (${assetAsBuiltId13}); + +--- +-- ACCEPTED by receiver notification message +insert into alert_notification + (id , alert_id , contract_agreement_id, edc_url , notification_reference_id , created_by , send_to , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${alertNotificationSentId4b}, ${alertSentId4}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', 'cc49777f-3c8b-47d6-b1cf-f51783737292', 'BPNL000CUSTOMER2', 'BPNL000000000001', current_timestamp + interval '1 month', 0 , 'Audi AG' , 'Hella' , 'cc49777f-3c8b-47d6-b1cf-f51783737292', 4 , current_timestamp - interval '3 days', current_timestamp, 'f305046d-333a-4d44-ba3e-9a4ef1337ba6', false); + +--- +-- join ACCEPTED notification to asset +insert into asset_as_built_alert_notifications + (alert_notification_id , asset_id) +values + (${alertNotificationSentId4b}, ${assetAsBuiltId13}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__044_sent_alert_on_as_built_declined.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__044_sent_alert_on_as_built_declined.sql new file mode 100644 index 0000000000..f66189488e --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__044_sent_alert_on_as_built_declined.sql @@ -0,0 +1,55 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an alert in state DECLINED with Severity Major for asBuilt asset High beam left which is sent from BPNL000000000001 to BPNL000CUSTOMER3 + +--- +insert into alert + (id , bpn , close_reason, created , description , status , side , accept_reason, decline_reason, updated , error_message) +values + (${alertSentId5}, 'BPNL000000000001', null , current_timestamp - interval '4 days', 'Alert about High beam left', 'DECLINED', 'SENDER', null , 'Thanks, but this doesn''t affect us' , current_timestamp, null); + +--- +-- reset sequence to highest next-val +select setval('alert_id_seq', (select max(a.id) from alert a), true); + +--- +-- initial message +insert into alert_notification + (id , alert_id , contract_agreement_id, edc_url , notification_reference_id, created_by , send_to , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${alertNotificationSentId5a}, ${alertSentId5}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', 'null' , 'BPNL000000000001', 'BPNL000CUSTOMER3', current_timestamp + interval '2 weeks', 1 , 'Hella' , 'VW AG' , ${alertNotificationSentId5a}, 0 , current_timestamp - interval '4 days', current_timestamp, '2cf84b7c-5e42-46f2-8869-12b053b9a276', true); + +--- +-- join initial notification to asset +insert into asset_as_built_alert_notifications + (alert_notification_id , asset_id) +values + (${alertNotificationSentId5a}, ${assetAsBuiltId17}); + +--- +-- join alert to asset +insert into assets_as_built_alerts + (alert_id , asset_id) +values + (${alertSentId5}, ${assetAsBuiltId17}); + +--- +update assets_as_built + set active_alert = true + where id in (${assetAsBuiltId17}); + +--- +-- DECLINED by receiver notification message +insert into alert_notification + (id , alert_id , contract_agreement_id, edc_url , notification_reference_id , created_by , send_to , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${alertNotificationSentId5b}, ${alertSentId5}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', 'cc49777f-3c8b-47d6-b1cf-f51783737292', 'BPNL000CUSTOMER3', 'BPNL000000000001', current_timestamp + interval '2 weeks', 1 , 'VW AG' , 'Hella' , 'cc49777f-3c8b-47d6-b1cf-f51783737292', 5 , current_timestamp - interval '2 days', current_timestamp - interval '12 hours', 'f305046d-333a-4d44-ba3e-9a4ef1337ba6', false); + +--- +-- join DECLINED notification to asset +insert into asset_as_built_alert_notifications + (alert_notification_id , asset_id) +values + (${alertNotificationSentId5b}, ${assetAsBuiltId17}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__045_send_investigation_on_as_build_created.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__045_send_investigation_on_as_build_created.sql deleted file mode 100644 index 1130662c40..0000000000 --- a/tx-backend/src/main/resources/db/testdata/afterMigrate__045_send_investigation_on_as_build_created.sql +++ /dev/null @@ -1,40 +0,0 @@ --- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied --- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). --- it is only intended for usage in local or test environments - --- This creates an investigation in state CREATED in Severity Critical for asBuilt asset Osram Front Left-AX400 which is sent from BPNL000000000001 to BPNL000SUPPLIER2 - ---- -insert into investigation - (id , bpn , close_reason, created , description , status , side , accept_reason, decline_reason, updated, error_message) -values - (${investigationId3}, 'BPNL000000000001', null , current_timestamp - interval '1 hour', 'Investigation on Osram Front Left-AX400 due to excessive brightness.', 'CREATED', 'SENDER', null , null , null , null); - ---- --- reset sequence to highest next-val -select setval('investigation_id_seq', (select max(i.id) from investigation i), true); - ---- -insert into investigation_notification - (id , contract_agreement_id, edc_url, notification_reference_id, send_to , created_by , investigation_id , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) -values - (${investigationNotificationId3}, null , null , null , 'BPNL000SUPPLIER2', 'BPNL000000000001', ${investigationId3}, current_timestamp + interval '1 week', 2 , 'Hella' , 'Osram' , 'c01353db-640a-44c4-9a87-28fa3a950a95', 0 , current_timestamp - interval '1 hour', current_timestamp - interval '1 hour', '71d7cb88-a208-434b-993e-74aeb331fd11', true); - ---- --- join investigation to asset -insert into assets_as_built_notifications - (notification_id , asset_id) -values - (${investigationNotificationId3}, ${assetAsBuiltId03}); - ---- --- join investigation to asset -insert into assets_as_built_investigations - (investigation_id , asset_id) -values - (${investigationId3}, ${assetAsBuiltId03}); - ---- -update assets_as_built - set in_investigation = true - where id in (${assetAsBuiltId03}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__045_sent_alert_on_as_built_canceled.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__045_sent_alert_on_as_built_canceled.sql new file mode 100644 index 0000000000..9fb19658a3 --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__045_sent_alert_on_as_built_canceled.sql @@ -0,0 +1,41 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an alert in state CANCELED with Severity Minor for asBuilt asset Fog lights left which is sent from BPNL000000000001 to BPNL000CUSTOMER1 + +--- +insert into alert + (id , bpn , close_reason, created , description , status , side , accept_reason, decline_reason, updated , error_message) +values + (${alertSentId6}, 'BPNL000000000001', null , current_timestamp - interval '3 days', 'Cancelled Alert about Fog lights left', 'CANCELED', 'SENDER', null , null , current_timestamp, null); + +--- +-- reset sequence to highest next-val +select setval('alert_id_seq', (select max(a.id) from alert a), true); + +--- +-- initial message +insert into alert_notification + (id , alert_id , contract_agreement_id, edc_url , notification_reference_id, created_by , send_to , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${alertNotificationSentId6}, ${alertSentId6}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', 'null' , 'BPNL000000000001', 'BPNL000CUSTOMER1', current_timestamp + interval '1 month', 0 , 'Hella' , 'BMW AG' , ${alertNotificationSentId6}, 6 , current_timestamp - interval '3 days', current_timestamp, '7e744fd6-26e8-44b8-9f70-0b788c35fac2', true); + +--- +-- join initial notification to asset +insert into asset_as_built_alert_notifications + (alert_notification_id , asset_id) +values + (${alertNotificationSentId6}, ${assetAsBuiltId15}); + +--- +-- join alert to asset +insert into assets_as_built_alerts + (alert_id , asset_id) +values + (${alertSentId6}, ${assetAsBuiltId15}); + +--- +update assets_as_built + set active_alert = false + where id in (${assetAsBuiltId15}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__046_send_investigation_on_as_build_sent.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__046_send_investigation_on_as_build_sent.sql deleted file mode 100644 index 25f80544ec..0000000000 --- a/tx-backend/src/main/resources/db/testdata/afterMigrate__046_send_investigation_on_as_build_sent.sql +++ /dev/null @@ -1,40 +0,0 @@ --- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied --- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). --- it is only intended for usage in local or test environments - --- This creates an investigation in state SENT in Severity Critical for asBuilt asset Osram Front Right-AX400 which is sent from BPNL000000000001 to BPNL000SUPPLIER2 - ---- -insert into investigation - (id , bpn , close_reason, created , description , status, side , accept_reason, decline_reason, updated , error_message) -values - (${investigationId4}, 'BPNL000000000001', null , current_timestamp - interval '2 hours', 'Investigation on Osram Front Right-AX400 due to excessive brightness.', 'SENT', 'SENDER', null , null , current_timestamp - interval '1 hour', null); - ---- --- reset sequence to highest next-val -select setval('investigation_id_seq', (select max(i.id) from investigation i), true); - ---- -insert into investigation_notification - (id , contract_agreement_id, edc_url , notification_reference_id, send_to , created_by , investigation_id , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) -values - (${investigationNotificationId4}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', null , 'BPNL000SUPPLIER2', 'BPNL000000000001', ${investigationId4}, current_timestamp + interval '1 week', 2 , 'Hella' , 'Osram' , '3ac2239a-e63f-4c19-b3b3-e6a2e5a240da', 0 , current_timestamp - interval '2 hours', current_timestamp - interval '1 hour', '749b31e9-9e73-4699-9470-dbee67ebc7a7', true); - ---- --- join investigation to asset -insert into assets_as_built_notifications - (notification_id , asset_id) -values - (${investigationNotificationId4}, ${assetAsBuiltId04}); - ---- --- join investigation to asset -insert into assets_as_built_investigations - (investigation_id , asset_id) -values - (${investigationId4}, ${assetAsBuiltId04}); - ---- -update assets_as_built - set in_investigation = true - where id in (${assetAsBuiltId04}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__046_sent_alert_on_as_built_closed.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__046_sent_alert_on_as_built_closed.sql new file mode 100644 index 0000000000..0a92ff0688 --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__046_sent_alert_on_as_built_closed.sql @@ -0,0 +1,55 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an alert in state CLOSED with Severity Critical for asBuilt asset Fog lights left which is sent from BPNL000000000001 to BPNL000CUSTOMER1 + +--- +insert into alert + (id , bpn , close_reason , created , description , status , side , accept_reason, decline_reason, updated , error_message) +values + (${alertSentId7}, 'BPNL000000000001', 'This was a false alarm' , current_timestamp - interval '2 days', 'Closed Alert about Fog lights left', 'CLOSED', 'SENDER', null , null , current_timestamp, null); + +--- +-- reset sequence to highest next-val +select setval('alert_id_seq', (select max(a.id) from alert a), true); + +--- +-- initial message +insert into alert_notification + (id , alert_id , contract_agreement_id, edc_url , notification_reference_id, created_by , send_to , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${alertNotificationSentId7a}, ${alertSentId7}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', 'null' , 'BPNL000000000001', 'BPNL000CUSTOMER1', current_timestamp + interval '1 month', 2 , 'Hella' , 'BMW AG' , ${alertNotificationSentId7a}, 7 , current_timestamp - interval '2 days', current_timestamp, '7e744fd6-26e8-44b8-9f70-0b788c35fac2', true); + +--- +-- join initial notification to asset +insert into asset_as_built_alert_notifications + (alert_notification_id , asset_id) +values + (${alertNotificationSentId7a}, ${assetAsBuiltId15}); + +--- +-- join alert to asset +insert into assets_as_built_alerts + (alert_id , asset_id) +values + (${alertSentId7}, ${assetAsBuiltId15}); + +--- +update assets_as_built + set active_alert = false + where id in (${assetAsBuiltId15}); + +--- +-- CLOSED by sender notification message +insert into alert_notification + (id , alert_id , contract_agreement_id, edc_url , notification_reference_id , created_by , send_to , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${alertNotificationSentId7b}, ${alertSentId7}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', 'cc49777f-3c8b-47d6-b1cf-f51783737292', 'BPNL000000000001', 'BPNL000CUSTOMER1', current_timestamp + interval '2 weeks', 2 , 'Hella' , 'BMW AG' , 'cc49777f-3c8b-47d6-b1cf-f51783737292', 7 , current_timestamp - interval '2 days', current_timestamp - interval '12 hours', 'f305046d-333a-4d44-ba3e-9a4ef1337ba6', false); + +--- +-- join CLOSED notification to asset +insert into asset_as_built_alert_notifications + (alert_notification_id , asset_id) +values + (${alertNotificationSentId7b}, ${assetAsBuiltId15}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__050_received_investigation_on_as_built_received.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__050_received_investigation_on_as_built_received.sql new file mode 100644 index 0000000000..8bcf517d8f --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__050_received_investigation_on_as_built_received.sql @@ -0,0 +1,40 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an investigation in state RECEIVED in Severity Major for asBuilt asset Xenon Left-Headlights which is sent from BPNL000CUSTOMER1 to BPNL000000000001 + +--- +insert into investigation + (id , bpn , close_reason, created , description , status , side , accept_reason, decline_reason, updated, error_message) +values + (${investigationReceivedId1}, 'BPNL000CUSTOMER1', null , current_timestamp - interval '1 day', 'Investigation on Xenon Left-Headlights due to malfunction.', 'RECEIVED', 'RECEIVER', null , null , null , null); + +--- +-- reset sequence to highest next-val +select setval('investigation_id_seq', (select max(i.id) from investigation i), true); + +--- +insert into investigation_notification + (id , contract_agreement_id, edc_url, notification_reference_id , created_by , send_to , investigation_id , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${investigationNotificationReceivedId1}, null , null , '8925f21f-09eb-4789-81fb-ec221e9e1561', 'BPNL000CUSTOMER1', 'BPNL000000000001', ${investigationReceivedId1}, current_timestamp + interval '2 weeks', 1 , 'BMW AG' , 'Hella' , '8925f21f-09eb-4789-81fb-ec221e9e1561', 2 , current_timestamp - interval '1 day', current_timestamp - interval '2 hours', 'e04f75e8-d37b-42e4-8cf7-6127f35f3ed5', false); + +--- +-- join investigation to asset +insert into assets_as_built_notifications + (notification_id , asset_id) +values + (${investigationNotificationReceivedId1}, ${assetAsBuiltId01}); + +--- +-- join investigation to asset +insert into assets_as_built_investigations + (investigation_id , asset_id) +values + (${investigationReceivedId1}, ${assetAsBuiltId01}); + +--- +update assets_as_built + set in_investigation = true + where id in (${assetAsBuiltId01}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__051_received_investigation_on_as_built_acknowledged.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__051_received_investigation_on_as_built_acknowledged.sql new file mode 100644 index 0000000000..31c714a9d8 --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__051_received_investigation_on_as_built_acknowledged.sql @@ -0,0 +1,55 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an investigation in state ACKNOWLEDGED in Severity Minor for asBuilt asset Xenon Right-Headlights which is sent from BPNL000CUSTOMER1 to BPNL000000000001 + +--- +insert into investigation + (id , bpn , close_reason, created , description , status , side , accept_reason, decline_reason, updated , error_message) +values + (${investigationReceivedId2}, 'BPNL000CUSTOMER1', null , current_timestamp - interval '2 days', 'Investigation on Xenon Right-Headlights due to malfunction.', 'ACKNOWLEDGED', 'RECEIVER', null , null , current_timestamp - interval '1 hours', null); + +--- +-- reset sequence to highest next-val +select setval('investigation_id_seq', (select max(i.id) from investigation i), true); + +--- +insert into investigation_notification + (id , contract_agreement_id, edc_url, notification_reference_id , send_to , created_by , investigation_id , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${investigationNotificationReceivedId2a}, null , null , '8925f21f-09eb-4789-81fb-ec221e9e1561', 'BPNL000000000001', 'BPNL000CUSTOMER1', ${investigationReceivedId2}, current_timestamp + interval '1 month', 0 , 'BMW AG' , 'Hella' , '8925f21f-09eb-4789-81fb-ec221e9e1561', 2 , current_timestamp - interval '2 days', current_timestamp - interval '2 hours', 'e04f75e8-d37b-42e4-8cf7-6127f35f3ed5', false); + +--- +-- join investigation to asset +insert into assets_as_built_notifications + (notification_id , asset_id) +values + (${investigationNotificationReceivedId2a}, ${assetAsBuiltId02}); + +--- +-- join investigation to asset +insert into assets_as_built_investigations + (investigation_id , asset_id) +values + (${investigationReceivedId2}, ${assetAsBuiltId02}); + +--- +update assets_as_built + set in_investigation = true + where id in (${assetAsBuiltId02}); + +--- +--- +-- ACK by receiver notification message +insert into investigation_notification + (id , contract_agreement_id, edc_url , notification_reference_id, created_by , send_to , investigation_id , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${investigationNotificationReceivedId2b}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', null , 'BPNL000000000001', 'BPNL000CUSTOMER1', ${investigationReceivedId2}, current_timestamp + interval '1 month', 0 , 'Hella' , 'BMW AG' , '8925f21f-09eb-4789-81fb-ec221e9e1561', 3 , current_timestamp - interval '2 days' , current_timestamp - interval '1 hour', '207ba6cf-217b-401d-a5da-69cac8b154a5', false); + +--- +-- join ACK notification to asset +insert into assets_as_built_notifications + (notification_id , asset_id) +values + (${investigationNotificationReceivedId2b}, ${assetAsBuiltId02}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__052_received_investigation_on_as_built_accepted.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__052_received_investigation_on_as_built_accepted.sql new file mode 100644 index 0000000000..ddc252c163 --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__052_received_investigation_on_as_built_accepted.sql @@ -0,0 +1,55 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an investigation in state ACCEPTED in Severity Critical for asBuilt asset H-LeftTurningLight which is sent from BPNL000CUSTOMER2 to BPNL000000000001 + +--- +insert into investigation + (id , bpn , close_reason, created , description , status , side , accept_reason , decline_reason, updated , error_message) +values + (${investigationReceivedId3}, 'BPNL000CUSTOMER2', null , current_timestamp - interval '3 days', 'Investigation on H-LeftTurningLight due to malfunction.', 'ACCEPTED', 'RECEIVER', 'True, it doesn''t work' , null , current_timestamp - interval '1 hours', null); + +--- +-- reset sequence to highest next-val +select setval('investigation_id_seq', (select max(i.id) from investigation i), true); + +--- +insert into investigation_notification + (id , contract_agreement_id, edc_url, notification_reference_id , send_to , created_by , investigation_id , target_date , severity, created_by_name, send_to_name , edc_notification_id , status, created , updated , message_id , is_initial) +values + (${investigationNotificationReceivedId3a}, null , null , '8925f21f-09eb-4789-81fb-ec221e9e1561', 'BPNL000000000001', 'BPNL000CUSTOMER2', ${investigationReceivedId3}, current_timestamp + interval '1 week', 2 , 'Audi AG' , 'Hella' , '8925f21f-09eb-4789-81fb-ec221e9e1561', 4 , current_timestamp - interval '3 days' , current_timestamp - interval '2 hours', 'e04f75e8-d37b-42e4-8cf7-6127f35f3ed5', false); + +--- +-- join investigation to asset +insert into assets_as_built_notifications + (notification_id , asset_id) +values + (${investigationNotificationReceivedId3a}, ${assetAsBuiltId11}); + +--- +-- join investigation to asset +insert into assets_as_built_investigations + (investigation_id , asset_id) +values + (${investigationReceivedId3}, ${assetAsBuiltId11}); + +--- +update assets_as_built + set in_investigation = true + where id in (${assetAsBuiltId11}); + +--- +--- +-- ACCEPTED by receiver notification message +insert into investigation_notification + (id , contract_agreement_id, edc_url , notification_reference_id, created_by , send_to , investigation_id , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${investigationNotificationReceivedId3b}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', null , 'BPNL000000000001', 'BPNL000CUSTOMER2', ${investigationReceivedId3}, current_timestamp + interval '1 week', 2 , 'Hella' , 'Audi AG' , '8925f21f-09eb-4789-81fb-ec221e9e1561', 4 , current_timestamp - interval '3 days', current_timestamp - interval '1 hour', '207ba6cf-217b-401d-a5da-69cac8b154a5', false); + +--- +-- join ACCEPTED notification to asset +insert into assets_as_built_notifications + (notification_id , asset_id) +values + (${investigationNotificationReceivedId3b}, ${assetAsBuiltId11}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__053_received_investigation_on_as_built_declined.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__053_received_investigation_on_as_built_declined.sql new file mode 100644 index 0000000000..3b61659ba4 --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__053_received_investigation_on_as_built_declined.sql @@ -0,0 +1,55 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an investigation in state DECLINED in Severity Life-threatening for asBuilt asset H-LeftBrakeLight which is sent from BPNL000CUSTOMER2 to BPNL000000000001 + +--- +insert into investigation + (id , bpn , close_reason, created , description , status , side , accept_reason, decline_reason , updated , error_message) +values + (${investigationReceivedId4}, 'BPNL000CUSTOMER2', null , current_timestamp - interval '4 days', 'Investigation on H-LeftBrakeLight due to malfunction.', 'DECLINED', 'RECEIVER', null , 'Everything works fine' , current_timestamp - interval '1 hours', null); + +--- +-- reset sequence to highest next-val +select setval('investigation_id_seq', (select max(i.id) from investigation i), true); + +--- +insert into investigation_notification + (id , contract_agreement_id, edc_url, notification_reference_id , send_to , created_by , investigation_id , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${investigationNotificationReceivedId4a}, null , null , '8925f21f-09eb-4789-81fb-ec221e9e1561', 'BPNL000000000001', 'BPNL000CUSTOMER2', ${investigationReceivedId4}, current_timestamp + interval '3 days', 3 , 'Audi AG' , 'Hella' , '8925f21f-09eb-4789-81fb-ec221e9e1561', 5 , current_timestamp - interval '4 days', current_timestamp - interval '2 hours', 'e04f75e8-d37b-42e4-8cf7-6127f35f3ed5', false); + +--- +-- join investigation to asset +insert into assets_as_built_notifications + (notification_id , asset_id) +values + (${investigationNotificationReceivedId4a}, ${assetAsBuiltId13}); + +--- +-- join investigation to asset +insert into assets_as_built_investigations + (investigation_id , asset_id) +values + (${investigationReceivedId4}, ${assetAsBuiltId13}); + +--- +update assets_as_built + set in_investigation = true + where id in (${assetAsBuiltId13}); + +--- +--- +-- DECLINED by receiver notification message +insert into investigation_notification + (id , contract_agreement_id, edc_url , notification_reference_id, created_by , send_to , investigation_id , target_date , severity, created_by_name, send_to_name , edc_notification_id , status, created , updated , message_id , is_initial) +values + (${investigationNotificationReceivedId4b}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', null , 'BPNL000000000001', 'BPNL000CUSTOMER2', ${investigationReceivedId4}, current_timestamp + interval '3 days', 3 , 'Hella' , 'Audi AG' , '8925f21f-09eb-4789-81fb-ec221e9e1561', 5 , current_timestamp - interval '4 days', current_timestamp - interval '1 hour', '207ba6cf-217b-401d-a5da-69cac8b154a5', false); + +--- +-- join DECLINED notification to asset +insert into assets_as_built_notifications + (notification_id , asset_id) +values + (${investigationNotificationReceivedId4b}, ${assetAsBuiltId13}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__054_received_investigation_on_as_built_closed.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__054_received_investigation_on_as_built_closed.sql new file mode 100644 index 0000000000..778636dc65 --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__054_received_investigation_on_as_built_closed.sql @@ -0,0 +1,55 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an investigation in state CLOSED in Severity Minor for asBuilt asset H-LeftFogLight which is sent from BPNL000CUSTOMER3 to BPNL000000000001 + +--- +insert into investigation + (id , bpn , close_reason , created , description , status , side , accept_reason, decline_reason, updated , error_message) +values + (${investigationReceivedId5}, 'BPNL000CUSTOMER3', 'We confirm that the problem has been fixed.' , current_timestamp - interval '5 days', 'Investigation on H-LeftFogLight due to malfunction.', 'CLOSED', 'RECEIVER', null , null , current_timestamp - interval '1 hours', null); + +--- +-- reset sequence to highest next-val +select setval('investigation_id_seq', (select max(i.id) from investigation i), true); + +--- +insert into investigation_notification + (id , contract_agreement_id, edc_url, notification_reference_id , send_to , created_by , investigation_id , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${investigationNotificationReceivedId5a}, null , null , '8925f21f-09eb-4789-81fb-ec221e9e1561', 'BPNL000000000001', 'BPNL000CUSTOMER3', ${investigationReceivedId5}, current_timestamp + interval '1 month', 0 , 'VW AG' , 'Hella' , '8925f21f-09eb-4789-81fb-ec221e9e1561', 7 , current_timestamp - interval '5 days', current_timestamp - interval '2 hours', 'e04f75e8-d37b-42e4-8cf7-6127f35f3ed5', false); + +--- +-- join investigation to asset +insert into assets_as_built_notifications + (notification_id , asset_id) +values + (${investigationNotificationReceivedId5a}, ${assetAsBuiltId15}); + +--- +-- join investigation to asset +insert into assets_as_built_investigations + (investigation_id , asset_id) +values + (${investigationReceivedId5}, ${assetAsBuiltId15}); + +--- +update assets_as_built + set in_investigation = false + where id in (${assetAsBuiltId15}); + +--- +--- +-- CLOSED by sender notification message +insert into investigation_notification + (id , contract_agreement_id, edc_url , notification_reference_id, created_by , send_to , investigation_id , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${investigationNotificationReceivedId5b}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', null , 'BPNL000CUSTOMER3', 'BPNL000000000001', ${investigationReceivedId5}, current_timestamp + interval '1 month', 0 , 'VW AG' ,'Hella' , '8925f21f-09eb-4789-81fb-ec221e9e1561', 7 , current_timestamp - interval '5 days ', current_timestamp - interval '1 hour', '207ba6cf-217b-401d-a5da-69cac8b154a5', false); + +--- +-- join CLOSED notification to asset +insert into assets_as_built_notifications + (notification_id , asset_id) +values + (${investigationNotificationReceivedId5b}, ${assetAsBuiltId15}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__060_sent_investigation_on_as_built_created.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__060_sent_investigation_on_as_built_created.sql new file mode 100644 index 0000000000..9761a7e98a --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__060_sent_investigation_on_as_built_created.sql @@ -0,0 +1,40 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an investigation in state CREATED in Severity Critical for asBuilt asset Osram Front Left-AX400 which is sent from BPNL000000000001 to BPNL000SUPPLIER1 + +--- +insert into investigation + (id , bpn , close_reason, created , description , status , side , accept_reason, decline_reason, updated, error_message) +values + (${investigationSentId1}, 'BPNL000000000001', null , current_timestamp - interval '1 day' , 'Investigation on Osram Front Left-AX400 due to excessive brightness.', 'CREATED', 'SENDER', null , null , null , null); + +--- +-- reset sequence to highest next-val +select setval('investigation_id_seq', (select max(i.id) from investigation i), true); + +--- +insert into investigation_notification + (id , contract_agreement_id, edc_url, notification_reference_id, send_to , created_by , investigation_id , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${investigationNotificationSentId1}, null , null , null , 'BPNL000SUPPLIER1', 'BPNL000000000001', ${investigationSentId1}, current_timestamp + interval '1 week', 2 , 'Hella' , 'Osram' , 'c01353db-640a-44c4-9a87-28fa3a950a95', 0 , current_timestamp - interval '1 day' , current_timestamp - interval '1 hour', '71d7cb88-a208-434b-993e-74aeb331fd11', true); + +--- +-- join investigation to asset +insert into assets_as_built_notifications + (notification_id , asset_id) +values + (${investigationNotificationSentId1}, ${assetAsBuiltId03}); + +--- +-- join investigation to asset +insert into assets_as_built_investigations + (investigation_id , asset_id) +values + (${investigationSentId1}, ${assetAsBuiltId03}); + +--- +update assets_as_built + set in_investigation = true + where id in (${assetAsBuiltId03}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__061_sent_investigation_on_as_built_sent.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__061_sent_investigation_on_as_built_sent.sql new file mode 100644 index 0000000000..e8a2740e4d --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__061_sent_investigation_on_as_built_sent.sql @@ -0,0 +1,40 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an investigation in state SENT in Severity Critical for asBuilt asset Osram Front Right-AX400 which is sent from BPNL000000000001 to BPNL000SUPPLIER1 + +--- +insert into investigation + (id , bpn , close_reason, created , description , status, side , accept_reason, decline_reason, updated , error_message) +values + (${investigationSentId2}, 'BPNL000000000001', null , current_timestamp - interval '2 days' , 'Investigation on Osram Front Right-AX400 due to excessive brightness.', 'SENT', 'SENDER', null , null , current_timestamp - interval '1 hour', null); + +--- +-- reset sequence to highest next-val +select setval('investigation_id_seq', (select max(i.id) from investigation i), true); + +--- +insert into investigation_notification + (id , contract_agreement_id, edc_url , notification_reference_id, send_to , created_by , investigation_id , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${investigationNotificationSentId2}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', null , 'BPNL000SUPPLIER1', 'BPNL000000000001', ${investigationSentId2}, current_timestamp + interval '1 week', 2 , 'Hella' , 'Osram' , '3ac2239a-e63f-4c19-b3b3-e6a2e5a240da', 0 , current_timestamp - interval '2 days', current_timestamp - interval '1 hour', '749b31e9-9e73-4699-9470-dbee67ebc7a7', true); + +--- +-- join investigation to asset +insert into assets_as_built_notifications + (notification_id , asset_id) +values + (${investigationNotificationSentId2}, ${assetAsBuiltId04}); + +--- +-- join investigation to asset +insert into assets_as_built_investigations + (investigation_id , asset_id) +values + (${investigationSentId2}, ${assetAsBuiltId04}); + +--- +update assets_as_built + set in_investigation = true + where id in (${assetAsBuiltId04}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__062_sent_investigation_on_as_built_acknowledged.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__062_sent_investigation_on_as_built_acknowledged.sql new file mode 100644 index 0000000000..b500cb53b5 --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__062_sent_investigation_on_as_built_acknowledged.sql @@ -0,0 +1,54 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an investigation in state ACKNOWLEDGED in Severity Life-threatening for asBuilt asset Philips P-LeftHeadBulb which is sent from BPNL000000000001 to BPNL000SUPPLIER2 + +--- +insert into investigation + (id , bpn , close_reason, created , description , status , side , accept_reason, decline_reason, updated , error_message) +values + (${investigationSentId3}, 'BPNL000000000001', null , current_timestamp - interval '3 days', 'Investigation on Philips P-LeftHeadBulb due to occasional outages.' , 'ACKNOWLEDGED', 'SENDER', null , null , current_timestamp - interval '1 hour', null); + +--- +-- reset sequence to highest next-val +select setval('investigation_id_seq', (select max(i.id) from investigation i), true); + +--- +insert into investigation_notification + (id , contract_agreement_id, edc_url , notification_reference_id, send_to , created_by , investigation_id , target_date , severity, created_by_name, send_to_name , edc_notification_id , status, created , updated , message_id , is_initial) +values + (${investigationNotificationSentId3a}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', null , 'BPNL000SUPPLIER2', 'BPNL000000000001', ${investigationSentId3}, current_timestamp + interval '4 days', 3 , 'Hella' , 'Philips' , '3ac2239a-e63f-4c19-b3b3-e6a2e5a240da', 3 , current_timestamp - interval '3 days', current_timestamp - interval '1 hour', '749b31e9-9e73-4699-9470-dbee67ebc7a7', true); + +--- +-- join investigation to asset +insert into assets_as_built_notifications + (notification_id , asset_id) +values + (${investigationNotificationSentId3a}, ${assetAsBuiltId05}); + +--- +-- join investigation to asset +insert into assets_as_built_investigations + (investigation_id , asset_id) +values + (${investigationSentId3}, ${assetAsBuiltId05}); + +--- +update assets_as_built + set in_investigation = true + where id in (${assetAsBuiltId05}); + +--- +-- ACK by receiver notification message +insert into investigation_notification + (id , contract_agreement_id, edc_url , notification_reference_id, created_by , send_to , investigation_id , target_date , severity, created_by_name, send_to_name, edc_notification_id , status , created , updated , message_id , is_initial) +values + (${investigationNotificationSentId3b}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', null , 'BPNL000SUPPLIER2', 'BPNL000000000001', ${investigationSentId3}, current_timestamp + interval '4 days', 3 , 'Philips' , 'Hella' , '8925f21f-09eb-4789-81fb-ec221e9e1561', 3 , current_timestamp - interval '3 days', current_timestamp - interval '1 hour', '207ba6cf-217b-401d-a5da-69cac8b154a5', false); + +--- +-- join ACK notification to asset +insert into assets_as_built_notifications + (notification_id , asset_id) +values + (${investigationNotificationSentId3b}, ${assetAsBuiltId05}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__063_sent_investigation_on_as_built_accepted.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__063_sent_investigation_on_as_built_accepted.sql new file mode 100644 index 0000000000..5d677708eb --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__063_sent_investigation_on_as_built_accepted.sql @@ -0,0 +1,54 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an investigation in state ACCEPTED in Severity Minor for asBuilt asset Würth W-FogLight which is sent from BPNL000000000001 to BPNL000SUPPLIER3 + +--- +insert into investigation + (id , bpn , close_reason, created , description , status , side , accept_reason , decline_reason, updated , error_message) +values + (${investigationSentId4}, 'BPNL000000000001', null , current_timestamp - interval '4 days' , 'Investigation on Würth W-FogLight due to damaged packaging.', 'ACCEPTED', 'SENDER', 'Damn, it''s damaged!' , null , current_timestamp - interval '1 hour', null); + +--- +-- reset sequence to highest next-val +select setval('investigation_id_seq', (select max(i.id) from investigation i), true); + +--- +insert into investigation_notification + (id , contract_agreement_id, edc_url , notification_reference_id, send_to , created_by , investigation_id , target_date , severity, created_by_name, send_to_name , edc_notification_id , status, created , updated , message_id , is_initial) +values + (${investigationNotificationSentId4a}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', null , 'BPNL000SUPPLIER3', 'BPNL000000000001', ${investigationSentId4}, current_timestamp + interval '1 month', 0 , 'Hella' , 'Würth' , '3ac2239a-e63f-4c19-b3b3-e6a2e5a240da', 4 , current_timestamp - interval '4 days' , current_timestamp - interval '1 hour', '749b31e9-9e73-4699-9470-dbee67ebc7a7', true); + +--- +-- join investigation to asset +insert into assets_as_built_notifications + (notification_id , asset_id) +values + (${investigationNotificationSentId4a}, ${assetAsBuiltId23}); + +--- +-- join investigation to asset +insert into assets_as_built_investigations + (investigation_id , asset_id) +values + (${investigationSentId4}, ${assetAsBuiltId23}); + +--- +update assets_as_built + set in_investigation = true + where id in (${assetAsBuiltId23}); + +--- +-- ACCEPTED by receiver notification message +insert into investigation_notification + (id , contract_agreement_id, edc_url , notification_reference_id, created_by , send_to , investigation_id , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${investigationNotificationSentId4b}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', null , 'BPNL000SUPPLIER3', 'BPNL000000000001', ${investigationSentId4}, current_timestamp + interval '1 week', 0 , 'Würth' , 'Hella' , '8925f21f-09eb-4789-81fb-ec221e9e1561', 4 , current_timestamp - interval '4 days' , current_timestamp - interval '1 hour', '207ba6cf-217b-401d-a5da-69cac8b154a5', false); + +--- +-- join ACCEPTED notification to asset +insert into assets_as_built_notifications + (notification_id , asset_id) +values + (${investigationNotificationSentId4b}, ${assetAsBuiltId23}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__064_sent_investigation_on_as_built_declined.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__064_sent_investigation_on_as_built_declined.sql new file mode 100644 index 0000000000..d8e0c72a09 --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__064_sent_investigation_on_as_built_declined.sql @@ -0,0 +1,54 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an investigation in state DECLINED in Severity Major for asBuilt asset Würth W-HighBeam which is sent from BPNL000000000001 to BPNL000SUPPLIER3 + +--- +insert into investigation + (id , bpn , close_reason, created , description , status , side , accept_reason , decline_reason , updated , error_message) +values + (${investigationSentId5}, 'BPNL000000000001', null , current_timestamp - interval '5 days', 'Investigation on Würth W-HighBeam due to broken glass.', 'DECLINED', 'SENDER', null , 'It''s not broken' , current_timestamp - interval '1 hour', null); + +--- +-- reset sequence to highest next-val +select setval('investigation_id_seq', (select max(i.id) from investigation i), true); + +--- +insert into investigation_notification + (id , contract_agreement_id, edc_url , notification_reference_id, send_to , created_by , investigation_id , target_date , severity, created_by_name, send_to_name , edc_notification_id , status, created , updated , message_id , is_initial) +values + (${investigationNotificationSentId5a}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', null , 'BPNL000SUPPLIER3', 'BPNL000000000001', ${investigationSentId5}, current_timestamp + interval '2 weeks', 1 , 'Hella' , 'Würth' , '3ac2239a-e63f-4c19-b3b3-e6a2e5a240da', 5 , current_timestamp - interval '5 days' , current_timestamp - interval '1 hour', '749b31e9-9e73-4699-9470-dbee67ebc7a7', true); + +--- +-- join investigation to asset +insert into assets_as_built_notifications + (notification_id , asset_id) +values + (${investigationNotificationSentId5a}, ${assetAsBuiltId24}); + +--- +-- join investigation to asset +insert into assets_as_built_investigations + (investigation_id , asset_id) +values + (${investigationSentId5}, ${assetAsBuiltId24}); + +--- +update assets_as_built + set in_investigation = true + where id in (${assetAsBuiltId24}); + +--- +-- DECLINED by receiver notification message +insert into investigation_notification + (id , contract_agreement_id, edc_url , notification_reference_id, created_by , send_to , investigation_id , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${investigationNotificationSentId5b}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', null , 'BPNL000SUPPLIER3', 'BPNL000000000001', ${investigationSentId5}, current_timestamp + interval '2 weeks', 1 , 'Würth' , 'Hella' , '8925f21f-09eb-4789-81fb-ec221e9e1561', 5 , current_timestamp - interval '5 days' , current_timestamp - interval '1 hour', '207ba6cf-217b-401d-a5da-69cac8b154a5', false); + +--- +-- join DECLINED notification to asset +insert into assets_as_built_notifications + (notification_id , asset_id) +values + (${investigationNotificationSentId5b}, ${assetAsBuiltId24}); diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__065_sent_investigation_on_as_built_canceled.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__065_sent_investigation_on_as_built_canceled.sql new file mode 100644 index 0000000000..04167ad17c --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__065_sent_investigation_on_as_built_canceled.sql @@ -0,0 +1,42 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an investigation in state CANCELED in Severity Life-threatening for asBuilt asset Osram O-BrakeLight which is sent from BPNL000000000001 to BPNL000SUPPLIER1 + +--- +insert into investigation + (id , bpn , close_reason , created , description , status , side , accept_reason , decline_reason , updated , error_message) +values + (${investigationSentId6}, 'BPNL000000000001', null , current_timestamp - interval '7 days', 'Investigation on Osram O-BrakeLight due to strange noise.', 'CANCELED', 'SENDER', null , null , current_timestamp - interval '1 hour', null); + +--- +-- reset sequence to highest next-val +select setval('investigation_id_seq', (select max(i.id) from investigation i), true); + +--- +insert into investigation_notification + (id , contract_agreement_id, edc_url , notification_reference_id, send_to , created_by , investigation_id , target_date , severity, created_by_name, send_to_name , edc_notification_id , status, created , updated , message_id , is_initial) +values + (${investigationNotificationSentId6}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', null , 'BPNL000SUPPLIER1', 'BPNL000000000001', ${investigationSentId6}, current_timestamp + interval '2 days', 3 , 'Hella' , 'Osram' , '3ac2239a-e63f-4c19-b3b3-e6a2e5a240da', 7 , current_timestamp - interval '7 days', current_timestamp - interval '1 hour', '749b31e9-9e73-4699-9470-dbee67ebc7a7', true); + +--- +-- join investigation to asset +insert into assets_as_built_notifications + (notification_id , asset_id) +values + (${investigationNotificationSentId6}, ${assetAsBuiltId20}); + +--- +-- join investigation to asset +insert into assets_as_built_investigations + (investigation_id , asset_id) +values + (${investigationSentId6}, ${assetAsBuiltId20}); + +--- +update assets_as_built + set in_investigation = false + where id in (${assetAsBuiltId20}); + + diff --git a/tx-backend/src/main/resources/db/testdata/afterMigrate__066_sent_investigation_on_as_built_closed.sql b/tx-backend/src/main/resources/db/testdata/afterMigrate__066_sent_investigation_on_as_built_closed.sql new file mode 100644 index 0000000000..1eb5fbc1fc --- /dev/null +++ b/tx-backend/src/main/resources/db/testdata/afterMigrate__066_sent_investigation_on_as_built_closed.sql @@ -0,0 +1,54 @@ +-- this script is executed by flyway as part of a lifecycle hook after all migrations have been applied +-- (see https://documentation.red-gate.com/fd/callback-concept-184127466.html). +-- it is only intended for usage in local or test environments + +-- This creates an investigation in state CLOSED in Severity Critical for asBuilt asset Philips P-RightHeadBulb which is sent from BPNL000000000001 to BPNL000SUPPLIER2 + +--- +insert into investigation + (id , bpn , close_reason , created , description , status , side , accept_reason , decline_reason , updated , error_message) +values + (${investigationSentId7}, 'BPNL000000000001', 'Problem is fixed' , current_timestamp - interval '6 days', 'Investigation on Philips RightHeadBulb due to broken fuse.', 'CLOSED', 'SENDER', null , null , current_timestamp - interval '1 hour', null); + +--- +-- reset sequence to highest next-val +select setval('investigation_id_seq', (select max(i.id) from investigation i), true); + +--- +insert into investigation_notification + (id , contract_agreement_id, edc_url , notification_reference_id, send_to , created_by , investigation_id , target_date , severity, created_by_name, send_to_name , edc_notification_id , status, created , updated , message_id , is_initial) +values + (${investigationNotificationSentId7a}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', null , 'BPNL000SUPPLIER2', 'BPNL000000000001', ${investigationSentId7}, current_timestamp + interval '1 week', 2 , 'Hella' , 'Philips' , '3ac2239a-e63f-4c19-b3b3-e6a2e5a240da', 6 , current_timestamp - interval '6 days', current_timestamp - interval '1 hour', '749b31e9-9e73-4699-9470-dbee67ebc7a7', true); + +--- +-- join investigation to asset +insert into assets_as_built_notifications + (notification_id , asset_id) +values + (${investigationNotificationSentId7a}, ${assetAsBuiltId06}); + +--- +-- join investigation to asset +insert into assets_as_built_investigations + (investigation_id , asset_id) +values + (${investigationSentId7}, ${assetAsBuiltId06}); + +--- +update assets_as_built + set in_investigation = false + where id in (${assetAsBuiltId06}); + +--- +-- CLOSED by sender notification message +insert into investigation_notification + (id , contract_agreement_id, edc_url , notification_reference_id, created_by , send_to , investigation_id , target_date , severity, created_by_name, send_to_name, edc_notification_id , status, created , updated , message_id , is_initial) +values + (${investigationNotificationSentId7b}, 'contractAgreementId', 'http://localhost:8082/api/qualitynotifications/receive', null , 'BPNL000000000001', 'BPNL000SUPPLIER2', ${investigationSentId7}, current_timestamp + interval '1 week', 2 , 'Hella' , 'Philips' , '8925f21f-09eb-4789-81fb-ec221e9e1561', 6 , current_timestamp - interval '6 days' , current_timestamp - interval '1 hour', '207ba6cf-217b-401d-a5da-69cac8b154a5', false); + +--- +-- join CLOSED notification to asset +insert into assets_as_built_notifications + (notification_id , asset_id) +values + (${investigationNotificationSentId7b}, ${assetAsBuiltId06});