Pencil icon on each location opens inline form to edit name and description. Saves via rename action, cancel to discard. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -68,6 +68,20 @@ export const actions: Actions = {
|
||||
return { created: true };
|
||||
},
|
||||
|
||||
rename: async ({ request }) => {
|
||||
const formData = await request.formData();
|
||||
const id = formData.get('id') as string;
|
||||
const name = (formData.get('name') as string)?.trim();
|
||||
const description = (formData.get('description') as string)?.trim();
|
||||
if (!name) return fail(400, { error: 'Name is required' });
|
||||
|
||||
await db
|
||||
.update(locations)
|
||||
.set({ name, description: description || null, updatedAt: new Date() })
|
||||
.where(eq(locations.id, id));
|
||||
return { renamed: true };
|
||||
},
|
||||
|
||||
delete: async ({ request }) => {
|
||||
const formData = await request.formData();
|
||||
const id = formData.get('id') as string;
|
||||
|
||||
Reference in New Issue
Block a user