From b32fab81f67522cfe9872e78f0f7e2c9360edb29 Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Sun, 6 Apr 2025 14:41:46 +0200 Subject: [PATCH] Added category update --- components/calendar/category/Table.vue | 8 +- components/calendar/category/TableRow.vue | 179 ++++++++++-------- models/Category.ts | 2 +- server/api/calendars/categories/[id].patch.ts | 72 +++++++ stores/CalendarStore.ts | 2 - stores/CategoryStore.ts | 62 ++++++ supabase/migrations/202401_init.sql | 14 ++ utils/TryCatch.ts | 31 +++ 8 files changed, 281 insertions(+), 89 deletions(-) create mode 100644 server/api/calendars/categories/[id].patch.ts create mode 100644 stores/CategoryStore.ts create mode 100644 utils/TryCatch.ts diff --git a/components/calendar/category/Table.vue b/components/calendar/category/Table.vue index 7169384..f048008 100644 --- a/components/calendar/category/Table.vue +++ b/components/calendar/category/Table.vue @@ -2,9 +2,13 @@ import type { Category } from "~/models/Category"; import { ScrollAreaRoot, ScrollAreaViewport, ScrollAreaScrollbar, ScrollAreaThumb } from "radix-vue" -defineProps<{ +const { categories } = defineProps<{ categories: Category[] }>() + +const sortedCategories = computed(() => { + return categories.toSorted((a, b) => a.name.localeCompare(b.name)) +})