Skip to content

Commit

Permalink
Implements quest ip limit flag
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpolman committed Aug 7, 2024
1 parent c3e9b18 commit 1d62a4f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion apps/api/src/app/models/Quest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ export const questSchema = {
index: Number,
expiryDate: Date,
infoLinks: [{ label: String, url: String }],
isPublished: { type: Boolean, default: false },
locks: { type: [{ questId: String, variant: Number }], default: [] },
isPublished: { type: Boolean, default: false },
isIPLimitEnabled: { type: Boolean, default: false },
};

export const questEntrySchema = {
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/app/services/QuestService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export default class QuestService {
variant: QuestVariant,
options: { quest: TQuest; account: TAccount; data: Partial<TQuestEntry> },
) {
if (options.data.ip) {
if (options.quest.isIPLimitEnabled) {
const ONE_DAY_MS = 86400 * 1000; // 24 hours in milliseconds
const now = Date.now(),
start = now - ONE_DAY_MS,
Expand Down
1 change: 1 addition & 0 deletions libs/common/src/lib/types/Quest.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type TBaseQuest = {
expiryDate: Date;
locks: TQuestLock[];
isPublished: boolean;
isIPLimitEnabled: boolean;
createdAt: string;
updatedAt: string;
update: (payload: Partial<TQuest>) => Promise<void>;
Expand Down

0 comments on commit 1d62a4f

Please sign in to comment.