* backend/api: refactor PlaylistId to PlaylistUid
* Add org_id to Get and Update playlist functions
Fix migration - no longer pad the uid; fix mysql syntax
The relevant tests are passing using postgres, mysql and the default sqllite backends, but there are a number of other failing tests when using postgres and myself so I'm not entirely confident with those results.
* fix bad query in GetPlaylistItem and add a test that would have caught the mistake in the first place. Reverted the playlist_uid column addition in playlist_item; it became unnecessary after this PR.
Added default value to the new UID column based on PR feedback.
* break this PRs migration into its own function
* Playlists: Update UI to use the updated API
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
(cherry picked from commit a33a023629)
Co-authored-by: Kristin Laemmert <mildwonkey@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
d78c04c8e6
commit
8ef7fd3859
+13
-8
@@ -6,12 +6,14 @@ import (
|
||||
|
||||
// Typed errors
|
||||
var (
|
||||
ErrPlaylistNotFound = errors.New("Playlist not found")
|
||||
ErrPlaylistNotFound = errors.New("Playlist not found")
|
||||
ErrPlaylistFailedGenerateUniqueUid = errors.New("failed to generate unique playlist UID")
|
||||
)
|
||||
|
||||
// Playlist model
|
||||
type Playlist struct {
|
||||
Id int64 `json:"id"`
|
||||
UID string `json:"uid" xorm:"uid"`
|
||||
Name string `json:"name"`
|
||||
Interval string `json:"interval"`
|
||||
OrgId int64 `json:"-"`
|
||||
@@ -19,6 +21,7 @@ type Playlist struct {
|
||||
|
||||
type PlaylistDTO struct {
|
||||
Id int64 `json:"id"`
|
||||
UID string `json:"uid"`
|
||||
Name string `json:"name"`
|
||||
Interval string `json:"interval"`
|
||||
OrgId int64 `json:"-"`
|
||||
@@ -51,7 +54,7 @@ type Playlists []*Playlist
|
||||
|
||||
type UpdatePlaylistCommand struct {
|
||||
OrgId int64 `json:"-"`
|
||||
Id int64 `json:"id"`
|
||||
UID string `json:"uid"`
|
||||
Name string `json:"name" binding:"Required"`
|
||||
Interval string `json:"interval"`
|
||||
Items []PlaylistItemDTO `json:"items"`
|
||||
@@ -69,7 +72,7 @@ type CreatePlaylistCommand struct {
|
||||
}
|
||||
|
||||
type DeletePlaylistCommand struct {
|
||||
Id int64
|
||||
UID string
|
||||
OrgId int64
|
||||
}
|
||||
|
||||
@@ -85,12 +88,14 @@ type GetPlaylistsQuery struct {
|
||||
Result Playlists
|
||||
}
|
||||
|
||||
type GetPlaylistByIdQuery struct {
|
||||
Id int64
|
||||
type GetPlaylistByUidQuery struct {
|
||||
UID string
|
||||
OrgId int64
|
||||
Result *Playlist
|
||||
}
|
||||
|
||||
type GetPlaylistItemsByIdQuery struct {
|
||||
PlaylistId int64
|
||||
Result *[]PlaylistItem
|
||||
type GetPlaylistItemsByUidQuery struct {
|
||||
PlaylistUID string
|
||||
OrgId int64
|
||||
Result *[]PlaylistItem
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user