feat(cloud-page) - setup1

This commit is contained in:
2025-09-25 03:26:23 +05:30
parent e86aefd62f
commit ac6d906e03
12 changed files with 979 additions and 206 deletions

View File

@@ -31,6 +31,8 @@ model User {
updatedPayments Payment[] @relation("PaymentUpdatedBy")
backups DatabaseBackup[]
notifications Notification[]
cloudFolders CloudFolder[]
cloudFiles CloudFile[]
}
model Patient {
@@ -310,3 +312,50 @@ enum NotificationTypes {
PAYMENT
ETC
}
model CloudFolder {
id Int @id @default(autoincrement())
userId Int
name String
parentId Int?
parent CloudFolder? @relation("FolderChildren", fields: [parentId], references: [id], onDelete: Cascade)
children CloudFolder[] @relation("FolderChildren")
user User @relation(fields: [userId], references: [id])
files CloudFile[]
createdAt DateTime @default(now())
@@unique([userId, parentId, name]) // prevents sibling folder name duplicates
@@index([parentId])
}
model CloudFile {
id Int @id @default(autoincrement())
userId Int
name String
mimeType String?
fileSize BigInt @db.BigInt
folderId Int? // optional: null => root
isComplete Boolean @default(false) // upload completed?
totalChunks Int? // optional: expected number of chunks
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id])
folder CloudFolder? @relation(fields: [folderId], references: [id], onDelete: SetNull)
chunks CloudFileChunk[]
@@index([folderId])
}
model CloudFileChunk {
id Int @id @default(autoincrement())
fileId Int
seq Int
data Bytes
createdAt DateTime @default(now())
file CloudFile @relation(fields: [fileId], references: [id], onDelete: Cascade)
@@unique([fileId, seq])
@@index([fileId, seq])
}

View File

@@ -0,0 +1,7 @@
import { CloudFolderUncheckedCreateInputObjectSchema, CloudFileUncheckedCreateInputObjectSchema } from "@repo/db/usedSchemas";
import {z} from "zod";
export type CloudFolder = z.infer<typeof CloudFolderUncheckedCreateInputObjectSchema>;
export type CloudFile = z.infer<typeof CloudFileUncheckedCreateInputObjectSchema>;

View File

@@ -8,3 +8,4 @@ export * from "./staff-types";
export * from "./user-types";
export * from "./databaseBackup-types";
export * from "./notifications-types";
export * from "./cloudStorage-types";

View File

@@ -15,3 +15,5 @@ export * from '../shared/schemas/enums/PaymentStatus.schema'
export * from '../shared/schemas/enums/NotificationTypes.schema'
export * from '../shared/schemas/objects/NotificationUncheckedCreateInput.schema'
export * from '../shared/schemas/objects/DatabaseBackupUncheckedCreateInput.schema'
export * from '../shared/schemas/objects/CloudFolderUncheckedCreateInput.schema'
export * from '../shared/schemas/objects/CloudFileUncheckedCreateInput.schema'