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>
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
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;
|
|
}
|
|
}
|