mirror of
https://github.com/nicotsx/zerobyte.git
synced 2026-02-08 04:21:18 -05:00
* feat: user management settings * feat: cleanup user's org when deleting them * chore: pr feedback * refactor(create-user): tanstack mutation
16 lines
701 B
TypeScript
16 lines
701 B
TypeScript
import { Hono } from "hono";
|
|
import { type GetStatusDto, getStatusDto, getUserDeletionImpactDto, type UserDeletionImpactDto } from "./auth.dto";
|
|
import { authService } from "./auth.service";
|
|
import { requireAdmin, requireAuth } from "./auth.middleware";
|
|
|
|
export const authController = new Hono()
|
|
.get("/status", getStatusDto, async (c) => {
|
|
const hasUsers = await authService.hasUsers();
|
|
return c.json<GetStatusDto>({ hasUsers });
|
|
})
|
|
.get("/deletion-impact/:userId", requireAuth, requireAdmin, getUserDeletionImpactDto, async (c) => {
|
|
const userId = c.req.param("userId");
|
|
const impact = await authService.getUserDeletionImpact(userId);
|
|
return c.json<UserDeletionImpactDto>(impact);
|
|
});
|