Enhance the media auction system with improved bid validation and data handling
Update the MediaOutletAuction component to correctly parse currency values for bid placement and display, and modify the DatabaseStorage to include a new method for fetching active auctions by media outlet ID. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 069d4324-6c40-4355-955e-c714a50de1ea Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3df548ff-50ae-432f-9be4-25d34eccc983/069d4324-6c40-4355-955e-c714a50de1ea/jvFIdY3
This commit is contained in:
@ -53,6 +53,7 @@ export interface IStorage {
|
||||
// Auction operations
|
||||
getActiveAuctions(): Promise<Auction[]>;
|
||||
getAuctionById(id: string): Promise<Auction | undefined>;
|
||||
getAuctionByMediaOutlet(mediaOutletId: string): Promise<Auction | undefined>;
|
||||
createAuction(auction: InsertAuction): Promise<Auction>;
|
||||
placeBid(bid: InsertBid): Promise<Bid>;
|
||||
|
||||
@ -191,6 +192,13 @@ export class DatabaseStorage implements IStorage {
|
||||
return auction;
|
||||
}
|
||||
|
||||
async getAuctionByMediaOutlet(mediaOutletId: string): Promise<Auction | undefined> {
|
||||
const [auction] = await db.select().from(auctions).where(
|
||||
and(eq(auctions.mediaOutletId, mediaOutletId), eq(auctions.isActive, true))
|
||||
);
|
||||
return auction;
|
||||
}
|
||||
|
||||
async createAuction(auction: InsertAuction): Promise<Auction> {
|
||||
const [newAuction] = await db.insert(auctions).values(auction).returning();
|
||||
return newAuction;
|
||||
|
||||
Reference in New Issue
Block a user