Omit empty fields from Native API responses

This commit is contained in:
Deluan 2021-05-31 12:20:21 -04:00
parent 336d891e58
commit 519c89345e
3 changed files with 30 additions and 30 deletions

View File

@ -17,22 +17,22 @@ type Album struct {
MaxYear int `json:"maxYear"`
MinYear int `json:"minYear"`
Compilation bool `json:"compilation"`
Comment string `json:"comment"`
Comment string `json:"comment,omitempty"`
SongCount int `json:"songCount"`
Duration float32 `json:"duration"`
Size int64 `json:"size"`
Genre string `json:"genre"`
FullText string `json:"fullText"`
SortAlbumName string `json:"sortAlbumName"`
SortArtistName string `json:"sortArtistName"`
SortAlbumArtistName string `json:"sortAlbumArtistName"`
SortAlbumName string `json:"sortAlbumName,omitempty"`
SortArtistName string `json:"sortArtistName,omitempty"`
SortAlbumArtistName string `json:"sortAlbumArtistName,omitempty"`
OrderAlbumName string `json:"orderAlbumName"`
OrderAlbumArtistName string `json:"orderAlbumArtistName"`
CatalogNum string `json:"catalogNum"`
MbzAlbumID string `json:"mbzAlbumId" orm:"column(mbz_album_id)"`
MbzAlbumArtistID string `json:"mbzAlbumArtistId" orm:"column(mbz_album_artist_id)"`
MbzAlbumType string `json:"mbzAlbumType"`
MbzAlbumComment string `json:"mbzAlbumComment"`
CatalogNum string `json:"catalogNum,omitempty"`
MbzAlbumID string `json:"mbzAlbumId,omitempty" orm:"column(mbz_album_id)"`
MbzAlbumArtistID string `json:"mbzAlbumArtistId,omitempty" orm:"column(mbz_album_artist_id)"`
MbzAlbumType string `json:"mbzAlbumType,omitempty"`
MbzAlbumComment string `json:"mbzAlbumComment,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}

View File

@ -10,15 +10,15 @@ type Artist struct {
AlbumCount int `json:"albumCount"`
SongCount int `json:"songCount"`
FullText string `json:"fullText"`
SortArtistName string `json:"sortArtistName"`
SortArtistName string `json:"sortArtistName,omitempty"`
OrderArtistName string `json:"orderArtistName"`
Size int64 `json:"size"`
MbzArtistID string `json:"mbzArtistId" orm:"column(mbz_artist_id)"`
Biography string `json:"biography"`
SmallImageUrl string `json:"smallImageUrl"`
MediumImageUrl string `json:"mediumImageUrl"`
LargeImageUrl string `json:"largeImageUrl"`
ExternalUrl string `json:"externalUrl" orm:"column(external_url)"`
MbzArtistID string `json:"mbzArtistId,omitempty" orm:"column(mbz_artist_id)"`
Biography string `json:"biography,omitempty"`
SmallImageUrl string `json:"smallImageUrl,omitempty"`
MediumImageUrl string `json:"mediumImageUrl,omitempty"`
LargeImageUrl string `json:"largeImageUrl,omitempty"`
ExternalUrl string `json:"externalUrl,omitempty" orm:"column(external_url)"`
SimilarArtists Artists `json:"-" orm:"-"`
ExternalInfoUpdatedAt time.Time `json:"externalInfoUpdatedAt"`
}

View File

@ -21,7 +21,7 @@ type MediaFile struct {
HasCoverArt bool `json:"hasCoverArt"`
TrackNumber int `json:"trackNumber"`
DiscNumber int `json:"discNumber"`
DiscSubtitle string `json:"discSubtitle"`
DiscSubtitle string `json:"discSubtitle,omitempty"`
Year int `json:"year"`
Size int64 `json:"size"`
Suffix string `json:"suffix"`
@ -29,24 +29,24 @@ type MediaFile struct {
BitRate int `json:"bitRate"`
Genre string `json:"genre"`
FullText string `json:"fullText"`
SortTitle string `json:"sortTitle"`
SortAlbumName string `json:"sortAlbumName"`
SortArtistName string `json:"sortArtistName"`
SortAlbumArtistName string `json:"sortAlbumArtistName"`
SortTitle string `json:"sortTitle,omitempty"`
SortAlbumName string `json:"sortAlbumName,omitempty"`
SortArtistName string `json:"sortArtistName,omitempty"`
SortAlbumArtistName string `json:"sortAlbumArtistName,omitempty"`
OrderAlbumName string `json:"orderAlbumName"`
OrderArtistName string `json:"orderArtistName"`
OrderAlbumArtistName string `json:"orderAlbumArtistName"`
Compilation bool `json:"compilation"`
Comment string `json:"comment"`
Lyrics string `json:"lyrics"`
Comment string `json:"comment,omitempty"`
Lyrics string `json:"lyrics,omitempty"`
Bpm int `json:"bpm,omitempty"`
CatalogNum string `json:"catalogNum"`
MbzTrackID string `json:"mbzTrackId" orm:"column(mbz_track_id)"`
MbzAlbumID string `json:"mbzAlbumId" orm:"column(mbz_album_id)"`
MbzArtistID string `json:"mbzArtistId" orm:"column(mbz_artist_id)"`
MbzAlbumArtistID string `json:"mbzAlbumArtistId" orm:"column(mbz_album_artist_id)"`
MbzAlbumType string `json:"mbzAlbumType"`
MbzAlbumComment string `json:"mbzAlbumComment"`
CatalogNum string `json:"catalogNum,omitempty"`
MbzTrackID string `json:"mbzTrackId,omitempty" orm:"column(mbz_track_id)"`
MbzAlbumID string `json:"mbzAlbumId,omitempty" orm:"column(mbz_album_id)"`
MbzArtistID string `json:"mbzArtistId,omitempty" orm:"column(mbz_artist_id)"`
MbzAlbumArtistID string `json:"mbzAlbumArtistId,omitempty" orm:"column(mbz_album_artist_id)"`
MbzAlbumType string `json:"mbzAlbumType,omitempty"`
MbzAlbumComment string `json:"mbzAlbumComment,omitempty"`
CreatedAt time.Time `json:"createdAt"` // Time this entry was created in the DB
UpdatedAt time.Time `json:"updatedAt"` // Time of file last update (mtime)
}