Skip to content

Commit

Permalink
fix: expired listing query (#1427)
Browse files Browse the repository at this point in the history
fix invalidate listing query
  • Loading branch information
justraman authored Nov 21, 2024
1 parent 791685c commit c1414d5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
3 changes: 1 addition & 2 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ type MarketplaceListingFilled {
amountFilled: BigInt!
amountRemaining: BigInt!
protocolFee: BigInt!
#TODO: make me required
price: BigInt
price: BigInt!
royalty: BigInt!
}

Expand Down
8 changes: 4 additions & 4 deletions src/job-handlers/invalidate-expired-listings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ export default async (job: Queue.Job, done: Queue.DoneCallback) => {
.andWhere('listing.type IN (:...types)', { types: [ListingType.Auction, ListingType.Offer] })
.andWhere(
new Brackets((qb) => {
qb.where("listing.type = :type AND (listing.data->>'endHeight')::int < :height", {
type: ListingType.Auction,
qb.where("listing.type = :auctionType AND (listing.data->>'endHeight')::int < :height", {
auctionType: ListingType.Auction,
height,
}).orWhere("listing.type = :type AND (listing.data->>'expiration')::int < :height", {
type: ListingType.Offer,
}).orWhere("listing.type = :offerType AND (listing.data->>'expiration')::int < :height", {
offerType: ListingType.Offer,
height,
})
})
Expand Down
11 changes: 6 additions & 5 deletions src/model/generated/_marketplaceListingFilled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class MarketplaceListingFilled {
private _amountFilled!: bigint
private _amountRemaining!: bigint
private _protocolFee!: bigint
private _price!: bigint | undefined | null
private _price!: bigint
private _royalty!: bigint

constructor(props?: Partial<Omit<MarketplaceListingFilled, 'toJSON'>>, json?: any) {
Expand All @@ -21,7 +21,7 @@ export class MarketplaceListingFilled {
this._amountFilled = marshal.bigint.fromJSON(json.amountFilled)
this._amountRemaining = marshal.bigint.fromJSON(json.amountRemaining)
this._protocolFee = marshal.bigint.fromJSON(json.protocolFee)
this._price = json.price == null ? undefined : marshal.bigint.fromJSON(json.price)
this._price = marshal.bigint.fromJSON(json.price)
this._royalty = marshal.bigint.fromJSON(json.royalty)
}
}
Expand Down Expand Up @@ -71,11 +71,12 @@ export class MarketplaceListingFilled {
this._protocolFee = value
}

get price(): bigint | undefined | null {
get price(): bigint {
assert(this._price != null, 'uninitialized access')
return this._price
}

set price(value: bigint | undefined | null) {
set price(value: bigint) {
this._price = value
}

Expand All @@ -96,7 +97,7 @@ export class MarketplaceListingFilled {
amountFilled: marshal.bigint.toJSON(this.amountFilled),
amountRemaining: marshal.bigint.toJSON(this.amountRemaining),
protocolFee: marshal.bigint.toJSON(this.protocolFee),
price: this.price == null ? undefined : marshal.bigint.toJSON(this.price),
price: marshal.bigint.toJSON(this.price),
royalty: marshal.bigint.toJSON(this.royalty),
}
}
Expand Down

0 comments on commit c1414d5

Please sign in to comment.