feat: add admin user management features and update user repository methods
- Implemented updateRoles, updateSanctions, and deleteUser methods in both in-memory and PostgreSQL user repositories. - Enhanced UserSanctions and UserServerRestriction interfaces to include additional properties. - Added AdminView component for admin functionalities including user lookup, role management, sanctions application, and profile management. - Integrated admin token handling in TRPC client for secure API requests. - Updated routing to include admin dashboard and linked it in the default layout.
This commit is contained in:
@@ -81,6 +81,10 @@ export interface GatewayProfileRepository {
|
||||
lastUsedAt?: string | null;
|
||||
}
|
||||
): Promise<GatewayProfileRecord | null>;
|
||||
updateMeta(
|
||||
profileName: string,
|
||||
meta: Record<string, unknown>
|
||||
): Promise<GatewayProfileRecord | null>;
|
||||
listReservedToStart(now: Date): Promise<GatewayProfileRecord[]>;
|
||||
findQueuedBuild(): Promise<GatewayProfileRecord | null>;
|
||||
updateLastError(profileName: string, lastError: string | null): Promise<void>;
|
||||
@@ -303,6 +307,19 @@ export const createGatewayProfileRepository = (
|
||||
});
|
||||
return row ? mapProfile(row) : null;
|
||||
},
|
||||
async updateMeta(
|
||||
profileName: string,
|
||||
meta: Record<string, unknown>
|
||||
): Promise<GatewayProfileRecord | null> {
|
||||
const gatewayProfile = prisma.gatewayProfile as unknown as GatewayProfileClient;
|
||||
const row = await gatewayProfile.update({
|
||||
where: { profileName },
|
||||
data: {
|
||||
meta: meta as GatewayPrisma.JsonObject,
|
||||
},
|
||||
});
|
||||
return row ? mapProfile(row) : null;
|
||||
},
|
||||
async listReservedToStart(now: Date): Promise<GatewayProfileRecord[]> {
|
||||
const gatewayProfile = prisma.gatewayProfile as unknown as GatewayProfileClient;
|
||||
const rows = await gatewayProfile.findMany({
|
||||
|
||||
Reference in New Issue
Block a user