forked from EduCraft/curriculum-project-hub
feat(database): 后台成员组(MemberGroup)管理与嵌套解析
This commit is contained in:
@@ -261,29 +261,8 @@ export async function registerFileLibRoutes(
|
||||
}
|
||||
});
|
||||
|
||||
/* ------------------------------------------------------------ Group 搜索(过渡) */
|
||||
|
||||
// 过渡实现:读 hub Team(C2 /groups/search 由 Group 团队交付后切换)。
|
||||
app.get("/database/api/groups/search", async (request, reply) => {
|
||||
const actor = await actorOrNull(request, reply, deps);
|
||||
if (actor === null) return reply;
|
||||
try {
|
||||
const q = ((request.query as { q?: string }).q ?? "").trim();
|
||||
const teams = await deps.prisma.team.findMany({
|
||||
where: {
|
||||
organizationId: deps.organizationId,
|
||||
archivedAt: null,
|
||||
...(q === "" ? {} : { name: { contains: q, mode: "insensitive" as const } }),
|
||||
},
|
||||
take: 20,
|
||||
orderBy: { name: "asc" },
|
||||
select: { id: true, name: true },
|
||||
});
|
||||
return { groups: teams.map((t) => ({ id: t.id, name: t.name, breadcrumb: t.name })) };
|
||||
} catch (error) {
|
||||
return sendRouteError(reply, error);
|
||||
}
|
||||
});
|
||||
// Group 搜索(C2 /groups/search)已迁至 memberGroupRoutes.ts,读 in-hub
|
||||
// MemberGroup 闭包(ADR-0028)。此处不再注册,避免重复。
|
||||
}
|
||||
|
||||
function parseGrants(raw: unknown): InitialGrant[] | undefined {
|
||||
|
||||
Reference in New Issue
Block a user