Skip to content

Commit

Permalink
MODFQMMGR-497 Update instance date fields
Browse files Browse the repository at this point in the history
Inventory storage is removing the old publication period start/end date
fields and replacing it with a more general 'dates' object. This commit
removes the old publication_period_start/end fields from simple_instance
and replaces them with a new simple entity type
(simple_instance_date_type), which is joined with simple_instance in
composite_instances. The old fields are being replaced in the DB, so we
don't need to bother keeping the old field definitions around
  • Loading branch information
mweaver-ebsco committed Oct 7, 2024
1 parent adae3d0 commit ada53c2
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 7 deletions.
6 changes: 5 additions & 1 deletion descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,11 @@
},
{
"id": "instance-storage",
"version": "10.0"
"version": "10.0 11.0"
},
{
"id": "instance-date-types",
"version": "1.0"
},
{
"id": "instance-types",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,15 @@
</createView>
</changeSet>

<changeSet id="create_view_instance_date_type" runOnChange="true" author="[email protected]">
<preConditions onFail="CONTINUE">
<tableExists tableName="instance_date_type" schemaName="${tenant_id}_mod_inventory_storage" />
</preConditions>
<createView
replaceIfExists="true"
viewName="src_inventory_instance_date_type">
SELECT * FROM ${tenant_id}_mod_inventory_storage.instance_date_type
</createView>
</changeSet>

</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@
condition: ':this.id = :that.instanceTypeId',
},
},
{
alias: 'date_type',
type: 'entity-type',
id: '2d4bd468-720e-42b2-af41-8f4a9d7cb335', // simple_instance_date_type
essentialOnly: true,
join: {
type: 'left join',
joinTo: 'instance.inst',
condition: ":this.id = (:that.jsonb -> 'dates') ->> 'dateTypeId'",
},
},
],
defaultSort: [
{
Expand Down
21 changes: 17 additions & 4 deletions src/main/resources/entity-types/inventory/simple_instance.json5
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,19 @@
)",
},
{
name: 'publication_period_start',
name: 'instance_date_1',
sourceAlias: 'inst',
essential: true,
dataType: {
dataType: 'dateType',
},
isIdColumn: false,
queryable: true,
visibleByDefault: false,
valueGetter: ":sourceAlias.jsonb->'dates'->>'date1'",
},
{
name: 'instance_date_2',
sourceAlias: 'inst',
essential: true,
dataType: {
Expand All @@ -679,19 +691,20 @@
isIdColumn: false,
queryable: true,
visibleByDefault: false,
valueGetter: ":sourceAlias.jsonb->'publicationPeriod'->>'start'",
valueGetter: ":sourceAlias.jsonb->'dates'->>'date1'",
},
{
name: 'publication_period_end',
name: 'instance_date_type_id',
sourceAlias: 'inst',
essential: true,
dataType: {
dataType: 'integerType',
},
isIdColumn: false,
queryable: true,
hidden: true,
visibleByDefault: false,
valueGetter: ":sourceAlias.jsonb->'publicationPeriod'->>'end'",
valueGetter: ":sourceAlias.jsonb->'date'->>'dateTypeId'",
},
{
name: 'electronic_access',
Expand Down
63 changes: 63 additions & 0 deletions src/main/resources/entity-types/simple_instance_date_type.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
id: '2d4bd468-720e-42b2-af41-8f4a9d7cb335',
name: 'simple_instance_date_type',
sources: [
{
alias: 'date_type',
type: 'db',
target: 'src_inventory_instance_date_type',
},
],
requiredPermissions: [
'inventory-storage.instance-date-types.collection.get',
],
columns: [
{
name: 'id',
dataType: {
dataType: 'rangedUUIDType',
},
isIdColumn: true,
queryable: true,
hidden: true,
essential: true,
valueGetter: ':date_type.id',
},
{
name: 'name',
dataType: {
dataType: 'stringType',
},
idColumnName: 'id',
queryable: true,
essential: true,
valueGetter: ":date_type.jsonb ->> 'name'",
source: {
entityTypeId: '2d4bd468-720e-42b2-af41-8f4a9d7cb335',
columnName: 'name',
},
valueSourceApi: {
path: 'instance-date-types',
valueJsonPath: '$.instanceDateTypes.*.id',
labelJsonPath: '$.instanceDateTypes.*.name',
},
},
{
name: 'code',
dataType: {
dataType: 'stringType',
},
idColumnName: 'id',
queryable: true,
valueGetter: ":date_type.jsonb ->> 'code'",
source: {
entityTypeId: '2d4bd468-720e-42b2-af41-8f4a9d7cb335',
columnName: 'code',
},
valueSourceApi: {
valueJsonPath: '$.instanceDateTypes.*.id',
labelJsonPath: '$.instanceDateTypes.*.code',
},
},
],
}
9 changes: 7 additions & 2 deletions translations/mod-fqm-manager/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,9 @@
"entityType.simple_instance.identifiers.value._qualified": "Identifiers value",
"entityType.simple_instance.index_title": "Index title",
"entityType.simple_instance.instance_format_ids": "Instance format UUIDs",
"entityType.simple_instance.instance_date_1": "Date 1",
"entityType.simple_instance.instance_date_2": "Date 2",
"entityType.simple_instance.instance_date_type_id": "Date type ID",
"entityType.simple_instance.instance_type_id": "Resource type UUID",
"entityType.simple_instance.instance_type_name": "Resource type",
"entityType.simple_instance.jsonb": "JSONB",
Expand Down Expand Up @@ -699,8 +702,6 @@
"entityType.simple_instance.publication.role": "Role",
"entityType.simple_instance.publication.role._qualified": "Publication role",
"entityType.simple_instance.publication_frequency": "Publication frequency",
"entityType.simple_instance.publication_period_end": "Publication end year",
"entityType.simple_instance.publication_period_start": "Publication start year",
"entityType.simple_instance.publication_range": "Publication range",
"entityType.simple_instance.series": "Series",
"entityType.simple_instance.shared": "Shared",
Expand All @@ -718,6 +719,10 @@
"entityType.simple_instance.updated_at": "Updated date",
"entityType.simple_instance.updated_by": "Updated by user UUID",
"entityType.simple_instance.version": "Record version",
"entityType.simple_instance_date_type": "Instance date type",
"entityType.simple_instance_date_type.id": "ID",
"entityType.simple_instance_date_type.name": "Name",
"entityType.simple_instance_date_type.code": "Code",
"entityType.simple_instance_status": "Instance status name",
"entityType.simple_instance_status.code": "Code",
"entityType.simple_instance_status.created_by_user_id": "Created by user UUID",
Expand Down

0 comments on commit ada53c2

Please sign in to comment.