style: clean up code formatting and remove trailing whitespace
refactor: reorganize imports and fix type imports
This commit is contained in:
1 parent
d3704602fd
commit
47c04de6fe
232 files changed
+7140
-4798
No files matched your search
@@ -37,7 +37,7 @@ export async function createBid(data: CreateBidData): Promise<Bid> {
|
||||
return {
|
||||
...bid,
|
||||
bid_amount: Number(bid.bid_amount),
|
||||
bid_type: (bid.bid_type as "pix" | "tibia_coins" | "gold_coins" | null),
|
||||
bid_type: bid.bid_type as "pix" | "tibia_coins" | "gold_coins" | null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -46,22 +46,19 @@ export async function createBid(data: CreateBidData): Promise<Bid> {
|
||||
*/
|
||||
export async function getBidsByListing(
|
||||
listingId: number,
|
||||
activeOnly: boolean = true
|
||||
activeOnly: boolean = true,
|
||||
): Promise<Bid[]> {
|
||||
const bids = await prisma.bid.findMany({
|
||||
where: {
|
||||
listing_id: listingId,
|
||||
...(activeOnly ? { is_active: true } : {}),
|
||||
},
|
||||
orderBy: [
|
||||
{ bid_amount: "desc" },
|
||||
{ created_at: "desc" },
|
||||
],
|
||||
orderBy: [{ bid_amount: "desc" }, { created_at: "desc" }],
|
||||
});
|
||||
return bids.map(bid => ({
|
||||
return bids.map((bid) => ({
|
||||
...bid,
|
||||
bid_amount: Number(bid.bid_amount),
|
||||
bid_type: (bid.bid_type as "pix" | "tibia_coins" | "gold_coins" | null),
|
||||
bid_type: bid.bid_type as "pix" | "tibia_coins" | "gold_coins" | null,
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -74,16 +71,13 @@ export async function getHighestBid(listingId: number): Promise<Bid | null> {
|
||||
listing_id: listingId,
|
||||
is_active: true,
|
||||
},
|
||||
orderBy: [
|
||||
{ bid_amount: "desc" },
|
||||
{ created_at: "desc" },
|
||||
],
|
||||
orderBy: [{ bid_amount: "desc" }, { created_at: "desc" }],
|
||||
});
|
||||
if (!bid) return null;
|
||||
return {
|
||||
...bid,
|
||||
bid_amount: Number(bid.bid_amount),
|
||||
bid_type: (bid.bid_type as "pix" | "tibia_coins" | "gold_coins" | null),
|
||||
bid_type: bid.bid_type as "pix" | "tibia_coins" | "gold_coins" | null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -110,7 +104,6 @@ export async function getBidById(bidId: number): Promise<Bid | null> {
|
||||
return {
|
||||
...bid,
|
||||
bid_amount: Number(bid.bid_amount),
|
||||
bid_type: (bid.bid_type as "pix" | "tibia_coins" | "gold_coins" | null),
|
||||
bid_type: bid.bid_type as "pix" | "tibia_coins" | "gold_coins" | null,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user