Skip to content

Commit

Permalink
Define CrestDisposal, OffenceCode and ResultCode types in npm package
Browse files Browse the repository at this point in the history
These types are also defined in ./src and used when merging offence code data or mapping data into native types. We import these types in next-core, therefore it makes sence to define in the package with a strict type declaratiion
  • Loading branch information
C-gyorfi committed May 4, 2022
1 parent c1246a5 commit 96487ff
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 4 deletions.
7 changes: 3 additions & 4 deletions output-data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import {
Amount,
Country,
CourtType,
CrestDisposal,
DefendantPresentAtHearing,
DurationType,
DurationUnit,
Gender,
ModeOfTrialReason,
Number,
OffenceCategory,
OffenceCode,
OffenceInitiation,
OrganisationUnit,
PleaStatus,
Expand All @@ -19,6 +21,7 @@ import {
Qualifier,
RemandStatus,
ResultClass,
ResultCode,
ResultQualifierCode,
Summons,
TargetCourtType,
Expand All @@ -28,10 +31,6 @@ import {
YesNo
} from "./types/types"

import { OffenceCode } from "../src/types/OffenceCode"
import { CrestDisposal } from "../src/types/CrestDisposal"
import { ResultCode } from "../src/types/ResultCode"

import actualOffenceDateData from "./data/actual-offence-date.json"
import alcoholLevelMethodData from "./data/alcohol-level-method.json"
import amountData from "./data/amount.json"
Expand Down
49 changes: 49 additions & 0 deletions output-data/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,30 @@ type AlcoholLevelMethod = {

type Country = CjsCodeAndDescription
type CourtType = CjsCodeAndDescription

type CrestDisposal = {
amountInResult: string
amountInResultType: string
dateInResult: string
disposalCode: string
duration: string
durationType: string
durationUnit: string
exception?: boolean
hoQualifiers: string
hoResultCode: string
id: string
needsMapping: boolean
numberInResult: string
numberInResultType: string
qData: string
qDilSeqNo: string
rData: string
rDilSeqNo: string
template: string
timeInResult: string
}

type DefendantPresentAtHearing = CjsCodeAndDescription
type DurationType = CjsCodeAndDescription

Expand All @@ -35,6 +59,18 @@ type ModeOfTrialReason = {

type Number = CjsCodeAndDescription
type OffenceCategory = CjsCodeAndDescription

type OffenceCode = {
cjsCode: string
description: string
homeOfficeClassification: string
notifiableToHo?: boolean
offenceCategory: string
offenceTitle: string
recordableOnPnc?: boolean
resultHalfLifeHours?: string | null
}

type OffenceInitiation = CjsCodeAndDescription

type OrganisationUnit = {
Expand Down Expand Up @@ -72,6 +108,16 @@ type PncDisposal = {
type Qualifier = CjsCodeAndDescription
type RemandStatus = PleaStatus
type ResultClass = CjsCodeAndDescription

type ResultCode = {
cjsCode: string
description: string
recordableOnPnc?: boolean
resultCodeQualifiers: string
resultHalfLifeHours: string
type: string
}

type ResultQualifierCode = CjsCodeAndDescription
type Summons = CjsCodeAndDescription
type TargetCourtType = CjsCodeAndDescription
Expand All @@ -86,13 +132,15 @@ export {
Amount,
Country,
CourtType,
CrestDisposal,
DefendantPresentAtHearing,
DurationType,
DurationUnit,
Gender,
ModeOfTrialReason,
Number,
OffenceCategory,
OffenceCode,
OffenceInitiation,
OrganisationUnit,
PleaStatus,
Expand All @@ -101,6 +149,7 @@ export {
Qualifier,
RemandStatus,
ResultClass,
ResultCode,
ResultQualifierCode,
Summons,
TargetCourtType,
Expand Down

0 comments on commit 96487ff

Please sign in to comment.