feat(artist): editable display name + rename surface; drop name-uniqueness (#130 step 1)
First step of decoupling artist identity/storage/display. migration 0077 drops uq_artist_name so the display name is free text (two genuinely different creators can share a name); the slug stays the immutable, unique storage/identity key (the on-disk path component — untouched, so nothing moves). ArtistService.rename + PATCH /api/artists/<id> change the name ONLY. Frontend: inline pencil-edit on the artist header (mirrors TagCard), slug/route unaffected so no navigation. Fixes the operator's 'no surface to rename an artist' + the name-collision fragility. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CDgx8bQS5YrGRK76v8HUnM
This commit is contained in:
@@ -73,6 +73,16 @@ export const useArtistStore = defineStore('artist', () => {
|
||||
}
|
||||
}
|
||||
|
||||
// Rename the DISPLAY name only (#130). The slug is immutable, so the route
|
||||
// (slug-based) and on-disk paths are unaffected — just patch the shown name.
|
||||
async function rename (name) {
|
||||
if (!overview.value) return
|
||||
const id = overview.value.id
|
||||
const body = await api.patch(`/api/artists/${id}`, { body: { name } })
|
||||
if (overview.value && overview.value.id === id) overview.value.name = body.name
|
||||
return body
|
||||
}
|
||||
|
||||
const hasMoreImages = computed(() => !started || nextCursor.value !== null)
|
||||
const postCount = computed(() => overview.value?.post_count ?? null)
|
||||
const imageCount = computed(() => overview.value?.image_count ?? null)
|
||||
@@ -81,6 +91,6 @@ export const useArtistStore = defineStore('artist', () => {
|
||||
return {
|
||||
overview, images, loading, imagesLoading, error, notFound,
|
||||
hasMoreImages, postCount, imageCount, lastAdded,
|
||||
load, loadMoreImages,
|
||||
load, loadMoreImages, rename,
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user