feat(market): add Minha Intenções tab with panel, hook, and badge
- Introduced "Minhas Intenções" tab visible only to logged-in users. - Integrated MyPurchaseIntentionsPanel and useMyPurchaseIntentions hook. - Added tab badge showing count of pending intentions. - Extended session API to include user’s main character for downstream features.
This commit is contained in:
1 parent
f35fee944d
commit
7f42def478
55 files changed
+4906
-95
No files matched your search
+53
-38
@@ -1,6 +1,3 @@
|
||||
// Prisma Schema para PostgreSQL (Banco Principal da Aplicação)
|
||||
// URL: DATABASE_URL_APP
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
@@ -37,10 +34,7 @@ model User {
|
||||
inventory UserInventory[]
|
||||
favorites UserFavorite[]
|
||||
telemetry_events TelemetryEvent[]
|
||||
purchaseIntentions PurchaseIntention[]
|
||||
|
||||
item Item? @relation("ListingItem", fields: [item_id_unified], references: [item_id], onDelete: SetNull)
|
||||
tradeItem Item? @relation("TradeItem", fields: [trade_item_id_unified], references: [item_id], onDelete: SetNull) @relation("BuyerIntentions")
|
||||
purchaseIntentions PurchaseIntention[] @relation("BuyerIntentions")
|
||||
|
||||
@@index([email])
|
||||
@@index([username])
|
||||
@@ -104,7 +98,6 @@ model Item {
|
||||
updated_at DateTime @default(now()) @updatedAt
|
||||
|
||||
listings Listing[] @relation("ListingItem")
|
||||
tradeListings Listing[] @relation("TradeItem")
|
||||
|
||||
@@unique([source_table_name, source_table_id])
|
||||
@@index([item_name])
|
||||
@@ -114,27 +107,47 @@ model Item {
|
||||
}
|
||||
|
||||
model Listing {
|
||||
listing_id Int @id @default(autoincrement())
|
||||
seller_id Int
|
||||
item_id Int // Legacy - manter para compatibilidade
|
||||
item_id_unified Int? // Nova referência para tabela items
|
||||
item_name String @db.VarChar(255)
|
||||
quantity Int @default(1) Int?
|
||||
min_bid_increment Decimal? @db.Decimal(10, 2)
|
||||
initial_price_pix Decimal? @db.Decimal(10, 2)
|
||||
listing_id Int @id @default(autoincrement())
|
||||
seller_id Int
|
||||
item_id Int // Legacy - manter para compatibilidade
|
||||
item_id_unified Int?
|
||||
item_name String @db.VarChar(255)
|
||||
quantity Int @default(1)
|
||||
server_name String @db.VarChar(50)
|
||||
price_pix Decimal? @db.Decimal(10, 2)
|
||||
price_tibia_coins Int?
|
||||
price_gold_coins BigInt?
|
||||
is_auction Boolean @default(false)
|
||||
current_bid_amount Decimal? @db.Decimal(10, 2)
|
||||
current_bidder_id Int?
|
||||
auction_ends_at DateTime?
|
||||
description String? @db.Text
|
||||
listing_status String @default("active") @db.VarChar(20)
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @default(now()) @updatedAt
|
||||
sold_at DateTime?
|
||||
views_count Int @default(0)
|
||||
is_featured Boolean @default(false)
|
||||
favorites_count Int @default(0)
|
||||
inquiries_count Int @default(0)
|
||||
price_history Json?
|
||||
expires_at DateTime?
|
||||
trade_item_id Int?
|
||||
trade_item_name String?
|
||||
trade_item_quantity Int?
|
||||
min_bid_increment Decimal? @db.Decimal(10, 2)
|
||||
initial_price_pix Decimal? @db.Decimal(10, 2)
|
||||
initial_price_tibia_coins Int?
|
||||
initial_price_gold_coins BigInt?
|
||||
|
||||
seller User @relation(fields: [seller_id], references: [user_id], onDelete: Cascade)
|
||||
bids Bid[]
|
||||
transactions Transaction[]
|
||||
analytics AdAnalytics?
|
||||
telemetry_events TelemetryEvent[]
|
||||
favorites UserFavorite[]
|
||||
purchaseIntentions PurchaseIntention[]
|
||||
|
||||
item Item? @relation("ListingItem", fields: [item_id_unified], references: [item_id], onDelete: SetNull)
|
||||
tradeItem Item? @relation("TradeItem", fields: [trade_item_id_unified], references: [item_id], onDelete: SetNull)
|
||||
seller User @relation(fields: [seller_id], references: [user_id], onDelete: Cascade)
|
||||
bids Bid[]
|
||||
transactions Transaction[]
|
||||
analytics AdAnalytics?
|
||||
telemetry_events TelemetryEvent[]
|
||||
favorites UserFavorite[]
|
||||
purchaseIntentions PurchaseIntention[]
|
||||
item Item? @relation("ListingItem", fields: [item_id_unified], references: [item_id], onDelete: SetNull)
|
||||
|
||||
@@index([listing_status])
|
||||
@@index([item_id])
|
||||
@@ -290,18 +303,19 @@ model UserFavorite {
|
||||
}
|
||||
|
||||
model PurchaseIntention {
|
||||
intention_id Int @id @default(autoincrement())
|
||||
listing_id Int
|
||||
buyer_id Int
|
||||
payment_method String @db.VarChar(20)
|
||||
status String @default("pending") @db.VarChar(20)
|
||||
buyer_message String? @db.Text
|
||||
seller_response String? @db.Text
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt
|
||||
expires_at DateTime?
|
||||
accepted_at DateTime?
|
||||
rejected_at DateTime?
|
||||
intention_id Int @id @default(autoincrement())
|
||||
listing_id Int
|
||||
buyer_id Int
|
||||
payment_method String @db.VarChar(20)
|
||||
payment_method_change_count Int @default(0)
|
||||
status String @default("pending") @db.VarChar(20)
|
||||
buyer_message String? @db.Text
|
||||
seller_response String? @db.Text
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt
|
||||
expires_at DateTime?
|
||||
accepted_at DateTime?
|
||||
rejected_at DateTime?
|
||||
|
||||
listing Listing @relation(fields: [listing_id], references: [listing_id], onDelete: Cascade)
|
||||
buyer User @relation("BuyerIntentions", fields: [buyer_id], references: [user_id], onDelete: Cascade)
|
||||
@@ -310,6 +324,7 @@ model PurchaseIntention {
|
||||
@@index([buyer_id])
|
||||
@@index([status])
|
||||
@@index([created_at(sort: Desc)])
|
||||
@@index([buyer_id, listing_id, status])
|
||||
@@map("purchase_intentions")
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user