feat: complete user management workflow
This commit is contained in:
23
app/api/settings/join-requests/route.ts
Normal file
23
app/api/settings/join-requests/route.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { jsonSuccess } from "@/modules/core/server/api";
|
||||
import { requirePermission } from "@/modules/core/server/auth";
|
||||
import { readData } from "@/modules/core/server/store";
|
||||
|
||||
export async function GET(): Promise<Response> {
|
||||
const auth = await requirePermission("account:read", {
|
||||
action: "joinRequest.list",
|
||||
targetType: "joinRequest",
|
||||
});
|
||||
|
||||
if (!auth.success) {
|
||||
return auth.response;
|
||||
}
|
||||
|
||||
const data = await readData();
|
||||
const organizationId = auth.context.organization?.id;
|
||||
|
||||
return jsonSuccess("加入申请已加载", {
|
||||
joinRequests: organizationId
|
||||
? data.joinRequests.filter((request) => request.organizationId === organizationId)
|
||||
: data.joinRequests,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user