🗃️ Fixed subscription memory repository Delete signature
/ docker (push) Successful in 1m21s Details

This commit is contained in:
Maxim Lebedev 2023-12-20 07:34:06 +06:00
parent 891b6cf7a6
commit 686c1088a9
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
1 changed files with 4 additions and 4 deletions

View File

@ -39,13 +39,13 @@ func (repo *memorySubscriptionRepository) Create(ctx context.Context, suid domai
return nil return nil
} }
func (repo *memorySubscriptionRepository) Delete(ctx context.Context, suid domain.SUID) error { func (repo *memorySubscriptionRepository) Delete(ctx context.Context, suid domain.SUID) (bool, error) {
if _, err := repo.Get(ctx, suid); err != nil { if _, err := repo.Get(ctx, suid); err != nil {
if !errors.Is(err, subscription.ErrNotExist) { if !errors.Is(err, subscription.ErrNotExist) {
return fmt.Errorf("cannot delete subscription: %w", err) return false, fmt.Errorf("cannot delete subscription: %w", err)
} }
return nil return false, nil
} }
repo.mutex.Lock() repo.mutex.Lock()
@ -53,7 +53,7 @@ func (repo *memorySubscriptionRepository) Delete(ctx context.Context, suid domai
delete(repo.subscriptions, suid) delete(repo.subscriptions, suid)
return nil return true, nil
} }
func (repo *memorySubscriptionRepository) Get(_ context.Context, suid domain.SUID) (*domain.Subscription, error) { func (repo *memorySubscriptionRepository) Get(_ context.Context, suid domain.SUID) (*domain.Subscription, error) {