feat: Enhance User and Farmer models with createdBy and updatedBy fields for better tracking
This commit is contained in:
parent
68c62313e4
commit
99778f5cb7
|
|
@ -279,10 +279,12 @@ model User {
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
// Relations
|
// Relations
|
||||||
farmer Farmer?
|
farmer Farmer?
|
||||||
buyer Buyer?
|
buyer Buyer?
|
||||||
administrator Administrator?
|
administrator Administrator?
|
||||||
notifications NotificationRecipient[]
|
notifications NotificationRecipient[]
|
||||||
|
createdFarmers Farmer[] @relation("FarmerCreatedBy")
|
||||||
|
updatedFarmers Farmer[] @relation("FarmerUpdatedBy")
|
||||||
|
|
||||||
@@map("users")
|
@@map("users")
|
||||||
}
|
}
|
||||||
|
|
@ -341,7 +343,6 @@ model Farmer {
|
||||||
landOwnership LandOwnership? // Kepemilikan lahan tempat tinggal
|
landOwnership LandOwnership? // Kepemilikan lahan tempat tinggal
|
||||||
primaryCrop String?
|
primaryCrop String?
|
||||||
farmingMethods String[] // organic, conventional, etc.
|
farmingMethods String[] // organic, conventional, etc.
|
||||||
hasSmartphone Boolean? @default(true)
|
|
||||||
internetAccess Boolean? @default(true)
|
internetAccess Boolean? @default(true)
|
||||||
|
|
||||||
// Emergency contact
|
// Emergency contact
|
||||||
|
|
@ -355,9 +356,13 @@ model Farmer {
|
||||||
joinedAt DateTime @default(now())
|
joinedAt DateTime @default(now())
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
|
createdBy String? // User ID who created this farmer record
|
||||||
|
updatedBy String? // User ID who last updated this farmer record
|
||||||
|
|
||||||
// Relations
|
// Relations
|
||||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
creator User? @relation("FarmerCreatedBy", fields: [createdBy], references: [id])
|
||||||
|
updater User? @relation("FarmerUpdatedBy", fields: [updatedBy], references: [id])
|
||||||
identities FarmerIdentity[]
|
identities FarmerIdentity[]
|
||||||
bankAccounts FarmerBankAccount[]
|
bankAccounts FarmerBankAccount[]
|
||||||
vehicles FarmerVehicle[]
|
vehicles FarmerVehicle[]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue