Skip to content

Commit

Permalink
Make enum properties checked keyof strings
Browse files Browse the repository at this point in the history
  • Loading branch information
s0 committed Nov 3, 2021
1 parent 70b2c29 commit 948d97d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/db/models/location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ export type LocationId = Brand<

export const LOCATION_ID = brandedType<number, LocationId>(t.number);

const LOCATION_STATUS = {
const LOCATION_STATUS = t.keyof({
active: null,
expired: null,
};
});

export default defineIDModel({
tableName: 'location',
Expand All @@ -38,8 +38,8 @@ export default defineIDModel({
accidentallyOptional: {
adminLevel: { kind: 'checked', type: t.number },
status: {
kind: 'enum',
values: LOCATION_STATUS,
kind: 'checked',
type: LOCATION_STATUS,
},
itosSync: { kind: 'checked', type: t.boolean },
},
Expand Down
8 changes: 4 additions & 4 deletions src/db/models/planVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ export type PlanVersionId = Brand<

export const PLAN_VERSION_ID = brandedType<number, PlanVersionId>(t.number);

const PLAN_VERSION_CLUSTER_SELECTION_TYPE = {
const PLAN_VERSION_CLUSTER_SELECTION_TYPE = t.keyof({
single: null,
multi: null,
};
});

export default defineLegacyVersionedModel({
tableName: 'planVersion',
Expand Down Expand Up @@ -46,8 +46,8 @@ export default defineLegacyVersionedModel({
lastPublishedReportingPeriodId: { kind: 'checked', type: t.number },
// Even though this column isn't defined using DB enum only two values are used
clusterSelectionType: {
kind: 'enum',
values: PLAN_VERSION_CLUSTER_SELECTION_TYPE,
kind: 'checked',
type: PLAN_VERSION_CLUSTER_SELECTION_TYPE,
},
},
},
Expand Down

0 comments on commit 948d97d

Please sign in to comment.