Added add endpoint

This commit is contained in:
Alexander
2026-05-07 10:27:20 +02:00
parent 6071bc7980
commit 97a57c10fd
5 changed files with 344 additions and 39 deletions
+12
View File
@@ -29,6 +29,18 @@ func (server *TorrentServer) List(ctx context.Context, req *pb.ListRequest) (*pb
return server.service.List(req)
}
func (server *TorrentServer) Add(ctx context.Context, req *pb.AddRequest) (*pb.AddResponse, error) {
log.Debug().Str("download_url", req.GetDownloadUrl()).Str("filename", req.GetFilename()).Msg("add torrent requested")
resp, err := server.service.Add(req)
if err != nil {
log.Error().Err(err).Msg("add torrent failed")
return nil, err
}
return resp, nil
}
func (s *TorrentServer) Register(server *grpc.Server) {
pb.RegisterTorrentServiceServer(server, s)
}