feat: added new repository implementation, small improvements

This commit is contained in:
ITQ
2025-11-11 21:35:06 +03:00
parent 9d58fe0b41
commit a2345bedac
13 changed files with 395 additions and 25 deletions
+4 -4
View File
@@ -26,10 +26,10 @@ func (r *OrderRepository) Create(ctx context.Context, order *domain.Order) error
r.mu.Lock()
defer r.mu.Unlock()
if _, ok := r.orders[order.ID]; ok {
if _, ok := r.orders[order.ID.String()]; ok {
return domain.ErrOrderAlreadyExist
}
r.orders[order.ID] = order
r.orders[order.ID.String()] = order
return nil
}
@@ -58,10 +58,10 @@ func (r *OrderRepository) Update(ctx context.Context, order *domain.Order) error
r.mu.Lock()
defer r.mu.Unlock()
if _, ok := r.orders[order.ID]; !ok {
if _, ok := r.orders[order.ID.String()]; !ok {
return domain.ErrOrderNotFound
}
r.orders[order.ID] = order
r.orders[order.ID.String()] = order
return nil
}