fix duplicate torrents (again)
This commit is contained in:
@@ -31,10 +31,10 @@ func (m *Model) GetTorrentById(torrentId int64) (*Torrent, error) {
|
||||
return torrent, nil
|
||||
}
|
||||
|
||||
func (m *Model) GetTorrentByGuid(guid string) (*Torrent, error) {
|
||||
func (m *Model) GetTorrentByGuidAndItemId(guid string, itemId int64) (*Torrent, error) {
|
||||
torrent := new(Torrent)
|
||||
|
||||
row := m.db.QueryRowx("SELECT * FROM torrents WHERE guid = ?", guid)
|
||||
row := m.db.QueryRowx("SELECT * FROM torrents WHERE guid = ? AND item_id = ?", guid, itemId)
|
||||
if err := row.StructScan(torrent); err != nil {
|
||||
return nil, fmt.Errorf("torrent not found: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user