mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00
chore: upgrade mongoose to v8.10.x for security (#3868)
* chore: upgrade mongoose to v8.10.x for security * chore: remove duplicate code * fix: ts error
This commit is contained in:
@@ -10,6 +10,11 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
|
||||
// 重命名 dataset.trainigns -> dataset_trainings
|
||||
try {
|
||||
if (!connectionMongo.connection.db) {
|
||||
return jsonRes(res, {
|
||||
message: '数据库连接失败'
|
||||
});
|
||||
}
|
||||
const collections = await connectionMongo.connection.db
|
||||
.listCollections({ name: 'dataset.trainings' })
|
||||
.toArray();
|
||||
@@ -31,6 +36,11 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
}
|
||||
|
||||
try {
|
||||
if (!connectionMongo.connection.db) {
|
||||
return jsonRes(res, {
|
||||
message: '数据库连接失败'
|
||||
});
|
||||
}
|
||||
const collections = await connectionMongo.connection.db
|
||||
.listCollections({ name: 'dataset.collections' })
|
||||
.toArray();
|
||||
@@ -52,6 +62,11 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
}
|
||||
|
||||
try {
|
||||
if (!connectionMongo.connection.db) {
|
||||
return jsonRes(res, {
|
||||
message: '数据库连接失败'
|
||||
});
|
||||
}
|
||||
const collections = await connectionMongo.connection.db
|
||||
.listCollections({ name: 'dataset.datas' })
|
||||
.toArray();
|
||||
@@ -73,6 +88,11 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
}
|
||||
|
||||
try {
|
||||
if (!connectionMongo.connection.db) {
|
||||
return jsonRes(res, {
|
||||
message: '数据库连接失败'
|
||||
});
|
||||
}
|
||||
const collections = await connectionMongo.connection.db
|
||||
.listCollections({ name: 'app.versions' })
|
||||
.toArray();
|
||||
@@ -94,6 +114,11 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
}
|
||||
|
||||
try {
|
||||
if (!connectionMongo.connection.db) {
|
||||
return jsonRes(res, {
|
||||
message: '数据库连接失败'
|
||||
});
|
||||
}
|
||||
const collections = await connectionMongo.connection.db
|
||||
.listCollections({ name: 'buffer.rawtexts' })
|
||||
.toArray();
|
||||
@@ -115,6 +140,11 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
}
|
||||
|
||||
try {
|
||||
if (!connectionMongo.connection.db) {
|
||||
return jsonRes(res, {
|
||||
message: '数据库连接失败'
|
||||
});
|
||||
}
|
||||
const collections = await connectionMongo.connection.db
|
||||
.listCollections({ name: 'buffer.tts' })
|
||||
.toArray();
|
||||
@@ -134,6 +164,11 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
}
|
||||
|
||||
try {
|
||||
if (!connectionMongo.connection.db) {
|
||||
return jsonRes(res, {
|
||||
message: '数据库连接失败'
|
||||
});
|
||||
}
|
||||
const collections = await connectionMongo.connection.db
|
||||
.listCollections({ name: 'team.members' })
|
||||
.toArray();
|
||||
@@ -155,6 +190,11 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
}
|
||||
|
||||
try {
|
||||
if (!connectionMongo.connection.db) {
|
||||
return jsonRes(res, {
|
||||
message: '数据库连接失败'
|
||||
});
|
||||
}
|
||||
const collections = await connectionMongo.connection.db
|
||||
.listCollections({ name: 'team.tags' })
|
||||
.toArray();
|
||||
@@ -174,6 +214,11 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
}
|
||||
|
||||
try {
|
||||
if (!connectionMongo.connection.db) {
|
||||
return jsonRes(res, {
|
||||
message: '数据库连接失败'
|
||||
});
|
||||
}
|
||||
const collections = await connectionMongo.connection.db
|
||||
.listCollections({ name: 'team.subscriptions' })
|
||||
.toArray();
|
||||
|
@@ -16,7 +16,7 @@ async function handler(
|
||||
): Promise<OutLinkDeleteResponse> {
|
||||
const { id } = req.query;
|
||||
await authOutLinkCrud({ req, outLinkId: id, authToken: true, per: OwnerPermissionVal });
|
||||
await MongoOutLink.findByIdAndRemove(id);
|
||||
await MongoOutLink.findByIdAndDelete(id);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user