chore: initial public commit

This commit is contained in:
Gabe Farrell 2025-06-11 19:45:39 -04:00
commit fc9054b78c
250 changed files with 32809 additions and 0 deletions

20
internal/models/album.go Normal file
View file

@ -0,0 +1,20 @@
package models
import "github.com/google/uuid"
type Album struct {
ID int32 `json:"id"`
MbzID *uuid.UUID `json:"musicbrainz_id"`
Title string `json:"title"`
Image *uuid.UUID `json:"image"`
Artists []SimpleArtist `json:"artists"`
VariousArtists bool `json:"is_various_artists"`
ListenCount int64 `json:"listen_count"`
}
// type SimpleAlbum struct {
// ID int32 `json:"id"`
// Title string `json:"title"`
// VariousArtists bool `json:"is_various_artists"`
// Image uuid.UUID `json:"image"`
// }

8
internal/models/alias.go Normal file
View file

@ -0,0 +1,8 @@
package models
type Alias struct {
ID int32 `json:"id"`
Alias string `json:"alias"`
Source string `json:"source"`
Primary bool `json:"is_primary"`
}

17
internal/models/artist.go Normal file
View file

@ -0,0 +1,17 @@
package models
import "github.com/google/uuid"
type Artist struct {
ID int32 `json:"id"`
MbzID *uuid.UUID `json:"musicbrainz_id"`
Name string `json:"name"`
Aliases []string `json:"aliases"`
Image *uuid.UUID `json:"image"`
ListenCount int64 `json:"listen_count"`
}
type SimpleArtist struct {
ID int32 `json:"id"`
Name string `json:"name"`
}

11
internal/models/listen.go Normal file
View file

@ -0,0 +1,11 @@
package models
import (
"time"
)
// a Listen is the same thing as a 'scrobble' but i despise the word scrobble so i will not use it
type Listen struct {
Time time.Time `json:"time"`
Track Track `json:"track"`
}

14
internal/models/track.go Normal file
View file

@ -0,0 +1,14 @@
package models
import "github.com/google/uuid"
type Track struct {
ID int32 `json:"id"`
Title string `json:"title"`
Artists []SimpleArtist `json:"artists"`
MbzID *uuid.UUID `json:"musicbrainz_id"`
ListenCount int64 `json:"listen_count"`
Duration int32 `json:"duration"`
Image *uuid.UUID `json:"image"`
AlbumID int32 `json:"album_id"`
}

37
internal/models/user.go Normal file
View file

@ -0,0 +1,37 @@
package models
import (
"time"
"github.com/google/uuid"
)
type UserRole string
const (
UserRoleUser UserRole = "user"
UserRoleAdmin UserRole = "admin"
)
type User struct {
ID int32 `json:"id"`
Username string `json:"username"`
Role UserRole `json:"role"` // 'admin' | 'user'
Password []byte `json:"-"`
}
type ApiKey struct {
ID int32 `json:"id"`
Key string `json:"key"`
Label string `json:"label"`
UserID int32 `json:"user_id"`
CreatedAt time.Time `json:"created_at"`
}
type Session struct {
ID uuid.UUID
UserID int32
CreatedAt time.Time
ExpiresAt time.Time
Persistent bool
}