commit a3ba0658854d98257e7df6d872443fceeba88bda
parent b68286805b2cbdd8161d657f743219af9df2bbf9
Author: brookjeynes <me@brookjeynes.dev>
Date: Sun, 7 Jun 2026 18:08:44 +1000
refactor: rename album latin name to latin title
Signed-off-by: brookjeynes <me@brookjeynes.dev>
Diffstat:
12 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/internal/db/album.go b/internal/db/album.go
@@ -12,10 +12,10 @@ func GetAlbum(e Execer, id domain.AlbumID) (domain.Album, error) {
var releaseDateStr string
err := e.QueryRow(`
- select id, title, latin_name, release_date
+ select id, title, latin_title, release_date
from albums
where id = ?
- `, id).Scan(&album.ID, &album.Title, &album.LatinName, &releaseDateStr)
+ `, id).Scan(&album.ID, &album.Title, &album.LatinTitle, &releaseDateStr)
if err != nil {
return domain.Album{}, fmt.Errorf("failed to get album: %w", err)
}
@@ -153,12 +153,12 @@ func InsertAlbum(e Execer, album domain.NewAlbum) error {
result, err := e.Exec(`
insert into albums (
title,
- latin_name,
+ latin_title,
release_date,
created_at
)
values (?, ?, ?, ?)
- `, album.Title, album.LatinName, album.ReleaseDate.Format(time.RFC3339), time.Now().Format(time.RFC3339))
+ `, album.Title, album.LatinTitle, album.ReleaseDate.Format(time.RFC3339), time.Now().Format(time.RFC3339))
if err != nil {
return fmt.Errorf("failed to insert album: %w", err)
}
@@ -196,10 +196,10 @@ func SearchAlbum(e Execer, albumName string) ([]domain.Album, error) {
wildcard := "%" + albumName + "%"
rows, err := e.Query(`
- select id, title, latin_name, release_date
+ select id, title, latin_title, release_date
from albums
where title like ? collate nocase
- or latin_name like ? collate nocase
+ or latin_title like ? collate nocase
order by title
limit 20
`, wildcard, wildcard)
@@ -215,7 +215,7 @@ func SearchAlbum(e Execer, albumName string) ([]domain.Album, error) {
var album domain.Album
var releaseDateStr string
- if err := rows.Scan(&album.ID, &album.Title, &album.LatinName, &releaseDateStr); err != nil {
+ if err := rows.Scan(&album.ID, &album.Title, &album.LatinTitle, &releaseDateStr); err != nil {
return nil, fmt.Errorf("failed to scan album row: %w", err)
}
diff --git a/internal/db/db.go b/internal/db/db.go
@@ -90,7 +90,7 @@ func New(ctx context.Context, dbPath string) (*DB, error) {
create table if not exists albums (
id integer primary key autoincrement,
title text not null,
- latin_name text,
+ latin_title text,
release_date text not null,
created_at text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
diff --git a/internal/db/song.go b/internal/db/song.go
@@ -146,7 +146,7 @@ func GetSong(e Execer, id domain.SongID) (domain.Song, error) {
albumMap := make(map[domain.AlbumID]domain.Album, len(albumIDs))
{
rows, err := e.Query(`
- select id, title, latin_name, release_date
+ select id, title, latin_title, release_date
from albums
where id in (`+placeholders+`)
`, albumIDs...)
@@ -157,7 +157,7 @@ func GetSong(e Execer, id domain.SongID) (domain.Song, error) {
for rows.Next() {
var a domain.Album
var relDate string
- if err := rows.Scan(&a.ID, &a.Title, &a.LatinName, &relDate); err != nil {
+ if err := rows.Scan(&a.ID, &a.Title, &a.LatinTitle, &relDate); err != nil {
_ = rows.Close()
return domain.Song{}, fmt.Errorf("failed to scan album: %w", err)
}
diff --git a/internal/domain/album.go b/internal/domain/album.go
@@ -7,7 +7,7 @@ type AlbumID int64
type NewAlbum struct {
ID AlbumID
Title string
- LatinName *string
+ LatinTitle *string
ReleaseDate time.Time
Artists []NewAlbumArtist
}
@@ -21,7 +21,7 @@ type NewAlbumArtist struct {
type Album struct {
ID AlbumID
Title string
- LatinName *string
+ LatinTitle *string
ReleaseDate time.Time
Artists []AlbumArtist
Songs []Song
diff --git a/internal/server/album.go b/internal/server/album.go
@@ -35,8 +35,8 @@ func (ss *ServerState) Album(w http.ResponseWriter, r *http.Request) {
}
albumTitle := album.Title
- if album.LatinName != nil {
- albumTitle = *album.LatinName
+ if album.LatinTitle != nil {
+ albumTitle = *album.LatinTitle
}
if domain.Slug(albumTitle) != slug {
diff --git a/internal/server/new-album.go b/internal/server/new-album.go
@@ -76,7 +76,7 @@ func parseNewAlbumForm(form NewAlbumForm) (domain.NewAlbum, error) {
album = domain.NewAlbum{
Title: form.Title,
- LatinName: latinTitle,
+ LatinTitle: latinTitle,
ReleaseDate: releaseDate,
Artists: artists,
}
diff --git a/internal/server/routes/routes.go b/internal/server/routes/routes.go
@@ -20,8 +20,8 @@ func SongPath(id domain.SongID, title string) string {
func Album(album domain.Album) string {
title := album.Title
- if album.LatinName != nil {
- title = *album.LatinName
+ if album.LatinTitle != nil {
+ title = *album.LatinTitle
}
return AlbumPath(album.ID, title)
diff --git a/internal/server/ui/partials/album-search-results/album-search-results.templ b/internal/server/ui/partials/album-search-results/album-search-results.templ
@@ -11,8 +11,8 @@ templ AlbumSearchResults(params AlbumSearchResultsParams) {
for _, album := range params.Albums {
{{
label := album.Title
- if album.LatinName != nil {
- label = fmt.Sprintf("%s (%s)", album.Title, *album.LatinName)
+ if album.LatinTitle != nil {
+ label = fmt.Sprintf("%s (%s)", album.Title, *album.LatinTitle)
}
}}
<label>
diff --git a/internal/server/ui/partials/similar-albums-list/similar-albums-list.templ b/internal/server/ui/partials/similar-albums-list/similar-albums-list.templ
@@ -8,8 +8,8 @@ templ SimilarAlbumsList(params SimilarAlbumsListParams) {
{{
value := album.Title
- if album.LatinName != nil {
- value = fmt.Sprintf("%s (%s)", album.Title, *album.LatinName)
+ if album.LatinTitle != nil {
+ value = fmt.Sprintf("%s (%s)", album.Title, *album.LatinTitle)
}
}}
<li title={ value }>
diff --git a/internal/server/ui/views/album/album.templ b/internal/server/ui/views/album/album.templ
@@ -13,8 +13,8 @@ templ Album(params AlbumParams) {
<hgroup>
<h1>
{ params.Album.Title }
- if params.Album.LatinName != nil {
- <span>({ *params.Album.LatinName })</span>
+ if params.Album.LatinTitle != nil {
+ <span>({ *params.Album.LatinTitle })</span>
}
</h1>
</hgroup>
diff --git a/internal/server/ui/views/artist/artist.templ b/internal/server/ui/views/artist/artist.templ
@@ -34,8 +34,8 @@ templ Artist(params ArtistParams) {
<h3>
<a href={ routes.Album(album) }>{ album.Title }</a>
</h3>
- if album.LatinName != nil {
- <span>({ *album.LatinName })</span>
+ if album.LatinTitle != nil {
+ <span>({ *album.LatinTitle })</span>
}
</hgroup>
<ul>
diff --git a/internal/server/ui/views/song/song.templ b/internal/server/ui/views/song/song.templ
@@ -47,8 +47,8 @@ templ Song(params SongParams) {
<li>
<a href={ routes.Album(album.Album) }>
{ album.Album.Title }
- if album.Album.LatinName != nil {
- <span>({ *album.Album.LatinName })</span>
+ if album.Album.LatinTitle != nil {
+ <span>({ *album.Album.LatinTitle })</span>
}
</a>
</li>