Skip to content

Nawishta: fix author rename - #157

Merged
umerfaruk merged 1 commit into
mainfrom
issue-145-author-rename
Sep 19, 2026
Merged

umerfaruk merged 1 commit into
mainfrom
issue-145-author-rename

Conversation

@umerfaruk

Copy link
Copy Markdown
Contributor

Summary

PUT /api/authors/{id}/name always went through IAuthorRenameService, which queries MaktabaDbContext directly - nonexistent for a Nawishta-backed library (no metadata.db), surfacing as the same unhandled SQLite Error 14: unable to open database file 500 the add-file bug had before its own fix earlier this session.

Changed

  • NawishtaRawApiClient.UpdateAuthorAsync (new): PUT libraries/{libraryId}/authors/{authorId}.
  • AuthorEndpoints.cs's PUT /{id}/name now branches for a Nawishta-backed library: fetches the existing AuthorView, mutates just Name, and PUTs the whole representation back - same pattern NawishtaBookMutationService.UpdateMetadataAsync already uses for books. Same name-collision rule as the local-library branch (case-insensitive, excluding the author's own row) is checked against the live author list first, returning a 409 rather than creating a name clash server-side.

Test plan

  • dotnet build backend/Maktaba.sln - succeeds.
  • Manual: against a real Nawishta account, rename an author from the Authors page and confirm it persists, and confirm renaming to an already-used name returns a clean conflict message instead of a crash (this sandbox can't launch the Electron GUI or reach a live Nawishta account, so this wasn't functionally confirmed beyond a clean build).

Closes #145

🤖 Generated with Claude Code

PUT /api/authors/{id}/name always went through IAuthorRenameService, which
queries MaktabaDbContext directly - nonexistent for a Nawishta-backed
library (no metadata.db), surfacing as the same unhandled "SQLite Error 14"
500 the add-file bug had before its own fix.

Renamed via Nawishta's real author-update endpoint instead
(NawishtaRawApiClient.UpdateAuthorAsync, PUT .../authors/{authorId}), same
"fetch existing AuthorView, mutate the one field, PUT the whole
representation back" pattern NawishtaBookMutationService.UpdateMetadataAsync
already uses for books. Same name-collision rule as the local-library
branch (case-insensitive, excluding the author's own row) is checked
against the live author list before renaming, returning a 409 rather than
creating a name clash server-side.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@umerfaruk
umerfaruk merged commit 0da6127 into main Sep 19, 2026
10 checks passed
@umerfaruk
umerfaruk deleted the issue-145-author-rename branch September 20, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nawishta: author cannot be renamed

1 participant