Files
calendar/packages/lib/server/repository/verificationToken.ts
T
Joe Au-YeungandGitHub e5ebf7feb4 fix: signup (#25334)
* Handle Stripe logic in `paymentCallback`

* Remove endpoint

* Do not send email verification email if premium username

* Remove logic from verify-view

* Callback send verification email

* Add `create` method to `VerificationToken` repository

* Create `VerificationTokenService`

* Early return if payment failed

* Refactor token generation

* Add tests

* Type fixes

* Type fixes
2025-11-21 19:51:19 +00:00

52 lines
961 B
TypeScript

import prisma from "@calcom/prisma";
export class VerificationTokenRepository {
static async updateTeamInviteTokenExpirationDate({
email,
teamId,
expiresInDays,
}: {
email: string;
teamId: number;
expiresInDays: number;
}) {
const expires = new Date(Date.now() + expiresInDays * 24 * 60 * 60 * 1000);
const token = await prisma.verificationToken.findFirst({
where: {
identifier: email,
teamId,
},
});
await prisma.verificationToken.update({
where: {
identifier: email,
teamId,
token: token?.token,
},
data: { expires },
});
return { ...token, expires };
}
static async create({
identifier,
token,
expires,
}: {
identifier: string;
token: string;
expires: Date;
}) {
return prisma.verificationToken.create({
data: {
identifier,
token,
expires,
},
});
}
}