summaryrefslogtreecommitdiff
path: root/app/db/in_memory_repository.go
diff options
context:
space:
mode:
Diffstat (limited to 'app/db/in_memory_repository.go')
-rw-r--r--app/db/in_memory_repository.go14
1 files changed, 5 insertions, 9 deletions
diff --git a/app/db/in_memory_repository.go b/app/db/in_memory_repository.go
index 1177662..2aa1fed 100644
--- a/app/db/in_memory_repository.go
+++ b/app/db/in_memory_repository.go
@@ -5,23 +5,20 @@ import (
"sort"
"sync"
- "github.com/xlgmokha/x/pkg/event"
"github.com/xlgmokha/x/pkg/x"
"gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/domain"
"gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/pls"
)
type inMemoryRepository[T domain.Entity] struct {
- aggregator *event.TypedAggregator[T]
- items []T
- mu sync.RWMutex
+ items []T
+ mu sync.RWMutex
}
-func NewRepository[T domain.Entity](aggregator *event.TypedAggregator[T]) domain.Repository[T] {
+func NewRepository[T domain.Entity]() domain.Repository[T] {
return &inMemoryRepository[T]{
- aggregator: aggregator,
- items: []T{},
- mu: sync.RWMutex{},
+ items: []T{},
+ mu: sync.RWMutex{},
}
}
@@ -53,6 +50,5 @@ func (r *inMemoryRepository[T]) Save(ctx context.Context, item T) error {
sort.Slice(r.items, func(i, j int) bool {
return r.items[i].GetID() > r.items[j].GetID()
})
- r.aggregator.Publish("after.create", item)
return nil
}