Skip to content

Commit

Permalink
add shipment_address_updates info to move history logs
Browse files Browse the repository at this point in the history
  • Loading branch information
traskowskycaci committed Jan 10, 2025
1 parent 7055ac6 commit edcd335
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 10 deletions.
1 change: 1 addition & 0 deletions migrations/app/migrations_manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1070,3 +1070,4 @@
20241230190647_add_missing_AK_zips_to_zip3_distances.up.sql
20250103130619_revert_data_change_for_gbloc_for_ak.up.sql
20250103180420_update_pricing_proc_to_use_local_price_variable.up.sql
20250110153428_add_shipment_address_updates_to_move_history.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- adding shipment_address_updates table to move history so we can track the activity
SELECT add_audit_history_table(
target_table := 'shipment_address_updates',
audit_rows := BOOLEAN 't',
audit_query_text := BOOLEAN 't',
ignored_cols := ARRAY[
'created_at'
]
);
20 changes: 20 additions & 0 deletions pkg/assets/sql_scripts/move_history_fetcher.sql
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,21 @@ WITH move AS (
JOIN gsr_appeals ON gsr_appeals.id = audit_history.object_id
WHERE audit_history.table_name = 'gsr_appeals'
),
move_shipment_address_updates AS (
SELECT shipment_address_updates.*
FROM
shipment_address_updates
WHERE
shipment_address_updates.shipment_id = (SELECT id FROM move_shipments.id)
),
shipment_address_updates_logs as (
SELECT audit_history.*,
NULL AS context,
NULL AS context_id
FROM
audit_history
JOIN move_shipment_address_updates ON move_shipment_address_updates.id = audit_history.object_id
),
combined_logs AS (
SELECT
*
Expand Down Expand Up @@ -732,6 +747,11 @@ WITH move AS (
*
FROM
gsr_appeals_logs
UNION
SELECT
*
FROM
shipment_address_updates_logs


)
Expand Down
6 changes: 4 additions & 2 deletions pkg/gen/ghcapi/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import t from 'constants/MoveHistory/Database/Tables';
export default {
action: a.UPDATE,
eventName: o.reviewShipmentAddressUpdate,
tableName: t.moves,
tableName: t.shipment_address_updates,
getEventNameDisplay: () => {
return 'Shipment Destination Address Request';
},
Expand All @@ -20,7 +20,11 @@ export default {
);
}
if (changedValues.status === 'REJECTED') {
return 'Rejected';
return (
<div>
<b>Status</b>: Rejected
</div>
);
}
return null;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('when given a Review Shipment Address Update history record', () => {
},
context,
eventName: o.reviewShipmentAddressUpdate,
tableName: t.moves,
tableName: t.shipment_address_updates,
};

const template = getTemplate(historyRecord);
Expand All @@ -37,7 +37,7 @@ describe('when given a Review Shipment Address Update history record', () => {
},
context,
eventName: o.reviewShipmentAddressUpdate,
tableName: t.moves,
tableName: t.shipment_address_updates,
};

const template = getTemplate(historyRecord);
Expand All @@ -55,13 +55,14 @@ describe('when given a Review Shipment Address Update history record', () => {
},
context,
eventName: o.reviewShipmentAddressUpdate,
tableName: t.moves,
tableName: t.shipment_address_updates,
};

const template = getTemplate(historyRecord);

render(template.getDetails(historyRecord));
expect(screen.getByText('Rejected')).toBeInTheDocument();
expect(screen.getByText('Status')).toBeInTheDocument();
expect(screen.getByText(/Rejected/)).toBeInTheDocument();
});

it('returns null if the status is not "APPROVED" or "REJECTED"', () => {
Expand All @@ -72,7 +73,7 @@ describe('when given a Review Shipment Address Update history record', () => {
},
context,
eventName: o.reviewShipmentAddressUpdate,
tableName: t.moves,
tableName: t.shipment_address_updates,
};

const template = getTemplate(historyRecord);
Expand Down
1 change: 1 addition & 0 deletions swagger-def/ghc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,7 @@ paths:
$ref: '#/responses/ServerError'
tags:
- shipment
- shipment_address_updates
description: This endpoint is used to approve a address update request. Office remarks are required.
Approving the address update will update the Destination Final Address of the associated service item
operationId: reviewShipmentAddressUpdate
Expand Down
1 change: 1 addition & 0 deletions swagger/ghc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,7 @@ paths:
$ref: '#/responses/ServerError'
tags:
- shipment
- shipment_address_updates
description: >-
This endpoint is used to approve a address update request. Office
remarks are required. Approving the address update will update the
Expand Down

0 comments on commit edcd335

Please sign in to comment.