* refactor: move repositories from lib to features domain folders - Move HolidayRepository to features/holidays/repositories - Move PrismaTrackingRepository to features/bookings/repositories - Move PrismaBookingPaymentRepository to features/bookings/repositories - Move PrismaRoutingFormResponseRepository to features/routing-forms/repositories - Move PrismaAssignmentReasonRepository to features/assignment-reason/repositories - Move VerificationTokenRepository to features/auth/repositories - Move WorkspacePlatformRepository to features/workspace-platform/repositories - Move DTO files to their respective feature domains - Merge lib DestinationCalendarRepository into features version - Merge lib SelectedCalendarRepository into features version - Update all import paths across the codebase This follows the vertical slice architecture pattern by organizing repositories by domain rather than by technical layer. Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: update VerificationTokenService import path to new location Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * fix: update test file imports to use new repository locations Co-Authored-By: benny@cal.com <sldisek783@gmail.com> * mv * fix structure * fix * refactor: merge unit tests for SelectedCalendarRepository into single file Co-Authored-By: benny@cal.com <sldisek783@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
17 lines
566 B
TypeScript
17 lines
566 B
TypeScript
import { randomBytes, createHash } from "node:crypto";
|
|
|
|
import { VerificationTokenRepository } from "./repositories/VerificationTokenRepository";
|
|
|
|
export class VerificationTokenService {
|
|
static async create({ identifier, expires }: { identifier: string; expires: Date }) {
|
|
const token = randomBytes(32).toString("hex");
|
|
const hashedToken = createHash("sha256")
|
|
.update(`${token}${process.env.NEXTAUTH_SECRET}`)
|
|
.digest("hex");
|
|
|
|
await VerificationTokenRepository.create({ identifier, token: hashedToken, expires });
|
|
|
|
return token;
|
|
}
|
|
}
|