Skip to content

Commit 70aaee5

Browse files
committed
check for poi in auctions and button
1 parent 126c2b8 commit 70aaee5

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/components/RunStrategy/GenerateButton.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ export function GenerateButton({
8080
const cannotPromote = model?.meta?.cannotPromote ?? false;
8181
const isAvailable = model?.availability !== Availability.Private;
8282
const isPublished = model?.status === ModelStatus.Published;
83+
const isPoi = model?.poi ?? false;
8384

84-
const showBid = features.auctions && !canGenerate && isAvailable && isPublished && !cannotPromote;
85+
const showBid =
86+
features.auctions && !canGenerate && isAvailable && isPublished && !cannotPromote && !isPoi;
8587

8688
if (!showBid && !canGenerate) return null;
8789

src/server/services/auction.service.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ import {
2727
throwInsufficientFundsError,
2828
throwNotFoundError,
2929
} from '~/server/utils/errorHandling';
30-
import { AuctionType, Availability, BuzzAccountType } from '~/shared/utils/prisma/enums';
30+
import {
31+
AuctionType,
32+
Availability,
33+
BuzzAccountType,
34+
ModelStatus,
35+
} from '~/shared/utils/prisma/enums';
3136
import { formatDate } from '~/utils/date-helpers';
3237
import { withRetries } from '~/utils/errorHandling';
3338
import { signalClient } from '~/utils/signal-client';
@@ -368,6 +373,8 @@ export const createBid = async ({
368373
select: {
369374
type: true,
370375
meta: true,
376+
poi: true,
377+
status: true,
371378
},
372379
},
373380
},
@@ -377,9 +384,14 @@ export const createBid = async ({
377384
if (mv.availability === Availability.Private)
378385
throw throwBadRequestError('Invalid model version.');
379386

387+
if (mv.model.status !== ModelStatus.Published)
388+
throw throwBadRequestError('Invalid model version.');
389+
380390
if ((mv.model.meta as ModelMeta | null)?.cannotPromote === true)
381391
throw throwBadRequestError('Invalid model version.');
382392

393+
if (mv.model.poi) throw throwBadRequestError('Invalid model version.');
394+
383395
const allowedTypeData = getModelTypesForAuction(auctionData.auctionBase);
384396
const matchAllowed = allowedTypeData.find((a) => a.type === mv.model.type);
385397
if (!matchAllowed) throw throwBadRequestError('Invalid model type for this auction.');

0 commit comments

Comments
 (0)