fix(delete): add cascade deletes and fix SvelteKit named action conflict
Some checks failed
CI / Unit & Component Tests (push) Has been cancelled
CI / Backend Unit Tests (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
CI / Unit & Component Tests (pull_request) Has been cancelled
CI / Backend Unit Tests (pull_request) Has been cancelled
CI / E2E Tests (pull_request) Has been cancelled
Some checks failed
CI / Unit & Component Tests (push) Has been cancelled
CI / Backend Unit Tests (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
CI / Unit & Component Tests (pull_request) Has been cancelled
CI / Backend Unit Tests (pull_request) Has been cancelled
CI / E2E Tests (pull_request) Has been cancelled
- Add V14 migration: ON DELETE CASCADE for document_tags and document_receivers so deleting a document removes its join-table rows automatically - Rename default form action to 'update' in the edit page — SvelteKit forbids mixing a default action with named actions (was causing 500 on delete) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
-- Add ON DELETE CASCADE to document_tags and document_receivers so that
|
||||||
|
-- deleting a document automatically removes its tag and receiver associations.
|
||||||
|
|
||||||
|
ALTER TABLE public.document_tags
|
||||||
|
DROP CONSTRAINT fkc99c5qjulwx9gru07yrhicgd2,
|
||||||
|
ADD CONSTRAINT fkc99c5qjulwx9gru07yrhicgd2
|
||||||
|
FOREIGN KEY (document_id) REFERENCES public.documents(id) ON DELETE CASCADE;
|
||||||
|
|
||||||
|
ALTER TABLE public.document_receivers
|
||||||
|
DROP CONSTRAINT fks7t60twjgfmpeqcuc3g0fvjpm,
|
||||||
|
ADD CONSTRAINT fks7t60twjgfmpeqcuc3g0fvjpm
|
||||||
|
FOREIGN KEY (document_id) REFERENCES public.documents(id) ON DELETE CASCADE;
|
||||||
@@ -41,7 +41,7 @@ export async function load({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const actions = {
|
export const actions = {
|
||||||
default: async ({ request, params, fetch }) => {
|
update: async ({ request, params, fetch }) => {
|
||||||
// Raw fetch is used here because FormData multipart bodies are passed through
|
// Raw fetch is used here because FormData multipart bodies are passed through
|
||||||
// directly from the browser without transformation.
|
// directly from the browser without transformation.
|
||||||
const baseUrl = env.API_INTERNAL_URL || 'http://localhost:8080';
|
const baseUrl = env.API_INTERNAL_URL || 'http://localhost:8080';
|
||||||
|
|||||||
@@ -64,7 +64,13 @@ function handleDateInput(e: Event) {
|
|||||||
<div class="mb-6 rounded border border-red-200 bg-red-50 p-4 text-red-700">{form.error}</div>
|
<div class="mb-6 rounded border border-red-200 bg-red-50 p-4 text-red-700">{form.error}</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<form method="POST" enctype="multipart/form-data" use:enhance class="space-y-6 pb-20">
|
<form
|
||||||
|
method="POST"
|
||||||
|
action="?/update"
|
||||||
|
enctype="multipart/form-data"
|
||||||
|
use:enhance
|
||||||
|
class="space-y-6 pb-20"
|
||||||
|
>
|
||||||
<!-- ── Section 1: Wer & Wann ── -->
|
<!-- ── Section 1: Wer & Wann ── -->
|
||||||
<div class="rounded-sm border border-line bg-surface p-6 shadow-sm">
|
<div class="rounded-sm border border-line bg-surface p-6 shadow-sm">
|
||||||
<h2 class="mb-5 text-xs font-bold tracking-widest text-ink-3 uppercase">
|
<h2 class="mb-5 text-xs font-bold tracking-widest text-ink-3 uppercase">
|
||||||
|
|||||||
Reference in New Issue
Block a user