Add the initial project blueprint, Go backend skeleton, frontend app shell, database schema draft, and local development/deployment files.
57 lines
2.0 KiB
Go
57 lines
2.0 KiB
Go
package library
|
|
|
|
type Artist struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
AlbumCount int `json:"albumCount"`
|
|
}
|
|
|
|
type Album struct {
|
|
ID string `json:"id"`
|
|
ArtistID string `json:"artistId"`
|
|
ArtistName string `json:"artistName"`
|
|
Title string `json:"title"`
|
|
Year int `json:"year"`
|
|
TrackCount int `json:"trackCount"`
|
|
}
|
|
|
|
type Track struct {
|
|
ID string `json:"id"`
|
|
AlbumID string `json:"albumId"`
|
|
ArtistID string `json:"artistId"`
|
|
Title string `json:"title"`
|
|
ArtistName string `json:"artistName"`
|
|
AlbumTitle string `json:"albumTitle"`
|
|
TrackNumber int `json:"trackNumber"`
|
|
DurationSecs int `json:"durationSeconds"`
|
|
}
|
|
|
|
type HomePayload struct {
|
|
RecentAlbums []Album `json:"recentAlbums"`
|
|
Artists []Artist `json:"artists"`
|
|
}
|
|
|
|
func DemoHome() HomePayload {
|
|
return HomePayload{
|
|
RecentAlbums: []Album{
|
|
{ID: "album-1", ArtistID: "artist-1", ArtistName: "Tycho", Title: "Awake", Year: 2014, TrackCount: 8},
|
|
{ID: "album-2", ArtistID: "artist-2", ArtistName: "Bonobo", Title: "Migration", Year: 2017, TrackCount: 11},
|
|
{ID: "album-3", ArtistID: "artist-3", ArtistName: "Boards of Canada", Title: "Tomorrow's Harvest", Year: 2013, TrackCount: 17},
|
|
},
|
|
Artists: []Artist{
|
|
{ID: "artist-1", Name: "Tycho", AlbumCount: 4},
|
|
{ID: "artist-2", Name: "Bonobo", AlbumCount: 6},
|
|
{ID: "artist-3", Name: "Boards of Canada", AlbumCount: 7},
|
|
},
|
|
}
|
|
}
|
|
|
|
func DemoTracks() []Track {
|
|
return []Track{
|
|
{ID: "track-1", AlbumID: "album-1", ArtistID: "artist-1", Title: "Awake", ArtistName: "Tycho", AlbumTitle: "Awake", TrackNumber: 1, DurationSecs: 224},
|
|
{ID: "track-2", AlbumID: "album-2", ArtistID: "artist-2", Title: "Migration", ArtistName: "Bonobo", AlbumTitle: "Migration", TrackNumber: 1, DurationSecs: 301},
|
|
{ID: "track-3", AlbumID: "album-3", ArtistID: "artist-3", Title: "Reach for the Dead", ArtistName: "Boards of Canada", AlbumTitle: "Tomorrow's Harvest", TrackNumber: 1, DurationSecs: 292},
|
|
}
|
|
}
|
|
|