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

🐛 Correct properties for attachment model #31

Merged
merged 4 commits into from
Nov 3, 2021
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@unocha/hpc-api-core",
"version": "0.2.0",
"version": "0.2.1",
"description": "Core libraries supporting HPC.Tools API Backend",
"license": "Apache-2.0",
"private": false,
Expand Down
15 changes: 10 additions & 5 deletions src/db/models/attachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { brandedType } from '../../util/io-ts';

import type { Brand } from '../../util/types';
import { defineLegacyVersionedModel } from '../util/legacy-versioned-model';
import { ATTACHMENT_PROTOTYPE_ID } from './attachmentPrototype';
import {
ATTACHMENT_PROTOTYPE_ID,
ATTACHMENT_TYPE,
} from './attachmentPrototype';
import { PLAN_ID } from './plan';

export type AttachmentId = Brand<
Expand All @@ -14,8 +17,10 @@ export type AttachmentId = Brand<

export const ATTACHMENT_ID = brandedType<number, AttachmentId>(t.number);

export const COST_ATTACHMENT_VALUE = t.type({
cost: t.number,
export const ATTACHMENT_OBJECT_TYPE = t.keyof({
governingEntity: null,
plan: null,
planEntity: null,
});

export default defineLegacyVersionedModel({
Expand Down Expand Up @@ -44,11 +49,11 @@ export default defineLegacyVersionedModel({
},
objectType: {
kind: 'checked',
type: t.string,
type: ATTACHMENT_OBJECT_TYPE,
},
type: {
kind: 'checked',
type: t.string,
type: ATTACHMENT_TYPE,
},
},
},
Expand Down
1 change: 0 additions & 1 deletion src/db/models/planVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export default defineLegacyVersionedModel({
brand: PLAN_REPORTING_PERIOD_ID,
},
lastPublishedReportingPeriodId: { kind: 'checked', type: t.number },
// Even though this column isn't defined using DB enum only two values are used
clusterSelectionType: {
kind: 'checked',
type: PLAN_VERSION_CLUSTER_SELECTION_TYPE,
Expand Down