feat(pos): add favorite functionality for goods
- Implemented PosGoodFavoriteController to handle attaching and detaching favorites for goods. - Created PosGoodFavoriteService to manage the business logic for favorites, including database operations and cache invalidation. - Added PosGoodFavoriteModule to encapsulate the controller and service.
This commit is contained in:
@@ -11,11 +11,12 @@ model ConsumerAccount {
|
||||
account_id String @unique()
|
||||
account Account @relation(fields: [account_id], references: [id])
|
||||
|
||||
pos Pos?
|
||||
permission PermissionConsumer?
|
||||
account_allocation LicenseAccountAllocation?
|
||||
sales_invoices SalesInvoice[]
|
||||
account_device ConsumerAccountDevice?
|
||||
pos Pos?
|
||||
permission PermissionConsumer?
|
||||
account_allocation LicenseAccountAllocation?
|
||||
account_device ConsumerAccountDevice?
|
||||
sales_invoices SalesInvoice[]
|
||||
consumer_account_good_favorites ConsumerAccountGoodFavorite[]
|
||||
|
||||
@@map("consumer_accounts")
|
||||
}
|
||||
@@ -150,3 +151,18 @@ model Pos {
|
||||
|
||||
@@map("poses")
|
||||
}
|
||||
|
||||
model ConsumerAccountGoodFavorite {
|
||||
created_at DateTime @default(now())
|
||||
|
||||
consumer_account_id String
|
||||
consumer_account ConsumerAccount @relation(fields: [consumer_account_id], references: [id], onDelete: Cascade)
|
||||
|
||||
good_id String
|
||||
good Good @relation(fields: [good_id], references: [id], onDelete: Cascade)
|
||||
|
||||
@@id([consumer_account_id, good_id]) // unique pair
|
||||
@@index([good_id])
|
||||
@@index([consumer_account_id])
|
||||
@@map("consumer_account_good_favorites")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user