add setup wizard, lockdown, team tasks, embed builder; fix admin dashboard
Four new independent features: /setup (guided onboarding wizard for module/channel/automod-strength config), /lockdown (raid protection with per-channel permission snapshot/restore and join-kick), /task (staff task tracker with status buttons + dashboard view), /embed create (modal-driven embed builder with optional link button). Also fixes the Admin dashboard, which always showed "-" because loadAdminData() double-wrapped the overview response and discarded activity data, plus mismatched field names against adminService's actual shape (guildCount/activeGuilds24/uptimeMs). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
38
src/services/taskService.ts
Normal file
38
src/services/taskService.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { prisma } from '../database';
|
||||
|
||||
export type TaskStatus = 'open' | 'in_progress' | 'done';
|
||||
|
||||
export class TaskService {
|
||||
public async createTask(data: {
|
||||
guildId: string;
|
||||
title: string;
|
||||
description?: string;
|
||||
assigneeId?: string;
|
||||
createdBy: string;
|
||||
createdByTag: string;
|
||||
}) {
|
||||
return prisma.staffTask.create({ data });
|
||||
}
|
||||
|
||||
public async listTasks(guildId: string, status?: string) {
|
||||
return prisma.staffTask.findMany({
|
||||
where: { guildId, ...(status ? { status } : {}) },
|
||||
orderBy: { createdAt: 'desc' }
|
||||
});
|
||||
}
|
||||
|
||||
public async getTask(id: string) {
|
||||
return prisma.staffTask.findUnique({ where: { id } });
|
||||
}
|
||||
|
||||
public async updateStatus(id: string, status: TaskStatus) {
|
||||
return prisma.staffTask.update({ where: { id }, data: { status } });
|
||||
}
|
||||
|
||||
public async deleteTask(guildId: string, id: string) {
|
||||
const task = await prisma.staffTask.findFirst({ where: { id, guildId } });
|
||||
if (!task) return false;
|
||||
await prisma.staffTask.delete({ where: { id } });
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user