* perf: plan tip * perf: upload size controller * feat: add image ttl index * feat: new upload file ux * remove file * feat: support read pptx * feat: support xlsx * fix: rerank docker flie
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
import { jsonRes } from '@fastgpt/service/common/response';
|
|
import { connectToDatabase } from '@/service/mongo';
|
|
import { authCert } from '@fastgpt/service/support/permission/auth/common';
|
|
import { MongoPlugin } from '@fastgpt/service/core/plugin/schema';
|
|
import { PluginTypeEnum } from '@fastgpt/global/core/plugin/constants';
|
|
|
|
/* pg 中的数据搬到 mongo dataset.datas 中,并做映射 */
|
|
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|
try {
|
|
await connectToDatabase();
|
|
await authCert({ req, authRoot: true });
|
|
|
|
await MongoPlugin.updateMany(
|
|
{ type: { $exists: false } },
|
|
{
|
|
$set: {
|
|
type: PluginTypeEnum.custom
|
|
}
|
|
}
|
|
);
|
|
await MongoPlugin.updateMany(
|
|
{ parentId: { $exists: false } },
|
|
{
|
|
$set: {
|
|
parentId: null
|
|
}
|
|
}
|
|
);
|
|
|
|
jsonRes(res, {
|
|
message: 'success'
|
|
});
|
|
} catch (error) {
|
|
console.log(error);
|
|
|
|
jsonRes(res, {
|
|
code: 500,
|
|
error
|
|
});
|
|
}
|
|
}
|