Skip to content

Commit

Permalink
Merge pull request #10 from dcsaorg/TnT2.0
Browse files Browse the repository at this point in the history
Tnt2.0
  • Loading branch information
HenrikHL authored Sep 24, 2020
2 parents ad0e06f + 778b18d commit d0798b6
Show file tree
Hide file tree
Showing 30 changed files with 717 additions and 500 deletions.
69 changes: 0 additions & 69 deletions .github/workflows/maven.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/microservices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ jobs:
ref: master
token: ${{ secrets.read_repo_pat }}
- name: Run API validator
run: mvn test
run: mvn -Dtest.suite=TnTV2.xml test
env:
client_secret: ${{ secrets.AUTH0_DCSA_CLIENT_SECRET }}
client_id: 1qEYXCbxWvjeYS8VVm1BfnfZrP3TY9n8
audience: localhost
OAuthTokenUri: https://dcsa.eu.auth0.com/oauth/token
API_ROOT_URI: http://localhost:9090
API_ROOT_URI: http://localhost:9090/v2
24 changes: 13 additions & 11 deletions datamodel/initdb.d/04_dcsa_tnt_v2_0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,40 @@ CREATE TABLE dcsa_v2_0.event (
event_type text NOT NULL,
event_classifier_code varchar(3) NOT NULL,
event_date_time timestamp with time zone NOT NULL,
event_type_code varchar(4) NOT NULL,
transport_call_id uuid NOT NULL
event_type_code varchar(4) NOT NULL
);

DROP TABLE IF EXISTS dcsa_v2_0.equipment_event CASCADE;
CREATE TABLE dcsa_v2_0.equipment_event (
equipment_reference varchar(15),
empty_indicator_code text NOT NULL
empty_indicator_code text NOT NULL,
transport_call_id uuid NOT NULL
) INHERITS (dcsa_v2_0.event);

DROP TABLE IF EXISTS dcsa_v2_0.shipment_event CASCADE;
CREATE TABLE dcsa_v2_0.shipment_event (
shipment_id uuid NOT NULL,
shipment_information_type_code varchar(3) NOT NULL
) INHERITS (dcsa_v2_0.event);

DROP TABLE IF EXISTS dcsa_v2_0.transport_event CASCADE;
CREATE TABLE dcsa_v2_0.transport_event (
delay_reason_code varchar(3),
vessel_schedule_change_remark varchar(250)
vessel_schedule_change_remark varchar(250),
transport_call_id uuid NOT NULL
) INHERITS (dcsa_v2_0.event);

DROP TABLE IF EXISTS dcsa_v2_0.event_subscription CASCADE;
CREATE TABLE dcsa_v2_0.event_subscription (
subscription_id uuid DEFAULT uuid_generate_v4() PRIMARY KEY,
id uuid DEFAULT uuid_generate_v4() PRIMARY KEY,
callback_url text NOT NULL,
event_type text, --This field must be able to contain multiple event types. Currently it does not.
booking_reference varchar(35),
transport_document_id varchar(20),
transport_document_type text,
equipment_reference varchar(15),
schedule_id uuid NOT NULL,
transport_call_id uuid NOT NULL
schedule_id uuid NULL,
transport_call_id uuid NULL
);


Expand All @@ -64,7 +66,7 @@ UNION
shipment_event.event_classifier_code,
shipment_event.event_type_code,
shipment_event.event_date_time,
shipment_event.transport_call_id,
NULL::UUID AS transport_call_id,
NULL::text AS delay_reason_code,
NULL:: text AS vessel_schedule_change_remark,
shipment_event.shipment_information_type_code,
Expand All @@ -91,18 +93,18 @@ CREATE TABLE dcsa_v2_0.schedule (
id uuid DEFAULT uuid_generate_v4() PRIMARY KEY,
vessel_operator_carrier_code varchar(10) NOT NULL,
vessel_operator_carrier_code_list_provider text NOT NULL,
vessel_partner_carrier_code text NOT NULL,
vessel_partner_carrier_code varchar(10) NOT NULL,
vessel_partner_carrier_code_list_provider text,
start_date date,
date_range interval
date_range text
);

DROP TABLE IF EXISTS dcsa_v2_0.transport_call CASCADE;
CREATE TABLE dcsa_v2_0.transport_call (
id uuid DEFAULT uuid_generate_v4() PRIMARY KEY,
schedule_id uuid NOT NULL,
carrier_service_code text,
vessel_imo_number varchar(7),
vessel_imo_number bigint,
vessel_name varchar(35),
carrier_voyage_number varchar(50) NOT NULL,
un_location_code varchar(5) NOT NULL,
Expand Down
208 changes: 208 additions & 0 deletions datamodel/testdata.d/05_test_data_tnt_v1.2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
\connect dcsa_openapi

--- Insert data into v1_2 model ---

INSERT INTO dcsa_v1_2.shipment_event (
event_classifier_code,
event_type,
event_date_time,
event_id,
event_type_code,
shipment_id,
shipment_information_type_code
) VALUES (
'PLN',
'SHIPMENT',
TO_DATE('2020/07/15 13:14:15', 'yyyy/mm/dd hh24:mi:ss'),
'e48f2bc0-c746-11ea-a3ff-db48243a89f4',
'DEPA',
uuid('5e51e72c-d872-11ea-811c-0f8f10a32ea1'),
'Some type code text'
);

INSERT INTO "dcsa_v1_2".shipment_event (
event_classifier_code,
event_type,
event_date_time,
event_type_code,
shipment_id,
shipment_information_type_code
) VALUES (
'PLN',
'SHIPMENT',
TO_DATE('2003/05/03 21:02:44', 'yyyy/mm/dd hh24:mi:ss'),
'ARRI',
uuid('5e51e72c-d872-11ea-811c-0f8f10a32ea1'),
'shipment_type_code'
);

INSERT INTO "dcsa_v1_2".equipment_event (
event_classifier_code,
event_type,
event_date_time,
event_type_code,
equipment_reference,
facility_type_code,
un_location_code,
facility_code,
other_facility,
empty_indicator_code
) VALUES (
'ACT', 'EQUIPMENT',
TO_DATE('2003/05/03 21:02:44', 'yyyy/mm/dd hh24:mi:ss'),
'ARRI',
'equipref3453',
'HYDRO',
'LA',
'LAHO',
'',
'EMPTY'
);

INSERT INTO "dcsa_v1_2".transport_equipment_event (
event_classifier_code,
event_type,
event_date_time,
event_type_code,
equipment_reference,
facility_type_code,
un_location_code,
facility_code,
other_facility,
empty_indicator_code,
transport_reference,
transport_leg_reference,
mode_of_transport_code
) VALUES (
'PLN', 'TRANSPORTEQUIPMENT',
TO_DATE('2003/05/03 21:02:44', 'yyyy/mm/dd hh24:mi:ss'),
'ARRI',
'eqref123',
'factory',
'CPH',
'2',
'no',
'LADEN',
'ref123',
'legref',
'7'
);

INSERT INTO "dcsa_v1_2".transport_event (
event_classifier_code,
event_type,
event_date_time,
event_type_code,
transport_reference,
transport_leg_reference,
facility_type_code,
un_location_code,
facility_code,
other_facility,
mode_of_transport_code
) VALUES (
'ACT', 'TRANSPORT',
TO_DATE('2003/05/03 21:02:44', 'yyyy/mm/dd hh24:mi:ss'),
'DEPA',
'transportref123',
'legreference234',
'coal',
'PORT',
'NYC',
'no',
'2'
);

INSERT INTO dcsa_v1_2.event_subscription (
callback_url,
event_type,
booking_reference,
bill_of_lading_number,
equipment_reference
) VALUES (
'http://localhost:4567/webhook/receive',
'',
'',
'',
''
);

INSERT INTO dcsa_v1_2.event_subscription (
callback_url,
event_type,
booking_reference,
bill_of_lading_number,
equipment_reference
) VALUES (
'http://localhost:4567/webhook/receive-transport-events',
'TRANSPORT',
'',
'',
''
);

INSERT INTO dcsa_v1_2.event_subscription (
callback_url,
event_type,
booking_reference,
bill_of_lading_number,
equipment_reference
) VALUES (
'http://172.17.0.1:4567/webhook/receive',
'',
'',
'',
''
);

INSERT INTO dcsa_v1_2.shipment (
id,
booking_reference,
booking_datetime,
bill_of_lading_number,
shipper_name,
consignee_name,
collection_origin,
collection_dateTime,
delivery_destination,
delivery_datetime,
carrier_code
) VALUES (
uuid('5e51e72c-d872-11ea-811c-0f8f10a32ea1'),
'BR1239719871',
DATE '2020-03-07',
'BL32147109',
'Magic Wands Inc.',
'The Mage Guild',
'5, Mountain Road, The land beyond the sea',
DATE '2020-03-10',
'125, Valley Street, The land nearby',
DATE '2020-04-10',
'SMDG-ZIM'
);

INSERT INTO dcsa_v1_2.shipment (
id,
booking_reference,
booking_datetime,
bill_of_lading_number,
shipper_name,
consignee_name,
collection_origin,
collection_dateTime,
delivery_destination,
delivery_datetime,
carrier_code
) VALUES (
uuid('5e51e72c-d872-11ea-811c-0f8f10a32ea2'),
'BR1239719872',
DATE '2021-03-07',
'AA32147122',
'Unicorn Inc.',
'Long horn',
'5, Lake View, By the lake',
DATE '2021-05-23',
'125, Wall St, Next door',
DATE '2020-08-01',
'SMDG-ZIM'
);
Loading

0 comments on commit d0798b6

Please sign in to comment.