Compare commits

..

No commits in common. "47f0a08ea3dbd8b1721a11c52b36c42ad56e8e29" and "ad796dcb578b79b566559d1c22c99f0231a03251" have entirely different histories.

7 changed files with 18 additions and 42 deletions

View file

@ -7,8 +7,7 @@ COPY package.json pnpm-lock.yaml run/entrypoint.sh ./
COPY prisma ./prisma COPY prisma ./prisma
# Setup pnpm, install Prisma CLI (for generating client) and install dependencies # Setup pnpm, install Prisma CLI (for generating client) and install dependencies
RUN apk add dumb-init && \ RUN npm config set update-notifier false && \
npm config set update-notifier false && \
corepack enable && \ corepack enable && \
pnpm i --prod && \ pnpm i --prod && \
pnpm audit fix && \ pnpm audit fix && \

View file

@ -28,7 +28,8 @@
"qs": "^6.12.1", "qs": "^6.12.1",
"set-cookie-parser": "^2.6.0", "set-cookie-parser": "^2.6.0",
"svelte-floating-ui": "^1.5.8", "svelte-floating-ui": "^1.5.8",
"zod": "^3.23.8" "zod": "^3.23.8",
"zod-form-data": "^2.0.2"
}, },
"devDependencies": { "devDependencies": {
"@faker-js/faker": "^8.4.1", "@faker-js/faker": "^8.4.1",

View file

@ -41,6 +41,9 @@ dependencies:
zod: zod:
specifier: ^3.23.8 specifier: ^3.23.8
version: 3.23.8 version: 3.23.8
zod-form-data:
specifier: ^2.0.2
version: 2.0.2(zod@3.23.8)
devDependencies: devDependencies:
'@faker-js/faker': '@faker-js/faker':
@ -5958,6 +5961,14 @@ packages:
dev: true dev: true
optional: true optional: true
/zod-form-data@2.0.2(zod@3.23.8):
resolution: {integrity: sha512-sKTi+k0fvkxdakD0V5rq+9WVJA3cuTQUfEmNqvHrTzPLvjfLmkkBLfR0ed3qOi9MScJXTHIDH/jUNnEJ3CBX4g==}
peerDependencies:
zod: '>= 3.11.0'
dependencies:
zod: 3.23.8
dev: false
/zod-to-json-schema@3.23.0(zod@3.23.8): /zod-to-json-schema@3.23.0(zod@3.23.8):
resolution: {integrity: sha512-az0uJ243PxsRIa2x1WmNE/pnuA05gUq/JB8Lwe1EDCCL/Fz9MgjYQ0fPlyc2Tcv6aF2ZA7WM5TWaRZVEFaAIag==} resolution: {integrity: sha512-az0uJ243PxsRIa2x1WmNE/pnuA05gUq/JB8Lwe1EDCCL/Fz9MgjYQ0fPlyc2Tcv6aF2ZA7WM5TWaRZVEFaAIag==}
requiresBuild: true requiresBuild: true

View file

@ -1,16 +0,0 @@
/*
Warnings:
- A unique constraint covering the columns `[name]` on the table `categories` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[name]` on the table `rooms` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[name]` on the table `stations` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateIndex
CREATE UNIQUE INDEX "categories_name_key" ON "categories"("name");
-- CreateIndex
CREATE UNIQUE INDEX "rooms_name_key" ON "rooms"("name");
-- CreateIndex
CREATE UNIQUE INDEX "stations_name_key" ON "stations"("name");

View file

@ -50,7 +50,7 @@ model User {
// Hospital station // Hospital station
model Station { model Station {
id Int @id @default(autoincrement()) id Int @id @default(autoincrement())
name String @unique name String
Room Room[] Room Room[]
hidden Boolean @default(false) hidden Boolean @default(false)
@ -60,7 +60,7 @@ model Station {
// Hospital room // Hospital room
model Room { model Room {
id Int @id @default(autoincrement()) id Int @id @default(autoincrement())
name String @unique name String
station Station @relation(fields: [station_id], references: [id], onDelete: Restrict) station Station @relation(fields: [station_id], references: [id], onDelete: Restrict)
station_id Int station_id Int
Patient Patient[] Patient Patient[]
@ -90,7 +90,7 @@ model Patient {
// Entry category (e.g. Blood test, Exams, ...) // Entry category (e.g. Blood test, Exams, ...)
model Category { model Category {
id Int @id @default(autoincrement()) id Int @id @default(autoincrement())
name String @unique name String
color String? color String?
description String? description String?
EntryVersion EntryVersion[] EntryVersion EntryVersion[]

View file

@ -1,4 +1,4 @@
#!/usr/bin/dumb-init /bin/sh #!/bin/sh
set -e set -e
# Migrate database before starting server # Migrate database before starting server
npx prisma migrate deploy npx prisma migrate deploy

View file

@ -287,25 +287,6 @@ left join stations s on s.id = r.station_id`,
qb.addFilterClause(`ev.date <= ${qb.pvar()}`, dateRange.end); qb.addFilterClause(`ev.date <= ${qb.pvar()}`, dateRange.end);
} }
}); });
const dfClauses: string[] = [];
const dfParams: Date[] = [];
filterListToArray(filter.date).forEach((itm) => {
const dateRange = DateRange.parse(itm, true);
const cl = [];
if (dateRange?.start) {
cl.push(`ev.date >= ${qb.pvar()}`);
dfParams.push(dateRange.start);
}
if (dateRange?.end) {
cl.push(`ev.date <= ${qb.pvar()}`);
dfParams.push(dateRange.end);
}
dfClauses.push(cl.join(" and "));
});
if (dfClauses.length > 0) {
qb.addFilterClause(dfClauses.join(" or "), ...dfParams);
}
} }
const SORT_FIELDS: Record<string, string[]> = { const SORT_FIELDS: Record<string, string[]> = {