mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00
v4.6 -1 (#459)
This commit is contained in:
12
packages/service/core/dataset/controller.ts
Normal file
12
packages/service/core/dataset/controller.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { CollectionWithDatasetType } from '@fastgpt/global/core/dataset/type';
|
||||
import { MongoDatasetCollection } from './collection/schema';
|
||||
|
||||
export async function getCollectionWithDataset(collectionId: string) {
|
||||
const data = (
|
||||
await MongoDatasetCollection.findById(collectionId).populate('datasetId')
|
||||
)?.toJSON() as CollectionWithDatasetType;
|
||||
if (!data) {
|
||||
return Promise.reject('Collection is not exist');
|
||||
}
|
||||
return data;
|
||||
}
|
Reference in New Issue
Block a user