Extraction schema (#398)
This commit is contained in:
@@ -1,22 +1,23 @@
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { jsonRes } from '@/service/response';
|
||||
import { connectToDatabase, OutLink } from '@/service/mongo';
|
||||
import { authApp, authUser } from '@/service/utils/auth';
|
||||
import type { OutLinkEditType } from '@/types/support/outLink';
|
||||
import { connectToDatabase } from '@/service/mongo';
|
||||
import { MongoOutLink } from '@fastgpt/support/outLink/schema';
|
||||
import { authApp } from '@/service/utils/auth';
|
||||
import { authUser } from '@fastgpt/support/user/auth';
|
||||
import type { OutLinkEditType } from '@fastgpt/support/outLink/type.d';
|
||||
import { customAlphabet } from 'nanoid';
|
||||
import { OutLinkTypeEnum } from '@/constants/chat';
|
||||
import { OutLinkTypeEnum } from '@fastgpt/support/outLink/constant';
|
||||
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 24);
|
||||
|
||||
/* create a shareChat */
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
try {
|
||||
await connectToDatabase();
|
||||
const { appId, ...props } = req.body as OutLinkEditType & {
|
||||
appId: string;
|
||||
type: `${OutLinkTypeEnum}`;
|
||||
};
|
||||
|
||||
await connectToDatabase();
|
||||
|
||||
const { userId } = await authUser({ req, authToken: true });
|
||||
await authApp({
|
||||
appId,
|
||||
@@ -25,7 +26,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
});
|
||||
|
||||
const shareId = nanoid();
|
||||
await OutLink.create({
|
||||
await MongoOutLink.create({
|
||||
shareId,
|
||||
userId,
|
||||
appId,
|
||||
|
||||
Reference in New Issue
Block a user