4cb7e4a91a
* refactor: rename app.ts to appRepository.ts for better naming consistency - Renamed packages/lib/server/repository/app.ts to appRepository.ts - Updated import statement in deleteCredential.test.ts - No functional changes, only file rename and import path update Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * rename * update usages * add missing import --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
27 lines
678 B
TypeScript
27 lines
678 B
TypeScript
import { appStoreMetadata } from "@calcom/app-store/appStoreMetaData";
|
|
import { prisma } from "@calcom/prisma";
|
|
|
|
export class PrismaAppRepository {
|
|
static async seedApp(dirName: string, keys?: any) {
|
|
const appMetadata = appStoreMetadata[dirName as keyof typeof appStoreMetadata];
|
|
|
|
if (!appMetadata) {
|
|
throw new Error(`App ${dirName} not found`);
|
|
}
|
|
|
|
await prisma.app.create({
|
|
data: {
|
|
slug: appMetadata.slug,
|
|
categories: appMetadata.categories,
|
|
dirName: dirName,
|
|
keys,
|
|
enabled: true,
|
|
},
|
|
});
|
|
}
|
|
|
|
static async findAppStore() {
|
|
return await prisma.app.findMany({ select: { slug: true } });
|
|
}
|
|
}
|