You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.7 KiB
42 lines
1.7 KiB
import {Condition, OptionalConditionSerializer} from "./Condition.js";
|
|
import {GuidedEmpathy} from "./GuidedEmpathy.js";
|
|
import {OptionalSuicidalitySerializer, Suicidality} from "./Suicidality.js";
|
|
import {SleepRecord} from "./SleepRecord.js";
|
|
import {DateTime} from "luxon";
|
|
import {DateTimeSerializer, ObjectSerializer, OptionalStringSerializer} from "../schemata/Serialization.js";
|
|
|
|
export interface BaseEntry {
|
|
readonly condition?: Condition
|
|
readonly summary?: string
|
|
readonly journalEntry?: string
|
|
readonly guidedEmpathy?: readonly GuidedEmpathy[]
|
|
readonly sleepRecords?: readonly SleepRecord[]
|
|
// readonly needs?: Needs
|
|
// readonly music?: readonly string[]
|
|
// readonly rpg?: RPGStats
|
|
// readonly personas?: Personas
|
|
// readonly activities?: readonly Activity[]
|
|
readonly suicidality?: Suicidality
|
|
// readonly recoveries?: readonly Recovery[]
|
|
}
|
|
|
|
export interface Entry extends BaseEntry {
|
|
readonly startedAt: DateTime
|
|
readonly finishedAt: DateTime
|
|
}
|
|
|
|
export interface SerializedEntry extends BaseEntry {
|
|
readonly startedAt: string
|
|
readonly finishedAt: string
|
|
}
|
|
|
|
export const EntrySerializer = new ObjectSerializer<Entry, SerializedEntry, keyof Entry>({
|
|
startedAt: DateTimeSerializer,
|
|
finishedAt: DateTimeSerializer,
|
|
condition: OptionalConditionSerializer,
|
|
summary: OptionalStringSerializer,
|
|
journalEntry: OptionalStringSerializer,
|
|
guidedEmpathy: OptionalArrayGuidedEmpathySerializer,
|
|
sleepRecords: OptionalArraySleepRecordSerializer,
|
|
suicidality: OptionalSuicidalitySerializer,
|
|
}, ["startedAt", "finishedAt", "condition", "summary", "journalEntry", "guidedEmpathy", "sleepRecords", "suicidality"]) |