Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
tank
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
tank
Commits
1a1bb120
Verified
Commit
1a1bb120
authored
4 months ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
feat: remove unused functions
parent
1cd1b0f6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
store/playlists.go
+0
-103
0 additions, 103 deletions
store/playlists.go
with
0 additions
and
103 deletions
store/playlists.go
+
0
−
103
View file @
1a1bb120
...
...
@@ -120,106 +120,3 @@ func (p *Playlist) AfterFind(*gorm.DB) error {
}
return
nil
}
func
(
st
*
Store
)
ListPlaylists
(
showID
uint64
,
offset
,
limit
int
)
(
playlists
[]
Playlist
,
err
error
)
{
err
=
st
.
db
.
Where
(
"show_id = ?"
,
showID
)
.
Preload
(
"Entries"
,
func
(
db
*
gorm
.
DB
)
*
gorm
.
DB
{
return
db
.
Order
(
"playlist_entries.line_num asc"
)
})
.
Preload
(
"Entries.File"
)
.
Order
(
"id"
)
.
Offset
(
offset
)
.
Limit
(
limit
)
.
Find
(
&
playlists
)
.
Error
return
}
func
(
st
*
Store
)
CreatePlaylist
(
showID
uint64
,
playlist
Playlist
)
(
*
Playlist
,
error
)
{
if
_
,
err
:=
st
.
CreateShow
(
showID
);
err
!=
nil
{
return
nil
,
err
}
playlist
.
ID
=
0
playlist
.
ShowID
=
showID
err
:=
st
.
db
.
Create
(
&
playlist
)
.
Error
return
&
playlist
,
err
}
func
(
st
*
Store
)
GetPlaylist
(
showID
uint64
,
id
uint64
)
(
playlist
*
Playlist
,
err
error
)
{
playlist
=
&
Playlist
{}
// we have to make sure that the playlist actually belongs to <show> since permissions are enforced
// based on show membership
err
=
st
.
db
.
Where
(
"show_id = ?"
,
showID
)
.
Preload
(
"Entries"
,
func
(
db
*
gorm
.
DB
)
*
gorm
.
DB
{
return
db
.
Order
(
"playlist_entries.line_num ASC"
)
})
.
Preload
(
"Entries.File"
)
.
First
(
playlist
,
id
)
.
Error
return
}
func
(
st
*
Store
)
UpdatePlaylist
(
showID
uint64
,
id
uint64
,
playlist
Playlist
)
(
out
*
Playlist
,
err
error
)
{
tx
:=
st
.
db
.
Begin
()
defer
func
()
{
if
r
:=
recover
();
r
!=
nil
{
tx
.
Rollback
()
if
err
==
nil
{
err
=
fmt
.
Errorf
(
"runtime panic: %+v"
,
r
)
}
}
}()
if
err
=
tx
.
Error
;
err
!=
nil
{
return
}
// make sure the file exists and actually belongs to <show> since permissions are enforced
// based on show membership
if
err
=
tx
.
Where
(
"show_id = ?"
,
showID
)
.
First
(
&
Playlist
{},
id
)
.
Error
;
err
!=
nil
{
tx
.
Rollback
()
return
}
if
err
=
tx
.
Delete
(
&
PlaylistEntry
{},
"playlist_id = ?"
,
id
)
.
Error
;
err
!=
nil
{
tx
.
Rollback
()
return
}
playlist
.
ID
=
id
playlist
.
ShowID
=
showID
if
err
=
tx
.
Save
(
&
playlist
)
.
Error
;
err
!=
nil
{
tx
.
Rollback
()
return
}
err
=
tx
.
Commit
()
.
Error
out
=
&
playlist
return
}
func
(
st
*
Store
)
DeletePlaylist
(
showID
uint64
,
id
uint64
)
(
err
error
)
{
// we have to make sure that the playlist actually belongs to <show> since permissions are enforced
// based on show membership
result
:=
st
.
db
.
Where
(
"show_id = ?"
,
showID
)
.
Delete
(
&
Playlist
{
ID
:
id
})
if
err
=
result
.
Error
;
err
!=
nil
{
return
}
if
result
.
RowsAffected
==
0
{
return
ErrNotFound
}
return
}
func
(
st
*
Store
)
ListPlaylistsAllShows
(
offset
,
limit
int
)
(
playlists
[]
Playlist
,
err
error
)
{
err
=
st
.
db
.
Preload
(
"Entries"
,
func
(
db
*
gorm
.
DB
)
*
gorm
.
DB
{
return
db
.
Order
(
"playlist_entries.line_num asc"
)
})
.
Preload
(
"Entries.File"
)
.
Order
(
"id"
)
.
Offset
(
offset
)
.
Limit
(
limit
)
.
Find
(
&
playlists
)
.
Error
return
}
func
(
st
*
Store
)
GetPlaylistAllShows
(
id
uint64
)
(
playlist
*
Playlist
,
err
error
)
{
playlist
=
&
Playlist
{}
err
=
st
.
db
.
Preload
(
"Entries"
,
func
(
db
*
gorm
.
DB
)
*
gorm
.
DB
{
return
db
.
Order
(
"playlist_entries.line_num ASC"
)
})
.
Preload
(
"Entries.File"
)
.
First
(
playlist
,
id
)
.
Error
return
}
func
(
st
*
Store
)
GetPlaylistShowID
(
id
uint64
)
(
uint64
,
error
)
{
// WARNING: using this function subverts the checks performed in the other functions
playlist
:=
&
Playlist
{}
if
err
:=
st
.
db
.
First
(
playlist
,
"id = ?"
,
id
)
.
Error
;
err
!=
nil
{
return
0
,
err
}
return
playlist
.
ShowID
,
nil
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment