Files
Benny JooGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
96bec9f7b9 refactor: Move repositories from @calcom/lib to @calcom/features domain folders (#27570)
* 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: [email protected] <[email protected]>

* fix: update VerificationTokenService import path to new location

Co-Authored-By: [email protected] <[email protected]>

* fix: update test file imports to use new repository locations

Co-Authored-By: [email protected] <[email protected]>

* mv

* fix structure

* fix

* refactor: merge unit tests for SelectedCalendarRepository into single file

Co-Authored-By: [email protected] <[email protected]>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-02-09 08:41:04 -03:00

69 lines
1.7 KiB
TypeScript

import type { PrismaClient } from "@calcom/prisma";
import prisma from "@calcom/prisma";
import type {
IBookingPaymentRepository,
BookingPaymentWithCredentials,
CreatePaymentData,
PaymentForAwaitingEmail,
} from "./BookingPaymentRepository.interface";
export class PrismaBookingPaymentRepository implements IBookingPaymentRepository {
constructor(private readonly prismaClient: PrismaClient = prisma) {}
async findByExternalIdIncludeBookingUserCredentials(
externalId: string,
credentialType: string
): Promise<BookingPaymentWithCredentials | null> {
return await this.prismaClient.payment.findFirst({
where: {
externalId,
},
select: {
id: true,
amount: true,
success: true,
bookingId: true,
booking: {
select: {
user: {
select: {
credentials: {
where: { type: credentialType },
select: { key: true },
},
},
},
},
},
},
});
}
async createPaymentRecord(data: CreatePaymentData) {
const createdPayment = await this.prismaClient.payment.create({
data,
});
return createdPayment;
}
async findByIdForAwaitingPaymentEmail(id: number): Promise<PaymentForAwaitingEmail | null> {
return await this.prismaClient.payment.findUnique({
where: { id },
select: {
success: true,
externalId: true,
uid: true,
paymentOption: true,
amount: true,
currency: true,
app: {
select: {
slug: true,
},
},
},
});
}
}