From 5ad665f260baac552b0e673589f868495108d0c0 Mon Sep 17 00:00:00 2001 From: Rizky Date: Wed, 24 Jan 2024 09:30:27 +0700 Subject: [PATCH] wip fix --- .gitignore | 5 +- app/db/prisma/schema.prisma | 487 ------------------------------------ app/srv/exports.d.ts | 1 - app/srv/global.d.ts | 1 - bun.lockb | Bin 127534 -> 123841 bytes pkgs/index.ts | 16 +- pkgs/utils/ensure.ts | 1 - 7 files changed, 16 insertions(+), 495 deletions(-) delete mode 100644 app/db/prisma/schema.prisma delete mode 100644 app/srv/global.d.ts diff --git a/.gitignore b/.gitignore index 2359781..be9534f 100644 --- a/.gitignore +++ b/.gitignore @@ -174,7 +174,4 @@ dist # Finder (MacOS) folder config .DS_Store -app/web -app/web/* -app/static -app/static/* \ No newline at end of file +app \ No newline at end of file diff --git a/app/db/prisma/schema.prisma b/app/db/prisma/schema.prisma deleted file mode 100644 index ba01a26..0000000 --- a/app/db/prisma/schema.prisma +++ /dev/null @@ -1,487 +0,0 @@ -generator client { - provider = "prisma-client-js" -} - -datasource db { - provider = "postgresql" - url = env("DATABASE_URL") -} - -model m_academic_year { - id Int @id @default(autoincrement()) - name String @db.VarChar - is_active Boolean - created_by Int - created_date DateTime @db.Timestamptz(6) - updated_by Int? - updated_date DateTime? @db.Timestamptz(6) - id_institution Int - start_time DateTime? @db.Timestamptz(6) - end_time DateTime? @db.Timestamptz(6) - id_client Int? - m_client m_client? @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_user_m_user_id_yearTom_academic_year m_user[] @relation("m_user_id_yearTom_academic_year") - t_logbook t_logbook[] -} - -/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments -model m_action { - id Int @id @default(autoincrement()) - id_type Int - name String @db.VarChar - has_notes Boolean - has_attachment Boolean - has_category Boolean - is_milestone Boolean - show_on_milestone Boolean - multiple_verification Boolean - has_score Boolean - has_presentation Boolean - has_location Boolean - has_emr Boolean - has_another_role Boolean - has_title Boolean - id_client Int - has_status Boolean @default(false) - show_on_menu Boolean @default(true) - has_hospital Boolean @default(false) - attachment_name Json? @default("[]") - has_score_option Boolean @default(false) - is_schedule Boolean @default(false) - max_entry_per_day Int @default(0) - identifier String @default(" ") @db.VarChar - is_grouped_by_category Boolean @default(false) - has_operation_code Boolean @default(false) - is_exam Boolean @default(false) - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_action_type m_action_type @relation(fields: [id_type], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_action_category m_action_category[] - m_action_rolemap m_action_rolemap[] - m_action_semester m_action_semester[] - m_asm_action m_asm_action[] - m_score_option m_score_option[] - m_user_action m_user_action[] - t_logbook t_logbook[] -} - -model m_action_category { - id Int @id(map: "m_action_sub_category_pkey") @default(autoincrement()) - name String @db.VarChar - id_action Int - id_client Int - required_asm Boolean @default(false) - m_action m_action @relation(fields: [id_action], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "m_action_sub_category_id_action_fkey") - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "m_action_sub_category_id_client_fkey") - m_user m_user[] - t_logbook t_logbook[] -} - -model m_action_role { - id Int @id(map: "m_logbook_role_pkey") @default(autoincrement()) - role String @db.VarChar - id_client Int - identifier String @default(" ") @db.VarChar - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "m_logbook_role_id_client_fkey") - m_action_rolemap m_action_rolemap[] - t_logbook_status t_logbook_status[] -} - -/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments -model m_action_rolemap { - id Int @id(map: "m_action_verificator_pkey") @default(autoincrement()) - id_action_role Int - id_action Int - id_client Int - type String? @default("verificator") @db.VarChar - is_required Boolean @default(true) - m_action m_action @relation(fields: [id_action], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "m_action_verificator_id_action_fkey") - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "m_action_verificator_id_client_fkey") - m_action_role m_action_role @relation(fields: [id_action_role], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "m_action_verificator_id_logbook_role_fkey") -} - -model m_action_semester { - id Int @id @default(autoincrement()) - id_semester Int - id_action Int - id_client Int - m_action m_action @relation(fields: [id_action], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_semester m_semester @relation(fields: [id_semester], references: [id], onDelete: NoAction, onUpdate: NoAction) -} - -model m_action_status { - id Int @id @default(autoincrement()) - status String @db.VarChar - id_action Int - id_client Int -} - -model m_action_type { - id Int @id @default(autoincrement()) - name String @db.VarChar - id_client Int - m_action m_action[] - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction) -} - -model m_asm_action { - id Int @id(map: "m_assesment_indicator_action_pkey") @default(autoincrement()) - id_action Int - id_asm_param Int - id_client Int - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_action m_action @relation(fields: [id_action], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "m_assesment_indicator_action_id_action_fkey") - m_asm_param m_asm_param @relation(fields: [id_asm_param], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "m_assesment_indicator_action_id_assesment_indicator_fkey") -} - -model m_asm_param { - id Int @id(map: "m_assesment_indicator_pkey") @default(autoincrement()) - name String @db.VarChar - min_score Float - max_score Float - id_client Int - m_asm_action m_asm_action[] - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "m_assessment_indicator_id_client_fkey") - t_logbook_asm t_logbook_asm[] -} - -model m_client { - id Int @id @default(autoincrement()) - name String @db.VarChar - m_academic_year m_academic_year[] - m_action m_action[] - m_action_category m_action_category[] - m_action_role m_action_role[] - m_action_rolemap m_action_rolemap[] - m_action_type m_action_type[] - m_another_role m_another_role[] - m_asm_action m_asm_action[] - m_asm_param m_asm_param[] - m_client_logo m_client_logo[] - m_hospital m_hospital[] - m_role m_role[] - m_score_option m_score_option[] - m_semester m_semester[] - m_session m_session[] - m_stage m_stage[] - m_stase m_stase[] - m_user_m_user_id_clientTom_client m_user[] @relation("m_user_id_clientTom_client") - m_user_m_user_id_institutionTom_client m_user[] @relation("m_user_id_institutionTom_client") - m_user_action m_user_action[] - t_audit_trails t_audit_trails[] - t_logbook t_logbook[] - t_logbook_asm t_logbook_asm[] - t_logbook_attachment t_logbook_attachment[] - other_t_logbook_emr t_logbook_emr[] @relation("t_logbook_emrTot_logbook_emr") - t_logbook_status t_logbook_status[] - t_menu t_menu[] - t_notif t_notif[] -} - -model m_client_logo { - id Int @id @default(autoincrement()) - id_client Int - file String - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction) -} - -model m_hospital { - id Int @id @default(autoincrement()) - name String @db.VarChar - address String? @db.VarChar - notes String? @db.VarChar - longitude String? @db.VarChar - latitude String? @db.VarChar - created_by Int - created_date DateTime @db.Timestamptz(6) - updated_date DateTime? @db.Timestamptz(6) - updated_by Int? - id_client Int - code String? @db.VarChar - m_user_m_hospital_created_byTom_user m_user @relation("m_hospital_created_byTom_user", fields: [created_by], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_user_m_hospital_updated_byTom_user m_user? @relation("m_hospital_updated_byTom_user", fields: [updated_by], references: [id], onDelete: NoAction, onUpdate: NoAction) - t_logbook t_logbook[] -} - -model m_role { - id Int @id(map: "mst_role_pkey") @default(autoincrement()) - name String @db.VarChar - created_date DateTime @db.Timestamptz(6) - created_by Int - updated_date DateTime? @db.Timestamptz(6) - updated_by Int? - id_client Int - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_user m_user[] -} - -/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments -model m_score_option { - id Int @id(map: "m_score_dropdown_pkey") @default(autoincrement()) - score Float - id_action Int? - id_client Int - m_action m_action? @relation(fields: [id_action], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "m_score_dropdown_id_action_fkey") - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "m_score_dropdown_id_client_fkey") -} - -model m_semester { - id Int @id @default(autoincrement()) - name String @db.VarChar - id_stage Int - id_client Int - m_action_semester m_action_semester[] - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_stage m_stage @relation(fields: [id_stage], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_user m_user[] - t_logbook t_logbook[] -} - -model m_session { - id_user Int? - session_id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid - created_at DateTime? @db.Timestamptz(6) - updated_at DateTime? @db.Timestamptz(6) - id_client Int - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_user m_user? @relation(fields: [id_user], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "m_user") -} - -/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments -model m_stage { - id Int @id @default(autoincrement()) - name String @db.VarChar - label_color String @db.VarChar - id_institution Int - created_date DateTime @db.Timestamptz(6) - created_by Int - updated_date DateTime? @db.Timestamptz(6) - updated_by Int? - code String? @db.VarChar(20) - id_client Int - m_semester m_semester[] - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_stase m_stase[] -} - -model m_stase { - id Int @id @default(autoincrement()) - name String @db.VarChar - id_stage Int - id_client Int - sequence Int - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_stage m_stage @relation(fields: [id_stage], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "m_stase_id_semester_fkey") - m_user m_user[] - t_logbook t_logbook[] -} - -/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments -model m_user { - id Int @id(map: "mst_user_pkey") @default(autoincrement()) - display_name String @db.VarChar - username String? @db.VarChar - email String? @db.VarChar - password String? @db.VarChar(255) - id_role Int - is_deleted Boolean @default(false) - created_date DateTime @db.Timestamptz(6) - created_by Int? - updated_date DateTime? @db.Timestamptz(6) - updated_by Int? - phone String? @db.VarChar - address String? @db.VarChar - date_of_birth DateTime? @db.Timestamptz(6) - code String? @db.VarChar - picture String? - id_institution Int? - id_sub_category Int? - id_semester Int? - id_stase Int? - id_client Int - gender String? @db.VarChar - id_year Int? - status String @default("Active") @db.VarChar - inisial_code String? @db.VarChar - is_show Boolean @default(true) - m_hospital_m_hospital_created_byTom_user m_hospital[] @relation("m_hospital_created_byTom_user") - m_hospital_m_hospital_updated_byTom_user m_hospital[] @relation("m_hospital_updated_byTom_user") - m_session m_session[] - m_client_m_user_id_clientTom_client m_client @relation("m_user_id_clientTom_client", fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_client_m_user_id_institutionTom_client m_client? @relation("m_user_id_institutionTom_client", fields: [id_institution], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_semester m_semester? @relation(fields: [id_semester], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_stase m_stase? @relation(fields: [id_stase], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_action_category m_action_category? @relation(fields: [id_sub_category], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_academic_year_m_user_id_yearTom_academic_year m_academic_year? @relation("m_user_id_yearTom_academic_year", fields: [id_year], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_user_m_user_created_byTom_user m_user? @relation("m_user_created_byTom_user", fields: [created_by], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "mst_user_created_by_fkey") - other_m_user_m_user_created_byTom_user m_user[] @relation("m_user_created_byTom_user") - m_role m_role @relation(fields: [id_role], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "mst_user_id_role_fkey") - m_user_m_user_updated_byTom_user m_user? @relation("m_user_updated_byTom_user", fields: [updated_by], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "mst_user_updated_by_fkey") - other_m_user_m_user_updated_byTom_user m_user[] @relation("m_user_updated_byTom_user") - m_user_action m_user_action[] - t_audit_trails t_audit_trails[] - t_logbook t_logbook[] - t_logbook_status t_logbook_status[] - t_menu_t_menu_created_byTom_user t_menu[] @relation("t_menu_created_byTom_user") - t_menu_t_menu_updated_byTom_user t_menu[] @relation("t_menu_updated_byTom_user") - t_notif t_notif[] -} - -model m_user_action { - id Int @id(map: "m_action_user_pkey") @default(autoincrement()) - id_action_hidden Int - id_user Int - id_client Int - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "m_action_user_id_client_fkey") - m_action m_action @relation(fields: [id_action_hidden], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_user m_user @relation(fields: [id_user], references: [id], onDelete: NoAction, onUpdate: NoAction) -} - -/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments -model t_audit_trails { - id Int @id @default(autoincrement()) - activity String - ip_user String? @db.VarChar - id_user Int - timestamp DateTime @db.Timestamptz(6) - type String @default("visit") @db.VarChar - meta Json? - id_client Int - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_user m_user @relation(fields: [id_user], references: [id], onDelete: NoAction, onUpdate: NoAction) -} - -/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments -model t_logbook { - id Int @id @default(autoincrement()) - title String? - notes String? - date DateTime @db.Timestamptz(6) - location String? @db.VarChar - id_hospital Int? - id_category Int? - id_action Int - is_presentation Boolean @default(false) - created_by Int - created_date DateTime @db.Timestamptz(6) - updated_by Int? - updated_date DateTime? @db.Timestamptz(6) - id_user Int? - id_client Int - verified Boolean? @default(false) - operation_code String? @db.VarChar - id_another_role Int? - id_semester Int? - id_stase Int? - schedule_status String @default("pending") @db.VarChar - exam_result String @default("Lolos") @db.VarChar - id_academic_year Int? - verified_status String @default("pending") @db.VarChar - m_academic_year m_academic_year? @relation(fields: [id_academic_year], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_action m_action @relation(fields: [id_action], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_action_category m_action_category? @relation(fields: [id_category], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_hospital m_hospital? @relation(fields: [id_hospital], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_another_role m_another_role? @relation(fields: [id_another_role], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "t_logbook_id_operation_type_fkey") - m_semester m_semester? @relation(fields: [id_semester], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_stase m_stase? @relation(fields: [id_stase], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_user m_user? @relation(fields: [id_user], references: [id], onDelete: NoAction, onUpdate: NoAction) - t_logbook_asm t_logbook_asm[] - t_logbook_attachment t_logbook_attachment[] - t_logbook_emr t_logbook_emr[] - t_logbook_status t_logbook_status[] - t_notif t_notif[] -} - -model t_logbook_asm { - id Int @id(map: "t_logbook_assesment_pkey") @default(autoincrement()) - id_logbook Int - id_asm_param Int - score Float - created_by DateTime @db.Timestamptz(6) - created_date Int - updated_date DateTime? @db.Timestamptz(6) - updated_by Int? - id_client Int - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_asm_param m_asm_param @relation(fields: [id_asm_param], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "t_logbook_assesment_id_assesment_indicator_fkey") - t_logbook t_logbook @relation(fields: [id_logbook], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "t_logbook_assesment_id_logbook_fkey") -} - -model t_logbook_attachment { - id Int @id @default(autoincrement()) - id_logbook Int - url_file String? - name String? @db.VarChar - id_client Int - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction) - t_logbook t_logbook @relation(fields: [id_logbook], references: [id], onDelete: NoAction, onUpdate: NoAction) -} - -model t_logbook_emr { - id Int @id(map: "t_logbook_medical_record_pkey") @default(autoincrement()) - id_logbook Int - emr_number String? @db.VarChar - diagnosis String? @db.VarChar - treatment String? @db.VarChar - age Int? - gender String? @db.VarChar - id_client Int? - month Int? - patient_name String? @db.VarChar - t_logbook_emr m_client? @relation("t_logbook_emrTot_logbook_emr", fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction) - t_logbook t_logbook @relation(fields: [id_logbook], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "t_logbook_medical_record_id_logbook_fkey") -} - -/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments -model t_logbook_status { - id Int @id(map: "t_logbook_participants_pkey") @default(autoincrement()) - id_user Int - id_logbook Int - id_action_role Int - status String @default("pending") @db.VarChar - date_time DateTime? @db.Timestamptz(6) - id_client Int - m_user m_user @relation(fields: [id_user], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "t_logbook_participants_id_user_fkey") - m_action_role m_action_role @relation(fields: [id_action_role], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction) - t_logbook t_logbook @relation(fields: [id_logbook], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "t_logbook_participants_id_logbook_fkey") -} - -model t_menu { - id Int @id @default(autoincrement()) - id_user String @db.VarChar - created_by Int - updated_date DateTime? @db.Timestamptz(6) - updated_by Int? - id_action Int - id_client Int - m_user_t_menu_created_byTom_user m_user @relation("t_menu_created_byTom_user", fields: [created_by], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_user_t_menu_updated_byTom_user m_user? @relation("t_menu_updated_byTom_user", fields: [updated_by], references: [id], onDelete: NoAction, onUpdate: NoAction) -} - -/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments -model t_notif { - id Int @id @default(autoincrement()) - message String - date DateTime @db.Timestamptz(6) - type String @db.VarChar - id_user Int - url String @db.VarChar - id_role Int - read Boolean @default(false) - id_client Int - id_logbook Int? - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction) - t_logbook t_logbook? @relation(fields: [id_logbook], references: [id], onDelete: NoAction, onUpdate: NoAction) - m_user m_user @relation(fields: [id_user], references: [id], onDelete: NoAction, onUpdate: NoAction) -} - -model m_another_role { - id Int @id(map: "m_operation_type_pkey") @default(autoincrement()) - role_name String @db.VarChar - id_client Int - m_client m_client @relation(fields: [id_client], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "m_operation_type_id_client_fkey") - t_logbook t_logbook[] -} diff --git a/app/srv/exports.d.ts b/app/srv/exports.d.ts index aeea6c5..1e5e69f 100644 --- a/app/srv/exports.d.ts +++ b/app/srv/exports.d.ts @@ -20,7 +20,6 @@ declare module "app/db/db" { declare module "pkgs/utils/global" { import { Logger } from "pino"; import { RadixRouter } from "radix3"; - import { Database } from "bun:sqlite"; type SingleRoute = { url: string; diff --git a/app/srv/global.d.ts b/app/srv/global.d.ts deleted file mode 100644 index 016b448..0000000 --- a/app/srv/global.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module "@surfy/multipart-parser"; diff --git a/bun.lockb b/bun.lockb index 647e5436b3184d00723848b173d482699bd4d6b4..44cf5e2b3bcb5b27c3bce1334df3847e7de5d0f1 100755 GIT binary patch delta 6635 zcmeI0X>1i$7>4ISOW`VLfm$eFOMpTJTcCg_wG=JNVhgySVNsR>vV~1h5ExcTa6>OR zL|n@563|iv{Gos%o8rFx2MI<_y>^w!!C+^Iw zQPHE~f%dV=Z)0s@@%bl;)|RIYh)+&S3U)b{o$F4XkAE4>aB6jC+FSA~$e`1G-vzG|JJ4iti#cL#-3t$L_J zNa@xq2Ichxg;ahoklz~=QeA=)RS2p2>j%o~?|B(WSopoh)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>PtkLv1@qk!Md-oIweW|oz%~_>gU();E>Kham6oMAiKZEKATRUlnD5^mnH%yND372)Elsf9iU-e_HopcMa z!H88q6RV$jMIBxa>X&2n%WqS2>NjTf8*x*~{X4pUYxf$$4BNQxU+LE!^-Q-N(cSao zA#t74a#q;RLC#9+M2j@U4(qYfBH7tFRjsrYR5sSGFP2J;onmc`7}92&P1*UW^Ubr< z4d(20(;}<%lGH6glz#O8EU{(pcW-IO{%Q;oxom2p^4J|TJgi!o~aCJa=YqLhpk;ag)khD-^L`YP0XkhV=(V!y}N_U0L%Vlz|$~ diff --git a/pkgs/index.ts b/pkgs/index.ts index 6c080f7..58d49f1 100644 --- a/pkgs/index.ts +++ b/pkgs/index.ts @@ -8,10 +8,24 @@ import { prepareAPITypes } from "./server/prep-api-ts"; import { config } from "./utils/config"; import { g } from "./utils/global"; import { createLogger } from "./utils/logger"; - +import { dirAsync, existsAsync } from "fs-jetpack"; +import { dir } from "utils/dir"; +import { $ } from "execa"; g.mode = process.argv.includes("dev") ? "dev" : "prod"; g.datadir = g.mode === "prod" ? "../data" : ".data"; +if (!(await existsAsync(dir("app")))) { + await dirAsync(dir("app")); +} + +if (!(await existsAsync(dir("app/db")))) { + await $`unzip -o pkgs/zip/db.zip -d app/db`; +} + +if (!(await existsAsync(dir("app/srv")))) { + await $`unzip -o pkgs/zip/srv.zip -d app/srv`; +} + if (!process.env.PORT) { g.port = 3000; await Bun.write(".env", `PORT=${g.port}`); diff --git a/pkgs/utils/ensure.ts b/pkgs/utils/ensure.ts index 415f7de..f9ba6f7 100644 --- a/pkgs/utils/ensure.ts +++ b/pkgs/utils/ensure.ts @@ -18,7 +18,6 @@ export const ensureNotRunning = async () => { }, }); s.end(); - console.log("hello"); done(false); } catch (e) { done(true);