diff --git a/.env b/.env index d40ebbf..a11858d 100644 --- a/.env +++ b/.env @@ -1,7 +1,8 @@ POSTGRES_DB=postgres POSTGRES_USER=postgres POSTGRES_PASSWORD=postgres -EXTERNAL_URL=http://localhost:3001 +EXTERNAL_URL=http://localhost:3000 +DOMAIN=localhost KEYCLOAK_ADMIN=admin KEYCLOAK_ADMIN_PASSWORD=password diff --git a/.env.example b/.env.example index 7ac02f9..3085f43 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,8 @@ POSTGRES_DB=postgres POSTGRES_USER=postgres POSTGRES_PASSWORD=postgres -EXTERNAL_URL=http://localhost:3001 +EXTERNAL_URL=http://localhost:3000 +DOMAIN=localhost KEYCLOAK_ADMIN=admin KEYCLOAK_ADMIN_PASSWORD=password diff --git a/.env.production.example b/.env.production.example index 29bf5a0..e06dd6f 100644 --- a/.env.production.example +++ b/.env.production.example @@ -2,6 +2,7 @@ POSTGRES_DB= POSTGRES_USER= POSTGRES_PASSWORD= EXTERNAL_URL= +DOMAIN= KEYCLOAK_ADMIN= KEYCLOAK_ADMIN_PASSWORD= diff --git a/prisma/migrations/20240912115114_initial/migration.sql b/prisma/migrations/20240912115114_initial/migration.sql index b967342..4f8c32a 100644 --- a/prisma/migrations/20240912115114_initial/migration.sql +++ b/prisma/migrations/20240912115114_initial/migration.sql @@ -162,4 +162,4 @@ ALTER TABLE "shlink_endpoint" ADD CONSTRAINT "shlink_endpoint_shlink_id_fkey" FO ALTER TABLE "shlink_endpoint" ADD CONSTRAINT "shlink_endpoint_server_config_id_fkey" FOREIGN KEY ("server_config_id") REFERENCES "server_config"("id") ON DELETE RESTRICT ON UPDATE CASCADE; -- AddForeignKey -ALTER TABLE "access_ticket" ADD CONSTRAINT "access_ticket_shlink_id_fkey" FOREIGN KEY ("shlink_id") REFERENCES "shlink"("id") ON DELETE RESTRICT ON UPDATE CASCADE; +ALTER TABLE "access_ticket" ADD CONSTRAINT "access_ticket_shlink_id_fkey" FOREIGN KEY ("shlink_id") REFERENCES "shlink"("id") ON DELETE RESTRICT ON UPDATE CASCADE; \ No newline at end of file diff --git a/prisma/migrations/20240927150538_added_created_updated_dates_to_schema/migration.sql b/prisma/migrations/20240927150538_added_created_updated_dates_to_schema/migration.sql new file mode 100644 index 0000000..3bd9687 --- /dev/null +++ b/prisma/migrations/20240927150538_added_created_updated_dates_to_schema/migration.sql @@ -0,0 +1,31 @@ +-- AlterTable +ALTER TABLE "access_ticket" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, +ADD COLUMN "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; + +-- AlterTable +ALTER TABLE "cas_item" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, +ADD COLUMN "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; + +-- AlterTable +ALTER TABLE "server_config" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, +ADD COLUMN "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; + +-- AlterTable +ALTER TABLE "shlink" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, +ADD COLUMN "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; + +-- AlterTable +ALTER TABLE "shlink_access" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, +ADD COLUMN "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; + +-- AlterTable +ALTER TABLE "shlink_endpoint" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, +ADD COLUMN "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; + +-- AlterTable +ALTER TABLE "shlink_file" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, +ADD COLUMN "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; + +-- AlterTable +ALTER TABLE "user" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, +ADD COLUMN "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 92a27ce..5c61546 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -8,33 +8,39 @@ datasource db { } model cas_item { - id String @id @unique @default(cuid()) @db.VarChar(43) - hash String @unique @db.VarChar(32) - content Bytes @unique - ref_count Int @default(0) - shlink_file shlink_file[] + id String @id @unique @default(cuid()) @db.VarChar(43) + created_at DateTime @default(now()) + updated_at DateTime @updatedAt @default(now()) + hash String @unique @db.VarChar(32) + content Bytes @unique + ref_count Int @default(0) + shlink_file shlink_file[] @@index([id], name: "idx_cas_item_hash") } model shlink_file { - id String @id @unique @default(cuid()) @db.VarChar(43) + id String @id @unique @default(cuid()) @db.VarChar(43) + created_at DateTime @default(now()) + updated_at DateTime @updatedAt @default(now()) shlink_id String - content_type String @default("application/json") + content_type String @default("application/json") content_hash String? - cas_item cas_item? @relation(fields: [content_hash], references: [hash]) - shlink shlink @relation(fields: [shlink_id], references: [id]) + cas_item cas_item? @relation(fields: [content_hash], references: [hash]) + shlink shlink @relation(fields: [shlink_id], references: [id]) @@index([shlink_id], name: "idx_shlink_file_shlinkId") @@index([content_hash], name: "idx_shlink_file_content_hash") } model shlink_access { - id String @id @default(cuid()) @db.VarChar(43) + id String @id @default(cuid()) @db.VarChar(43) + created_at DateTime @default(now()) + updated_at DateTime @updatedAt @default(now()) shlink_id String recipient String - access_time DateTime @default(now()) - shlink shlink @relation(fields: [shlink_id], references: [id]) + access_time DateTime @default(now()) + shlink shlink @relation(fields: [shlink_id], references: [id]) @@index([shlink_id], name: "idx_shlink_access_shlinkId") } @@ -42,6 +48,8 @@ model shlink_access { model shlink { id String @id @unique @default(cuid()) @db.VarChar(43) + created_at DateTime @default(now()) + updated_at DateTime @updatedAt @default(now()) passcode_failures_remaining Int @default(5) config_passcode String? /// @encrypted config_passcode_hash String? /// @encryption:hash(config_passcode) @@ -49,12 +57,12 @@ model shlink { active Boolean @default(true) management_token String @db.VarChar(43) @unique @default(cuid()) user_id String @db.VarChar(43) - user user @relation(fields: [user_id], references: [user_id]) - shlink_file shlink_file[] - shlink_endpoint shlink_endpoint[] - shlink_access shlink_access[] - access_ticket access_ticket[] - name String @default("nameless shlink") + user user @relation(fields: [user_id], references: [user_id]) + shlink_file shlink_file[] + shlink_endpoint shlink_endpoint[] + shlink_access shlink_access[] + access_ticket access_ticket[] + name String @default("nameless shlink") @@index([id], name: "idx_shlink_id") @@ -62,6 +70,8 @@ model shlink { model user { id String @id @default(cuid()) @db.VarChar(43) + created_at DateTime @default(now()) + updated_at DateTime @updatedAt @default(now()) user_id String @unique patient_id String server_config_id String? @@ -75,15 +85,17 @@ model user { model server_config { - id String @id @unique @default(cuid()) @db.VarChar(43) + id String @id @unique @default(cuid()) @db.VarChar(43) + created_at DateTime @default(now()) + updated_at DateTime @updatedAt @default(now()) endpoint_url String - config_key String? @db.VarChar(43) + config_key String? @db.VarChar(43) config_client_id String? - config_client_secret String? /// @encrypted - config_client_secret_hash String? /// @encryption:hash(config_client_secret) + config_client_secret String? /// @encrypted + config_client_secret_hash String? /// @encryption:hash(config_client_secret) config_token_endpoint String? config_refresh_token String? - refresh_time DateTime @default(now()) + refresh_time DateTime @default(now()) access_token_response String shlink_endpoints shlink_endpoint[] users user[] @@ -92,12 +104,14 @@ model server_config { } model shlink_endpoint { - id String @id @unique @default(cuid()) @db.VarChar(43) + id String @id @unique @default(cuid()) @db.VarChar(43) + created_at DateTime @default(now()) + updated_at DateTime @updatedAt @default(now()) shlink_id String server_config_id String - url_path String @db.VarChar(43) - shlink shlink @relation(fields: [shlink_id], references: [id]) - server_config server_config @relation(fields: [server_config_id], references: [id]) + url_path String @db.VarChar(43) + shlink shlink @relation(fields: [shlink_id], references: [id]) + server_config server_config @relation(fields: [server_config_id], references: [id]) @@index([shlink_id], name: "idx_shlink_endpoint_shlinkId") @@index([server_config_id], name: "idx_shlink_endpoint_serverConfigID") @@ -105,9 +119,11 @@ model shlink_endpoint { model access_ticket { - id String @id @default(cuid()) @db.VarChar(43) + id String @id @default(cuid()) @db.VarChar(43) + created_at DateTime @default(now()) + updated_at DateTime @updatedAt @default(now()) shlink_id String - shlink shlink @relation(fields: [shlink_id], references: [id]) + shlink shlink @relation(fields: [shlink_id], references: [id]) @@index([id], name: "idx_access_ticket_id") } \ No newline at end of file diff --git a/prisma/schema.test.prisma b/prisma/schema.test.prisma index 1c4afce..5f70d1c 100644 --- a/prisma/schema.test.prisma +++ b/prisma/schema.test.prisma @@ -9,62 +9,72 @@ datasource db { } model cas_item { - id String @id @unique @default(cuid()) - hash String @unique - content Bytes @unique - ref_count Int @default(0) - shlink_file shlink_file[] + id String @id @unique @default(cuid()) + created_at DateTime @default(now()) + updated_at DateTime @updatedAt @default(now()) + hash String @unique + content Bytes @unique + ref_count Int @default(0) + shlink_file shlink_file[] @@index([id], name: "idx_cas_item_hash") } model shlink_file { - id String @id @unique @default(cuid()) + id String @id @unique @default(cuid()) + created_at DateTime @default(now()) + updated_at DateTime @updatedAt @default(now()) shlink_id String - content_type String @default("application/json") - content_id String? - cas_item cas_item? @relation(fields: [content_id], references: [id]) - shlink shlink @relation(fields: [shlink_id], references: [id]) + content_type String @default("application/json") + content_id String? + cas_item cas_item? @relation(fields: [content_id], references: [id]) + shlink shlink @relation(fields: [shlink_id], references: [id]) @@index([shlink_id], name: "idx_shlink_file_shlinkId") @@index([content_id], name: "idx_shlink_file_content_id") } model shlink_access { - id String @id @unique @default(cuid()) - shlink_id String - recipient String - access_time DateTime @default(now()) - shlink shlink @relation(fields: [shlink_id], references: [id]) + id String @id @unique @default(cuid()) + created_at DateTime @default(now()) + updated_at DateTime @updatedAt @default(now()) + shlink_id String + recipient String + access_time DateTime @default(now()) + shlink shlink @relation(fields: [shlink_id], references: [id]) @@index([shlink_id], name: "idx_shlink_access_shlinkId") } model shlink { - id String @id @unique @default(cuid()) - passcode_failures_remaining Int @default(5) - config_passcode String? /// @encrypted - config_passcode_hash String? /// @encryption:hash(config_passcode) - config_exp DateTime? - active Boolean @default(true) - management_token String @unique @default(cuid()) - user user @relation(fields: [user_id], references: [user_id]) - user_id String + id String @id @unique @default(cuid()) + created_at DateTime @default(now()) + updated_at DateTime @updatedAt @default(now()) + passcode_failures_remaining Int @default(5) + config_passcode String? /// @encrypted + config_passcode_hash String? /// @encryption:hash(config_passcode) + config_exp DateTime? + active Boolean @default(true) + management_token String @unique @default(cuid()) + user user @relation(fields: [user_id], references: [user_id]) + user_id String shlink_file shlink_file[] shlink_endpoint shlink_endpoint[] shlink_access shlink_access[] access_ticket access_ticket[] - name String @default("nameless shlink") + name String @default("nameless shlink") @@index([id], name: "idx_shlink_id") } model user { - id String @id @unique @default(cuid()) - user_id String @unique + id String @id @unique @default(cuid()) + created_at DateTime @default(now()) + updated_at DateTime @updatedAt @default(now()) + user_id String @unique patient_id String - shlink shlink[] + shlink shlink[] @@index([id], name: "idx_user_id") @@ -74,6 +84,8 @@ model user { model server_config { id String @id @unique @default(cuid()) + created_at DateTime @default(now()) + updated_at DateTime @updatedAt @default(now()) endpoint_url String config_key String? config_client_id String? @@ -89,6 +101,8 @@ model server_config { model shlink_endpoint { id String @id @unique @default(cuid()) + created_at DateTime @default(now()) + updated_at DateTime @updatedAt @default(now()) shlink_id String server_config_id String url_path String @@ -101,9 +115,11 @@ model shlink_endpoint { model access_ticket { - id String @id @default(cuid()) - shlink_id String - shlink shlink @relation(fields: [shlink_id], references: [id]) + id String @id @default(cuid()) + created_at DateTime @default(now()) + updated_at DateTime @updatedAt @default(now()) + shlink_id String + shlink shlink @relation(fields: [shlink_id], references: [id]) @@index([id], name: "idx_access_ticket_id") } diff --git a/src/app/patient-summary/ErrorState.tsx b/src/app/components/ErrorState.tsx similarity index 100% rename from src/app/patient-summary/ErrorState.tsx rename to src/app/components/ErrorState.tsx diff --git a/src/app/components/Header.tsx b/src/app/components/Header.tsx index 7d211e5..bfa596e 100644 --- a/src/app/components/Header.tsx +++ b/src/app/components/Header.tsx @@ -1,6 +1,6 @@ 'use client'; import { Home, Article, Dashboard } from '@mui/icons-material'; -import { Avatar, Box, Grid, MenuItem } from '@mui/material'; +import { Avatar, Box, Grid, MenuItem, Typography } from '@mui/material'; import AppBar from '@mui/material/AppBar'; import Toolbar from '@mui/material/Toolbar'; import NextLink from 'next/link'; @@ -25,10 +25,10 @@ export default function Header() { const pathname = usePathname(); const AuthButton = isAuthenticated ? ( - {user?.name && } - {user?.name} + {user?.name} + {user?.name && } diff --git a/src/app/patient-summary/components/InfoRow.tsx b/src/app/components/PatientSummaryViewer/InfoRow.tsx similarity index 100% rename from src/app/patient-summary/components/InfoRow.tsx rename to src/app/components/PatientSummaryViewer/InfoRow.tsx diff --git a/src/app/patient-summary/components/PatientSummary.tsx b/src/app/components/PatientSummaryViewer/PatientSummary.tsx similarity index 100% rename from src/app/patient-summary/components/PatientSummary.tsx rename to src/app/components/PatientSummaryViewer/PatientSummary.tsx diff --git a/src/app/patient-summary/PatientSummarySkeleton.tsx b/src/app/components/PatientSummaryViewer/PatientSummarySkeleton.tsx similarity index 100% rename from src/app/patient-summary/PatientSummarySkeleton.tsx rename to src/app/components/PatientSummaryViewer/PatientSummarySkeleton.tsx diff --git a/src/app/patient-summary/components/TabPanel.tsx b/src/app/components/PatientSummaryViewer/TabPanel.tsx similarity index 100% rename from src/app/patient-summary/components/TabPanel.tsx rename to src/app/components/PatientSummaryViewer/TabPanel.tsx diff --git a/src/app/patient-summary/components/generics/DetailedTable.tsx b/src/app/components/PatientSummaryViewer/generics/DetailedTable.tsx similarity index 100% rename from src/app/patient-summary/components/generics/DetailedTable.tsx rename to src/app/components/PatientSummaryViewer/generics/DetailedTable.tsx diff --git a/src/app/patient-summary/components/generics/TabSection.tsx b/src/app/components/PatientSummaryViewer/generics/TabSection.tsx similarity index 100% rename from src/app/patient-summary/components/generics/TabSection.tsx rename to src/app/components/PatientSummaryViewer/generics/TabSection.tsx diff --git a/src/app/patient-summary/components/generics/constants.tsx b/src/app/components/PatientSummaryViewer/generics/constants.tsx similarity index 100% rename from src/app/patient-summary/components/generics/constants.tsx rename to src/app/components/PatientSummaryViewer/generics/constants.tsx diff --git a/src/app/patient-summary/components/generics/resource.types.ts b/src/app/components/PatientSummaryViewer/generics/resource.types.ts similarity index 100% rename from src/app/patient-summary/components/generics/resource.types.ts rename to src/app/components/PatientSummaryViewer/generics/resource.types.ts diff --git a/src/app/patient-summary/components/resources/AllergyIntolerance/index.tsx b/src/app/components/PatientSummaryViewer/resources/AllergyIntolerance/index.tsx similarity index 100% rename from src/app/patient-summary/components/resources/AllergyIntolerance/index.tsx rename to src/app/components/PatientSummaryViewer/resources/AllergyIntolerance/index.tsx diff --git a/src/app/patient-summary/components/resources/Composition/index.tsx b/src/app/components/PatientSummaryViewer/resources/Composition/index.tsx similarity index 100% rename from src/app/patient-summary/components/resources/Composition/index.tsx rename to src/app/components/PatientSummaryViewer/resources/Composition/index.tsx diff --git a/src/app/patient-summary/components/resources/Condition/index.tsx b/src/app/components/PatientSummaryViewer/resources/Condition/index.tsx similarity index 100% rename from src/app/patient-summary/components/resources/Condition/index.tsx rename to src/app/components/PatientSummaryViewer/resources/Condition/index.tsx diff --git a/src/app/patient-summary/components/resources/Immunization/index.tsx b/src/app/components/PatientSummaryViewer/resources/Immunization/index.tsx similarity index 100% rename from src/app/patient-summary/components/resources/Immunization/index.tsx rename to src/app/components/PatientSummaryViewer/resources/Immunization/index.tsx diff --git a/src/app/patient-summary/components/resources/MedicationStatement/index.tsx b/src/app/components/PatientSummaryViewer/resources/MedicationStatement/index.tsx similarity index 100% rename from src/app/patient-summary/components/resources/MedicationStatement/index.tsx rename to src/app/components/PatientSummaryViewer/resources/MedicationStatement/index.tsx diff --git a/src/app/patient-summary/components/resources/Observation/index.tsx b/src/app/components/PatientSummaryViewer/resources/Observation/index.tsx similarity index 100% rename from src/app/patient-summary/components/resources/Observation/index.tsx rename to src/app/components/PatientSummaryViewer/resources/Observation/index.tsx diff --git a/src/app/patient-summary/components/resources/Organization/index.tsx b/src/app/components/PatientSummaryViewer/resources/Organization/index.tsx similarity index 100% rename from src/app/patient-summary/components/resources/Organization/index.tsx rename to src/app/components/PatientSummaryViewer/resources/Organization/index.tsx diff --git a/src/app/patient-summary/components/resources/Patient/index.tsx b/src/app/components/PatientSummaryViewer/resources/Patient/index.tsx similarity index 100% rename from src/app/patient-summary/components/resources/Patient/index.tsx rename to src/app/components/PatientSummaryViewer/resources/Patient/index.tsx diff --git a/src/app/patient-summary/components/resources/Practitioner/index.tsx b/src/app/components/PatientSummaryViewer/resources/Practitioner/index.tsx similarity index 100% rename from src/app/patient-summary/components/resources/Practitioner/index.tsx rename to src/app/components/PatientSummaryViewer/resources/Practitioner/index.tsx diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 46e6549..f615d33 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -32,12 +32,7 @@ export default async function RootLayout({
- - {children} - + {children}