feat(releases): replay actions (#932)

* feat(releases): replay actions

* feat(releases): replay actions component

* fix: update filter actions

* fix: select filter_id from ras
This commit is contained in:
ze0s 2023-05-15 21:30:04 +02:00 committed by GitHub
parent 97333d334f
commit 6898ad8315
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 752 additions and 189 deletions

View file

@ -19,7 +19,8 @@ import (
type Service interface {
Store(ctx context.Context, action domain.Action) (*domain.Action, error)
List(ctx context.Context) ([]domain.Action, error)
Delete(actionID int) error
Get(ctx context.Context, req *domain.GetActionRequest) (*domain.Action, error)
Delete(ctx context.Context, req *domain.DeleteActionRequest) error
DeleteByFilterID(ctx context.Context, filterID int) error
ToggleEnabled(actionID int) error
@ -51,18 +52,37 @@ func (s *service) Store(ctx context.Context, action domain.Action) (*domain.Acti
return s.repo.Store(ctx, action)
}
func (s *service) Delete(actionID int) error {
return s.repo.Delete(actionID)
func (s *service) List(ctx context.Context) ([]domain.Action, error) {
return s.repo.List(ctx)
}
func (s *service) Get(ctx context.Context, req *domain.GetActionRequest) (*domain.Action, error) {
a, err := s.repo.Get(ctx, req)
if err != nil {
return nil, err
}
// optionally attach download client to action
if a.ClientID > 0 {
client, err := s.clientSvc.FindByID(ctx, a.ClientID)
if err != nil {
return nil, err
}
a.Client = client
}
return a, nil
}
func (s *service) Delete(ctx context.Context, req *domain.DeleteActionRequest) error {
return s.repo.Delete(ctx, req)
}
func (s *service) DeleteByFilterID(ctx context.Context, filterID int) error {
return s.repo.DeleteByFilterID(ctx, filterID)
}
func (s *service) List(ctx context.Context) ([]domain.Action, error) {
return s.repo.List(ctx)
}
func (s *service) ToggleEnabled(actionID int) error {
return s.repo.ToggleEnabled(actionID)
}