refactor: org pathId (#3516)
This commit is contained in:
@@ -3,6 +3,7 @@ import type { OrgSchemaType } from '@fastgpt/global/support/user/team/org/type';
|
||||
import type { ClientSession } from 'mongoose';
|
||||
import { MongoOrgModel } from './orgSchema';
|
||||
import { MongoOrgMemberModel } from './orgMemberSchema';
|
||||
import { getChildrenPath } from '@fastgpt/global/support/user/team/org/constant';
|
||||
|
||||
export const getOrgsByTmbId = async ({ teamId, tmbId }: { teamId: string; tmbId: string }) =>
|
||||
MongoOrgMemberModel.find({ teamId, tmbId }, 'orgId').lean();
|
||||
@@ -42,7 +43,7 @@ export const getChildrenByOrg = async ({
|
||||
teamId: string;
|
||||
session?: ClientSession;
|
||||
}) => {
|
||||
return MongoOrgModel.find({ teamId, path: { $regex: `^${org.path}/${org._id}` } }, undefined, {
|
||||
return MongoOrgModel.find({ teamId, path: { $regex: `^${getChildrenPath(org)}` } }, undefined, {
|
||||
session
|
||||
}).lean();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user