Skip to content

Commit

Permalink
Cleanup invite models
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpolman committed Jun 17, 2024
1 parent 8b8aa4e commit ec147f9
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 19 deletions.
6 changes: 2 additions & 4 deletions apps/api/src/app/models/QuestInvite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ export const QuestInvite = mongoose.model<QuestInviteDocument>(
{
...(questSchema as any),
amount: Number,
pathname: String,
successUrl: String,
token: String,
isMandatoryReview: Boolean,
amountInvitee: Number,
requiredQuests: { type: [{ questId: String, variant: Number }], default: [] },
},
{ timestamps: true },
),
Expand Down
16 changes: 16 additions & 0 deletions apps/api/src/app/models/QuestInviteCode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import mongoose from 'mongoose';

export type QuestInviteCodeDocument = mongoose.Document & TQuestInviteCode;

export const QuestInviteCode = mongoose.model<QuestInviteCodeDocument>(
'QuestInviteCode',
new mongoose.Schema(
{
questId: String,
sub: String,
code: String,
},
{ timestamps: true },
),
'questinvitecode',
);
5 changes: 1 addition & 4 deletions apps/api/src/app/models/QuestInviteEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ export const QuestInviteEntry = mongoose.model<QuestInviteEntryDocument>(
{
questId: String,
sub: String,
uuid: String,
code: String,
amount: String,
isApproved: Boolean,
poolId: String,
metadata: String,
},
{ timestamps: true },
),
Expand Down
2 changes: 0 additions & 2 deletions apps/api/src/app/services/QuestInviteService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ export default class QuestInviteService implements IQuestService {
async decorate({ quest }: { quest: TQuestInvite; data: Partial<TQuestInviteEntry> }): Promise<TQuestInvite> {
return {
...quest,
pathname: quest.pathname,
successUrl: quest.successUrl,
};
}

Expand Down
12 changes: 8 additions & 4 deletions libs/common/src/lib/types/QuestInvite.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
type TQuestInvite = TBaseQuest & {
successUrl: string;
pathname: string;
token: string;
amount: number;
isMandatoryReview: boolean;
amountInvitee: number;
requiredQuests: { questId: string; variant: TQuest }[];
};

type TQuestInviteCode = {
questId: string;
sub: string;
code: string;
};
6 changes: 1 addition & 5 deletions libs/common/src/lib/types/QuestInviteEntry.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
type TQuestInviteEntry = {
questId: string;
sub: string;
uuid: string;
code: string;
amount: string;
isApproved: boolean;
createdAt: Date;
poolId: string;
metadata: string;
};

0 comments on commit ec147f9

Please sign in to comment.