Просмотр исходного кода

chore(@growi/app): rm prisma sample codes

mizozobu 2 недель назад
Родитель
Сommit
153f4bee7f

+ 0 - 0
apps/app/prisma/migrations/.keep


+ 0 - 11
apps/app/prisma/migrations/01.ts

@@ -1,11 +0,0 @@
-import type { Migration } from '../types';
-
-export const up: Migration = async ({ context }) => {
-  const revisoins = await context.revisions.findMany();
-  console.log(revisoins);
-};
-
-export const down: Migration = async ({ context }) => {
-  const revisoins = await context.revisions.findMany();
-  console.log(revisoins);
-};

+ 1 - 36
apps/app/src/features/page/models/revision.ts

@@ -1,40 +1,5 @@
 import { Prisma } from '~/generated/prisma/client';
 
 export const extension = Prisma.defineExtension((client) =>
-  client.$extends({
-    model: {
-      revisions: {
-        findLatest(pageId: string) {
-          return Prisma.getExtensionContext(this).findFirst({
-            where: {
-              pageId,
-            },
-            orderBy: {
-              createdAt: 'desc',
-            },
-          });
-        },
-      },
-    },
-    result: {
-      revisions: {
-        isPlain: {
-          needs: {
-            format: true,
-          },
-          compute(revision) {
-            return !['markdown'].includes(revision.format);
-          },
-        },
-        isMarkdown: {
-          needs: {
-            format: true,
-          },
-          compute(revision) {
-            return () => revision.format === 'markdown';
-          },
-        },
-      },
-    },
-  }),
+  client.$extends({}),
 );

+ 0 - 6
apps/app/src/server/routes/apiv3/revisions.js

@@ -11,7 +11,6 @@ import {
   normalizeLatestRevisionIfBroken,
 } from '~/server/service/revision/normalize-latest-revision-if-broken';
 import loggerFactory from '~/utils/logger';
-import { prisma } from '~/utils/prisma';
 
 import { apiV3FormValidator } from '../../middlewares/apiv3-form-validator';
 
@@ -142,11 +141,6 @@ module.exports = (crowi) => {
       const { isSharedPage } = req;
       const offset = req.query.offset || 0;
 
-      const revision = await prisma.revisions.findLatest(pageId);
-      console.log(revision);
-      console.log(revision.isPlain);
-      console.log(revision.isMarkdown());
-
       // check whether accessible
       if (
         !isSharedPage &&