86 lines
2.3 KiB
Plaintext
86 lines
2.3 KiB
Plaintext
// Pest & Disease Management Domain
|
|
// Contains pest, disease, and agricultural health tracking
|
|
|
|
// Pest & Disease Enums
|
|
enum PestDiseaseType {
|
|
PEST
|
|
DISEASE
|
|
WEED
|
|
NUTRIENT_DEFICIENCY
|
|
VIRUS
|
|
FUNGUS
|
|
BACTERIA
|
|
}
|
|
|
|
enum ReviewType {
|
|
PAYMENT_TIMELINESS
|
|
QUALITY_REQUIREMENTS
|
|
COMMUNICATION
|
|
OVERALL_EXPERIENCE
|
|
PRICE_FAIRNESS
|
|
}
|
|
|
|
// Pest & Disease Models
|
|
model PestDiseaseRecord {
|
|
id String @id @default(cuid())
|
|
farmId String
|
|
plotId String?
|
|
type PestDiseaseType
|
|
name String
|
|
scientificName String?
|
|
severity SeverityLevel
|
|
affectedArea Decimal? // percentage or hectares
|
|
identifiedDate DateTime
|
|
identifiedBy String? // farmer, expert, etc.
|
|
symptoms String?
|
|
treatmentApplied String?
|
|
treatmentDate DateTime?
|
|
treatmentCost Decimal?
|
|
treatmentMethod String?
|
|
preventionTaken String?
|
|
resolved Boolean @default(false)
|
|
resolvedDate DateTime?
|
|
recurrence Boolean @default(false)
|
|
photos String[] // photo URLs
|
|
notes String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
// Relations
|
|
farm Farm @relation(fields: [farmId], references: [id])
|
|
plot Plot? @relation(fields: [plotId], references: [id])
|
|
|
|
@@index([farmId, plotId])
|
|
@@index([type])
|
|
@@index([severity])
|
|
@@index([identifiedDate])
|
|
@@index([resolved])
|
|
@@index([name])
|
|
@@index([recurrence])
|
|
@@map("pest_disease_records")
|
|
}
|
|
|
|
model BuyerReview {
|
|
id String @id @default(cuid())
|
|
buyerId String
|
|
farmerId String
|
|
rating Decimal // 1-5 rating
|
|
comment String?
|
|
reviewType ReviewType
|
|
procurementId String? // reference to procurement if applicable
|
|
isAnonymous Boolean @default(false)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
// Relations
|
|
buyer Buyer @relation(fields: [buyerId], references: [id])
|
|
farmer Farmer @relation(fields: [farmerId], references: [id])
|
|
|
|
@@index([buyerId])
|
|
@@index([farmerId])
|
|
@@index([reviewType])
|
|
@@index([rating])
|
|
@@index([procurementId])
|
|
@@index([createdAt])
|
|
@@map("buyer_reviews")
|
|
} |