From 606c7b4b96008f30979bab3c6e118343424eccc8 Mon Sep 17 00:00:00 2001 From: enxtur Date: Wed, 17 Apr 2024 00:35:05 +0800 Subject: [PATCH 1/5] HPC-9489: Add `planLanguage` to categoryGroup --- src/db/models/categoryGroup.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/db/models/categoryGroup.ts b/src/db/models/categoryGroup.ts index 3571169a..41e374ac 100644 --- a/src/db/models/categoryGroup.ts +++ b/src/db/models/categoryGroup.ts @@ -20,6 +20,7 @@ export const CATEGORY_GROUP_TYPE = t.keyof({ pendingStatus: null, planCosting: null, planIndicated: null, + planLanguage: null, planType: null, projectGrouping1: null, projectGrouping2: null, From 8cf5761d2e3df1ee3706049c0d11f1ffb2ad0261 Mon Sep 17 00:00:00 2001 From: enxtur Date: Wed, 17 Apr 2024 00:38:43 +0800 Subject: [PATCH 2/5] HPC-9489: Add planVersionOrganization model --- src/db/index.ts | 2 ++ src/db/models/planVersionOrganization.ts | 14 ++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 src/db/models/planVersionOrganization.ts diff --git a/src/db/index.ts b/src/db/index.ts index 6dd0e197..18b2d2d7 100644 --- a/src/db/index.ts +++ b/src/db/index.ts @@ -71,6 +71,7 @@ import planLocation from './models/planLocation'; import planReportingPeriod from './models/planReportingPeriod'; import planTag from './models/planTag'; import planVersion from './models/planVersion'; +import planVersionOrganization from './models/planVersionOrganization'; import planYear from './models/planYear'; import procedureEntityPrototype from './models/procedureEntityPrototype'; import procedureSection from './models/procedureSection'; @@ -189,6 +190,7 @@ const initializeTables = (masterConn: Knex, replicaConn?: Knex) => ({ planReportingPeriod: planReportingPeriod(masterConn, replicaConn), planTag: planTag(masterConn, replicaConn), planVersion: planVersion(masterConn, replicaConn), + planVersionOrganization: planVersionOrganization(masterConn, replicaConn), planYear: planYear(masterConn, replicaConn), procedureEntityPrototype: procedureEntityPrototype(masterConn, replicaConn), procedureSection: procedureSection(masterConn, replicaConn), diff --git a/src/db/models/planVersionOrganization.ts b/src/db/models/planVersionOrganization.ts new file mode 100644 index 00000000..985ba3c1 --- /dev/null +++ b/src/db/models/planVersionOrganization.ts @@ -0,0 +1,14 @@ +import { defineSequelizeModel } from '../util/sequelize-model'; +import { ORGANIZATION_ID } from './organization'; +import { PLAN_VERSION_ID } from './planVersion'; + +export default defineSequelizeModel({ + tableName: 'planVersionOrganization', + fields: { + required: { + organizationId: { kind: 'branded-integer', brand: ORGANIZATION_ID }, + planVersionId: { kind: 'branded-integer', brand: PLAN_VERSION_ID }, + }, + }, + softDeletionEnabled: false, +}); From bdc955aec6dc7893da85fdd1fdbf2478142a1049 Mon Sep 17 00:00:00 2001 From: enxtur Date: Wed, 17 Apr 2024 00:44:57 +0800 Subject: [PATCH 3/5] HPC-9489: Add new fields to PlanVersion model - shortName - pdfPublishDate - subtitle - isPartOfGHO --- src/db/models/planVersion.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/db/models/planVersion.ts b/src/db/models/planVersion.ts index dbd6f056..bfcd2d10 100644 --- a/src/db/models/planVersion.ts +++ b/src/db/models/planVersion.ts @@ -37,6 +37,7 @@ export default defineLegacyVersionedModel({ kind: 'checked', type: PLAN_VISIBILITY_PREFERENCES, }, + isPartOfGHO: { kind: 'checked', type: t.boolean }, }, required: { planId: { kind: 'branded-integer', brand: PLAN_ID }, @@ -57,6 +58,11 @@ export default defineLegacyVersionedModel({ kind: 'checked', type: PLAN_VERSION_CLUSTER_SELECTION_TYPE, }, + pdfPublishDate: { kind: 'checked', type: DATE }, + }, + accidentallyOptional: { + shortName: { kind: 'checked', type: t.string }, + subtitle: { kind: 'checked', type: t.string }, }, }, idField: 'id', From 3ae52a0ff74613f63644f43d4214bb26cd72adbf Mon Sep 17 00:00:00 2001 From: enxtur Date: Thu, 18 Apr 2024 22:03:03 +0800 Subject: [PATCH 4/5] HPC-9489: Add release fields to plan model --- src/db/models/plan.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/db/models/plan.ts b/src/db/models/plan.ts index 16dab09b..fae97352 100644 --- a/src/db/models/plan.ts +++ b/src/db/models/plan.ts @@ -2,6 +2,7 @@ import * as t from 'io-ts'; import { brandedType } from '../../util/io-ts'; import type { Brand } from '../../util/types'; +import { DATE } from '../util/datatypes'; import { defineIDModel } from '../util/id-model'; export type PlanId = Brand; @@ -26,6 +27,10 @@ export default defineIDModel({ }, optional: { revisionState: { kind: 'checked', type: PLAN_REVISION_STATE }, + releasedDate: { kind: 'checked', type: DATE }, + }, + nonNullWithDefault: { + isReleased: { kind: 'checked', type: t.boolean }, }, }, idField: 'id', From 608e81c828a253fdf72a692372423fd48e8a6e4a Mon Sep 17 00:00:00 2001 From: enxtur Date: Fri, 5 Jul 2024 01:19:02 +0800 Subject: [PATCH 5/5] HPC-9489: Add `planClusterType` to categoryGroup --- src/db/models/categoryGroup.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/db/models/categoryGroup.ts b/src/db/models/categoryGroup.ts index 41e374ac..d190b811 100644 --- a/src/db/models/categoryGroup.ts +++ b/src/db/models/categoryGroup.ts @@ -18,6 +18,7 @@ export const CATEGORY_GROUP_TYPE = t.keyof({ organizationLevel: null, organizationType: null, pendingStatus: null, + planClusterType: null, planCosting: null, planIndicated: null, planLanguage: null,