Добавил "усыновление" существующих торрентов при добавлении тега или

категории
This commit is contained in:
2026-06-14 17:06:59 +03:00
parent 7f7f5f69d4
commit 4e077d878e
11 changed files with 333 additions and 6 deletions
+17
View File
@@ -105,6 +105,23 @@ func (m *memStore) ListDownloadsByState(_ context.Context, states ...store.State
return out, nil
}
func (m *memStore) ExistsByInfohash(_ context.Context, infohash string) (bool, error) {
for _, d := range m.downloads {
if d.Infohash.Valid && d.Infohash.String == infohash {
return true, nil
}
}
return false, nil
}
func (m *memStore) CreateDownload(_ context.Context, d *store.Download) (int64, error) {
id := int64(len(m.downloads) + 1)
cp := *d
cp.ID = id
m.downloads[id] = &cp
return id, nil
}
func (m *memStore) GetDownload(_ context.Context, id int64) (*store.Download, error) {
d, ok := m.downloads[id]
if !ok {