style(api): apply prettier formatting
This commit is contained in:
1 parent
80fef25af3
commit
96fede9fe5
75 files changed
+955
-674
No files matched your search
@@ -92,9 +92,7 @@ const BID_RATE_LIMIT_REJECTION_MESSAGE =
|
||||
allowedHeaders: ['Authorization', 'Content-Type', 'X-Auth-User-Id'],
|
||||
},
|
||||
})
|
||||
export class AuctionGateway
|
||||
implements OnGatewayConnection, OnGatewayInit
|
||||
{
|
||||
export class AuctionGateway implements OnGatewayConnection, OnGatewayInit {
|
||||
@WebSocketServer()
|
||||
private server!: Namespace;
|
||||
|
||||
@@ -205,7 +203,9 @@ export class AuctionGateway
|
||||
ack?.({
|
||||
...(bidDelta
|
||||
? {}
|
||||
: { state: this.serializeAuction(bidResult as AuctionStateResponse) }),
|
||||
: {
|
||||
state: this.serializeAuction(bidResult as AuctionStateResponse),
|
||||
}),
|
||||
ok: true,
|
||||
bidRequestId,
|
||||
bidDelta: broadcastBidDelta,
|
||||
@@ -417,8 +417,9 @@ export class AuctionGateway
|
||||
|
||||
private consumeBidRateLimit(socket: Socket): boolean {
|
||||
const currentTimestampMS = Date.now();
|
||||
const previousState = socket.data
|
||||
.auctionBidRateLimit as BidRateLimitState | undefined;
|
||||
const previousState = socket.data.auctionBidRateLimit as
|
||||
| BidRateLimitState
|
||||
| undefined;
|
||||
if (
|
||||
!previousState ||
|
||||
currentTimestampMS - previousState.windowStartedAtTimestampMS >=
|
||||
@@ -633,7 +634,9 @@ export class AuctionGateway
|
||||
typeof errorPayload.code === 'string' ? errorPayload.code : undefined,
|
||||
errorPayload.message,
|
||||
);
|
||||
const resyncRecommended = isAuctionResyncRecommended(auctionRejectionReason);
|
||||
const resyncRecommended = isAuctionResyncRecommended(
|
||||
auctionRejectionReason,
|
||||
);
|
||||
const state = resyncRecommended
|
||||
? await this.fetchSerializedAuctionState(matchId)
|
||||
: undefined;
|
||||
@@ -688,7 +691,9 @@ export class AuctionGateway
|
||||
return {
|
||||
code: error instanceof Error ? error.message : 'UNKNOWN',
|
||||
message:
|
||||
error instanceof Error ? error.message : 'Unexpected auction gateway error.',
|
||||
error instanceof Error
|
||||
? error.message
|
||||
: 'Unexpected auction gateway error.',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -724,7 +729,10 @@ export class AuctionGateway
|
||||
auction: AuctionStateResponse,
|
||||
bidRequestId?: string,
|
||||
): Record<string, unknown> | null {
|
||||
const serialized = this.serializeAuction(auction) as Record<string, unknown>;
|
||||
const serialized = this.serializeAuction(auction) as Record<
|
||||
string,
|
||||
unknown
|
||||
>;
|
||||
const revision = Number(serialized.revision);
|
||||
const currentHighestBidPointAmount = Number(
|
||||
serialized.currentHighestBidPointAmount ?? serialized.currentBid,
|
||||
@@ -775,9 +783,7 @@ export class AuctionGateway
|
||||
};
|
||||
}
|
||||
|
||||
private isBidDeltaResponse(
|
||||
value: unknown,
|
||||
): value is AuctionBidDeltaResponse {
|
||||
private isBidDeltaResponse(value: unknown): value is AuctionBidDeltaResponse {
|
||||
return (
|
||||
typeof value === 'object' &&
|
||||
value !== null &&
|
||||
|
||||
Reference in new issue
Block a user