-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
reportDetail
, reportFile
to v4 models
- Loading branch information
Showing
3 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import * as t from 'io-ts'; | ||
|
||
import { defineSequelizeModel } from '../util/sequelize-model'; | ||
import { Brand } from '../../util/types'; | ||
import { brandedType } from '../../util/io-ts'; | ||
import { FLOW_ID } from './flow'; | ||
import { DATE } from '../util/datatypes'; | ||
import { ORGANIZATION_ID } from './organization'; | ||
|
||
export type ReportDetailId = Brand< | ||
number, | ||
{ readonly s: unique symbol }, | ||
'reportDetail.id' | ||
>; | ||
|
||
export const REPORT_DETAIL_ID = brandedType<number, ReportDetailId>(t.number); | ||
|
||
export default defineSequelizeModel({ | ||
tableName: 'reportDetail', | ||
fields: { | ||
generated: { | ||
id: { kind: 'branded-integer', brand: REPORT_DETAIL_ID }, | ||
}, | ||
required: { | ||
flowID: { kind: 'branded-integer', brand: FLOW_ID }, | ||
source: { kind: 'checked', type: t.string }, | ||
}, | ||
nonNullWithDefault: { | ||
versionID: { kind: 'checked', type: t.number }, | ||
verified: { kind: 'checked', type: t.boolean }, | ||
}, | ||
optional: { | ||
contactInfo: { kind: 'checked', type: t.string }, | ||
date: { kind: 'checked', type: DATE }, | ||
sourceID: { kind: 'checked', type: t.string }, | ||
refCode: { kind: 'checked', type: t.string }, | ||
organizationID: { kind: 'checked', type: ORGANIZATION_ID }, | ||
}, | ||
}, | ||
softDeletionEnabled: false, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import * as t from 'io-ts'; | ||
|
||
import { defineSequelizeModel } from '../util/sequelize-model'; | ||
import { Brand } from '../../util/types'; | ||
import { brandedType } from '../../util/io-ts'; | ||
import { FILE_ASSET_ENTITY_ID } from './fileAssetEntity'; | ||
import { REPORT_DETAIL_ID } from './reportDetail'; | ||
|
||
export type ReportFileId = Brand< | ||
number, | ||
{ readonly s: unique symbol }, | ||
'reportFile.id' | ||
>; | ||
|
||
export const REPORT_FILE_TYPE = t.keyof({ | ||
file: null, | ||
url: null, | ||
}); | ||
|
||
export const REPORT_FILE_ID = brandedType<number, ReportFileId>(t.number); | ||
|
||
export default defineSequelizeModel({ | ||
tableName: 'reportFile', | ||
fields: { | ||
generated: { | ||
id: { kind: 'branded-integer', brand: REPORT_FILE_ID }, | ||
}, | ||
required: { | ||
reportID: { kind: 'branded-integer', brand: REPORT_DETAIL_ID }, | ||
title: { kind: 'checked', type: t.string }, | ||
type: { kind: 'checked', type: REPORT_FILE_TYPE }, | ||
}, | ||
optional: { | ||
url: { kind: 'checked', type: t.string }, | ||
fileAssetID: { kind: 'checked', type: FILE_ASSET_ENTITY_ID }, | ||
}, | ||
}, | ||
softDeletionEnabled: false, | ||
}); |