mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-10 04:22:09 +10:00
* First iteration on the new PieChart component * #128 Adds new admin home page * Fixes code after merging conflicts * Removes empty file * Uses real data for admin home page, and improves style * Reverts debugging code * Defines missing variable * Caches user stats data for admin home page * Typo * Styles improvements * Invalidates cache on signup/signin * Implements top 5 biggest games * Improves styling * Improves style * Using generateManifest to get the proper size * Reading data from cache * Removes unnecessary import * Improves caching mechanism for game sizes * Removes lint errors * Replaces piechart tooltip with colors in legend * Fixes caching * Fixes caching and slight improvement on pie chart colours * Fixes a few bugs related to caching * Fixes bug where app signin didn't refresh cache * feat: style improvements * fix: lint --------- Co-authored-by: DecDuck <declanahofmeyr@gmail.com>
27 lines
793 B
TypeScript
27 lines
793 B
TypeScript
import { type } from "arktype";
|
|
import { readDropValidatedBody, throwingArktype } from "~/server/arktype";
|
|
import aclManager from "~/server/internal/acls";
|
|
import libraryManager from "~/server/internal/library";
|
|
|
|
const DeleteVersion = type({
|
|
id: "string",
|
|
versionName: "string",
|
|
}).configure(throwingArktype);
|
|
|
|
export default defineEventHandler<{ body: typeof DeleteVersion }>(
|
|
async (h3) => {
|
|
const allowed = await aclManager.allowSystemACL(h3, [
|
|
"game:version:delete",
|
|
]);
|
|
if (!allowed) throw createError({ statusCode: 403 });
|
|
|
|
const body = await readDropValidatedBody(h3, DeleteVersion);
|
|
|
|
const gameId = body.id.toString();
|
|
const version = body.versionName.toString();
|
|
|
|
await libraryManager.deleteGameVersion(gameId, version);
|
|
return {};
|
|
},
|
|
);
|