More events team nonsense
All checks were successful
Test, Build, Deploy / Test, Build, and Deploy (push) Successful in 55s
Test, Build, Deploy / Create Sentry Release (push) Successful in 6s

This commit is contained in:
2026-04-11 03:30:46 -04:00
parent 465bb30966
commit cfc57c838e
17 changed files with 355 additions and 259 deletions

View File

@@ -3,13 +3,12 @@ import { jsonError } from "../../common.js";
export async function onRequestDelete(context: RequestContext) {
const path = decodeURIComponent(context.params.id as string);
if (typeof path !== "string") return jsonError("Invalid path", 400);
await context.env.D1.prepare(
"DELETE FROM short_links WHERE path = ? AND user = ?;",
)
.bind(path, context.data.current_user.id)
.run();
await context.data.prisma.shortLink.delete({
where: {
path,
user: context.data.current_user.id,
},
});
return new Response(null, {
status: 204,
@@ -39,15 +38,15 @@ export async function onRequestPatch(context: RequestContext) {
if (path.length > 256) return jsonError("Path is too long", 400);
await context.env.D1.prepare(
"UPDATE short_links SET path = ? WHERE path = ? AND user = ?;",
)
.bind(
await context.data.prisma.shortLink.update({
data: {
path,
decodeURIComponent(context.params.id as string),
context.data.current_user.id,
)
.run();
},
where: {
path: decodeURIComponent(context.params.id as string),
user: context.data.current_user.id,
},
});
return new Response(null, {
status: 204,