MCPcopy
hub / github.com/labring/FastGPT / updateParentFoldersUpdateTime

Function updateParentFoldersUpdateTime

packages/service/core/app/controller.ts:319–339  ·  view source on GitHub ↗
({ parentId }: { parentId?: string | null })

Source from the content-addressed store, hash-verified

317};
318
319export const updateParentFoldersUpdateTime = ({ parentId }: { parentId?: string | null }) => {
320 mongoSessionRun(async (session) => {
321 const existsId = new Set<string>();
322 while (true) {
323 if (!parentId || existsId.has(parentId)) return;
324
325 existsId.add(parentId);
326
327 const parentApp = await MongoApp.findById(parentId, 'parentId updateTime');
328 if (!parentApp) return;
329
330 parentApp.updateTime = new Date();
331 await parentApp.save({ session });
332
333 // 递归更新上层
334 parentId = parentApp.parentId;
335 }
336 }).catch((err) => {
337 logger.error('Failed to update parent folder updateTime', { error: err });
338 });
339};

Callers 5

onUpdateFunction · 0.90
createFunction · 0.90
handlerFunction · 0.90
handlerFunction · 0.90
handlerFunction · 0.90

Calls 5

mongoSessionRunFunction · 0.90
catchMethod · 0.80
hasMethod · 0.45
addMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected