45 lines
1.1 KiB
Plaintext
45 lines
1.1 KiB
Plaintext
// Attachment Management Domain
|
|
// Contains all attachment and file management models
|
|
|
|
// Attachment-specific Enums
|
|
enum AttachmentType {
|
|
PROFILE_PHOTO
|
|
ID_CARD_FRONT
|
|
ID_CARD_BACK
|
|
FARMING_LICENSE
|
|
LAND_CERTIFICATE
|
|
BANK_STATEMENT
|
|
CONTRACT
|
|
CERTIFICATE
|
|
OTHER_DOCUMENT
|
|
}
|
|
|
|
// Attachment Models
|
|
model FarmerAttachment {
|
|
id String @id @default(cuid())
|
|
farmerId String
|
|
type AttachmentType
|
|
title String
|
|
description String?
|
|
fileUrl String
|
|
fileName String
|
|
fileSize Int? // in bytes
|
|
mimeType String?
|
|
uploadedBy String? // user ID who uploaded
|
|
isVerified Boolean @default(false)
|
|
verifiedBy String? // admin ID who verified
|
|
verifiedAt DateTime?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
// Relations
|
|
farmer Farmer @relation(fields: [farmerId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([farmerId])
|
|
@@index([type])
|
|
@@index([isVerified])
|
|
@@index([uploadedBy])
|
|
@@index([createdAt])
|
|
@@index([mimeType])
|
|
@@map("farmer_attachments")
|
|
} |