Files
calendar/packages/lib/server/repository/app.ts
T
d2f7a427d0 chore: App-router-migration(/apps) fix metadata, extract components into /module and finish migration (#16354)
* fix metadata for apps page

* migrate apps route to modules

* migrate apps/[slug]

* migrate apps/[slug]/setup

* migrate apps/categories/**/*

* add apps/installed page to app router

* migrate apps/[slug]/[...pages]

* migrate apps/installed/**/*

* Add apps/installation/[[...step]] to App router

* fix imports

* add missing use client directive

* finish migration

* fix metadata

* fix metadata for apps/categories

* fix type for installation/[[...step]]

* fix type for apps/[slug]/[...pages]

* remove unnecessary code

* refactor

* fix apps/installation

* move getServerSideProps to lib

* fix import of apps/installation

* fix import for app slug page

* refactor

* fix installation page in app router

* remove res in getServerSideProps

* replace setHeader with NextResponse header setHeader

* refactor installed pages

---------

Co-authored-by: Keith Williams <keithwillcode@gmail.com>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
2024-09-06 15:40:19 +00:00

27 lines
672 B
TypeScript

import { appStoreMetadata } from "@calcom/app-store/appStoreMetaData";
import { prisma } from "@calcom/prisma";
export class AppRepository {
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 } });
}
}