Update torrent.go
Cette révision appartient à :
Parent
60ba3ba204
révision
245a6f9d2b
1 fichiers modifiés avec 2 ajouts et 2 suppressions
|
@ -174,7 +174,7 @@ func CreateWhereParams(conditions string, params ...string) WhereParams {
|
||||||
}
|
}
|
||||||
|
|
||||||
func DeleteTorrent(id string) (int, error) {
|
func DeleteTorrent(id string) (int, error) {
|
||||||
var torrent model.Torrents
|
var torrent model.Torrent
|
||||||
if db.ORM.First(&torrent, id).RecordNotFound() {
|
if db.ORM.First(&torrent, id).RecordNotFound() {
|
||||||
return http.StatusNotFound, errors.New("Torrent is not found.")
|
return http.StatusNotFound, errors.New("Torrent is not found.")
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ func DeleteTorrent(id string) (int, error) {
|
||||||
return http.StatusOK, nil
|
return http.StatusOK, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func UpdateTorrent(torrent model.Torrents) (int, error) {
|
func UpdateTorrent(torrent model.Torrent) (int, error) {
|
||||||
if db.ORM.Save(torrent).Error != nil {
|
if db.ORM.Save(torrent).Error != nil {
|
||||||
return http.StatusInternalServerError, errors.New("Torrent is not updated.")
|
return http.StatusInternalServerError, errors.New("Torrent is not updated.")
|
||||||
}
|
}
|
||||||
|
|
Référencer dans un nouveau ticket