Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes (de persister) according to relationship table #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions egov-persister/department-entity-persister.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ serviceMaps:
isTransaction: true
queryMaps:

- query: INSERT INTO department_entity(id, tenant_id, department_id, code, name, hierarchy_level, children, created_by, last_modified_by, created_time, last_modified_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
- query: INSERT INTO department_entity(id, tenant_id, department_id, code, name, hierarchy_level, created_by, last_modified_by, created_time, last_modified_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
basePath: departmentEntity.*
jsonMaps:
- jsonPath: $.departmentEntity.*.id
Expand All @@ -22,8 +22,6 @@ serviceMaps:

- jsonPath: $.departmentEntity.*.hierarchyLevel

- jsonPath: $.departmentEntity.*.children

- jsonPath: $.departmentEntity.*.createdBy

- jsonPath: $.departmentEntity.*.lastModifiedBy
Expand All @@ -32,12 +30,22 @@ serviceMaps:

- jsonPath: $.departmentEntity.*.lastModifiedTime

- query: INSERT INTO department_entity_relationship(parent_id, child_id, is_true) VALUES (?, ?, ?);
basePath: departmentEntityRelationship.*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of keeping this parallel to the departmentEntity object, make this a sub object of departmentEntity.

Copy link
Contributor Author

@rahu-eGov rahu-eGov Jan 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both are independent entity as term of data insertion and update.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. These are not independent entities. The relationship is part of the parent.

jsonMaps:

- jsonPath: $.departmentEntityRelationship.*.parentId

- jsonPath: $.departmentEntityRelationship.*.childId

- jsonPath: $.departmentEntityRelationship.*.isTrue

- version: 1.0
description: Update departemnt entity details in tables
fromTopic: update-dept-entity-application
isTransaction: true
queryMaps:
- query: UPDATE department_entity SET tenant_id = ?,department_id = ?,code = ?,name = ?, hierarchy_level = ?, children = ?, last_modified_by = ?, last_modified_time = ? WHERE id=?;
- query: UPDATE department_entity SET tenant_id = ?,department_id = ?,code = ?,name = ?, hierarchy_level = ?, last_modified_by = ?, last_modified_time = ? WHERE id=?;
basePath: departmentEntity.*
jsonMaps:

Expand All @@ -51,13 +59,27 @@ serviceMaps:

- jsonPath: $.departmentEntity.*.hierarchyLevel

- jsonPath: $.departmentEntity.*.children

- jsonPath: $.departmentEntity.*.lastModifiedBy

- jsonPath: $.departmentEntity.*.lastModifiedTime

- jsonPath: $.departmentEntity.*.id

- query: INSERT INTO department_entity_relationship(parent_id, child_id, is_true) VALUES (?, ?, ?) ON CONFLICT (parent_id, child_id) DO UPDATE SET parent_id = ?,child_id = ?,is_true = ?;
basePath: departmentEntityRelationship.*
jsonMaps:

- jsonPath: $.departmentEntityRelationship.*.parentId

- jsonPath: $.departmentEntityRelationship.*.childId

- jsonPath: $.departmentEntityRelationship.*.isTrue

- jsonPath: $.departmentEntityRelationship.*.parentId

- jsonPath: $.departmentEntityRelationship.*.childId

- jsonPath: $.departmentEntityRelationship.*.isTrue

- version: 1.0
description: Save department hierarchy level in table
Expand Down