Moving the arttags table to tags table part 1

This commit is contained in:
2026-02-02 13:05:52 +01:00
parent 6680ccc023
commit 7605ccb0aa
27 changed files with 604 additions and 107 deletions

View File

@ -7,7 +7,7 @@ import { Input } from "@/components/ui/input";
import MultipleSelector from "@/components/ui/multiselect";
import { Switch } from "@/components/ui/switch";
import { Textarea } from "@/components/ui/textarea";
import type { ArtTag } from "@/generated/prisma/client";
import type { Tag } from "@/generated/prisma/client";
import { artworkSchema } from "@/schemas/artworks/imageSchema";
import type { ArtworkWithRelations, CategoryWithTags } from "@/types/Artwork";
import { zodResolver } from "@hookform/resolvers/zod";
@ -20,7 +20,7 @@ export default function EditArtworkForm({ artwork, categories, tags }:
{
artwork: ArtworkWithRelations,
categories: CategoryWithTags[]
tags: ArtTag[]
tags: Tag[]
}) {
const router = useRouter();
const form = useForm<z.infer<typeof artworkSchema>>({
@ -39,7 +39,7 @@ export default function EditArtworkForm({ artwork, categories, tags }:
year: artwork.year || undefined,
creationDate: artwork.creationDate ? new Date(artwork.creationDate) : undefined,
categoryIds: artwork.categories?.map(cat => cat.id) ?? [],
tagIds: artwork.tags?.map(tag => tag.id) ?? [],
tagIds: artwork.tagsV2?.map(tag => tag.id) ?? [],
newCategoryNames: [],
newTagNames: []
}
@ -264,7 +264,7 @@ export default function EditArtworkForm({ artwork, categories, tags }:
const preferredTagIds = new Set<string>();
for (const cat of categories) {
if (!selectedCategoryIds.includes(cat.id)) continue;
for (const t of cat.tags) preferredTagIds.add(t.id);
for (const link of cat.tagLinks) preferredTagIds.add(link.tagId);
}
// Existing tag options with groups
@ -402,4 +402,4 @@ export default function EditArtworkForm({ artwork, categories, tags }:
</Form>
</div >
);
}
}