From f6fc78f578c344172349f7795b168b2992953bd0 Mon Sep 17 00:00:00 2001 From: おさむのひと <46447427+samunohito@users.noreply.github.com> Date: Tue, 6 Jan 2026 13:13:06 +0900 Subject: refactor: DriveFileEntityServiceとDriveFolderEntityServiceの複数件取得をリファクタ (#17064) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: DriveFileEntityServiceとDriveFolderEntityServiceの複数件取得をリファクタ * add test * fix * Update packages/backend/src/core/entities/DriveFolderEntityService.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update packages/backend/test/unit/entities/DriveFolderEntityService.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update packages/backend/src/core/entities/DriveFileEntityService.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Revert "Update packages/backend/src/core/entities/DriveFileEntityService.ts" This reverts commit 83bb9564cfdb699a21b775815439e1e496cd89a9. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- packages/backend/src/misc/split-id-and-objects.ts | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 packages/backend/src/misc/split-id-and-objects.ts (limited to 'packages/backend/src/misc/split-id-and-objects.ts') diff --git a/packages/backend/src/misc/split-id-and-objects.ts b/packages/backend/src/misc/split-id-and-objects.ts new file mode 100644 index 0000000000..d23bb93695 --- /dev/null +++ b/packages/backend/src/misc/split-id-and-objects.ts @@ -0,0 +1,27 @@ +/* + * SPDX-FileCopyrightText: syuilo and misskey-project + * SPDX-License-Identifier: AGPL-3.0-only + */ + +/** + * idとオブジェクトを分離する + * @param input idまたはオブジェクトの配列 + * @returns idの配列とオブジェクトの配列 + */ +export function splitIdAndObjects(input: (T | string)[]): { ids: string[]; objects: T[] } { + const ids: string[] = []; + const objects : T[] = []; + + for (const item of input) { + if (typeof item === 'string') { + ids.push(item); + } else { + objects.push(item); + } + } + + return { + ids, + objects, + }; +} -- cgit v1.2.3-freya