feat: rename repository files to include Repository suffix (#22716)
* feat: rename repository files to include Repository suffix - Rename apiKey.ts to apiKeyRepository.ts - Rename assignmentReason.ts to assignmentReasonRepository.ts - Update all import statements to use new file names Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * feat: rename repository files to PrismaRepository with Prisma prefix - Rename apiKeyRepository.ts to PrismaApiKeyRepository.ts - Rename assignmentReasonRepository.ts to PrismaAssignmentReasonRepository.ts - Update class names to PrismaApiKeyRepository and PrismaAssignmentReasonRepository - Update all import statements and usages across 3 files Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
eunjae@cal.com <hey@eunjae.dev>
Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
4cb7e4a91a
commit
84bc330fa8
+2
-2
@@ -5,7 +5,7 @@ import { redirect } from "next/navigation";
|
||||
|
||||
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
|
||||
import { APP_NAME } from "@calcom/lib/constants";
|
||||
import { ApiKeyRepository } from "@calcom/lib/server/repository/apiKey";
|
||||
import { PrismaApiKeyRepository } from "@calcom/lib/server/repository/PrismaApiKeyRepository";
|
||||
|
||||
import { buildLegacyRequest } from "@lib/buildLegacyCtx";
|
||||
|
||||
@@ -22,7 +22,7 @@ export const generateMetadata = async () =>
|
||||
|
||||
const getCachedApiKeys = unstable_cache(
|
||||
async (userId: number) => {
|
||||
return await ApiKeyRepository.findApiKeysFromUserId({ userId });
|
||||
return await PrismaApiKeyRepository.findApiKeysFromUserId({ userId });
|
||||
},
|
||||
undefined,
|
||||
{ revalidate: 3600, tags: ["viewer.apiKeys.list"] } // Cache for 1 hour
|
||||
|
||||
@@ -9,8 +9,8 @@ import { RetryableError } from "@calcom/lib/crmManager/errors";
|
||||
import { checkIfFreeEmailDomain } from "@calcom/lib/freeEmailDomainCheck/checkIfFreeEmailDomain";
|
||||
import logger from "@calcom/lib/logger";
|
||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||
import { PrismaAssignmentReasonRepository } from "@calcom/lib/server/repository/PrismaAssignmentReasonRepository";
|
||||
import { PrismaRoutingFormResponseRepository as RoutingFormResponseRepository } from "@calcom/lib/server/repository/PrismaRoutingFormResponseRepository";
|
||||
import { AssignmentReasonRepository } from "@calcom/lib/server/repository/assignmentReason";
|
||||
import { RoutingFormResponseDataFactory } from "@calcom/lib/server/service/routingForm/RoutingFormResponseDataFactory";
|
||||
import { findFieldValueByIdentifier } from "@calcom/lib/server/service/routingForm/responseData/findFieldValueByIdentifier";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
@@ -1342,7 +1342,7 @@ export default class SalesforceCRMService implements CRM {
|
||||
}
|
||||
|
||||
private async getAssignmentReason(bookingId: string) {
|
||||
const assignmentReason = await AssignmentReasonRepository.findLatestReasonFromBookingUid(bookingId);
|
||||
const assignmentReason = await PrismaAssignmentReasonRepository.findLatestReasonFromBookingUid(bookingId);
|
||||
return assignmentReason?.reasonString ?? "";
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import prisma from "@calcom/prisma";
|
||||
|
||||
export class ApiKeyRepository {
|
||||
export class PrismaApiKeyRepository {
|
||||
static async findApiKeysFromUserId({ userId }: { userId: number }) {
|
||||
return await prisma.apiKey.findMany({
|
||||
where: {
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import prisma from "@calcom/prisma";
|
||||
|
||||
export class AssignmentReasonRepository {
|
||||
export class PrismaAssignmentReasonRepository {
|
||||
static async findLatestReasonFromBookingUid(bookingUid: string) {
|
||||
return await prisma.assignmentReason.findFirst({
|
||||
where: {
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ApiKeyRepository } from "@calcom/lib/server/repository/apiKey";
|
||||
import { PrismaApiKeyRepository } from "@calcom/lib/server/repository/PrismaApiKeyRepository";
|
||||
|
||||
import type { TrpcSessionUser } from "../../../types";
|
||||
|
||||
@@ -9,5 +9,5 @@ type ListOptions = {
|
||||
};
|
||||
|
||||
export const listHandler = async ({ ctx }: ListOptions) => {
|
||||
return ApiKeyRepository.findApiKeysFromUserId({ userId: ctx.user.id });
|
||||
return PrismaApiKeyRepository.findApiKeysFromUserId({ userId: ctx.user.id });
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user