fix: in "CreateList", the authenticated userid is now added in the service layer, rather than the handler layer
This commit is contained in:
@@ -3,6 +3,7 @@ package domain
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"slices"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -48,6 +49,10 @@ func (s *ListService) Create(ctx context.Context, authUserID string, name string
|
||||
return nil, errors.New("list name must not be empty")
|
||||
}
|
||||
|
||||
if !slices.Contains(userIDs, authUserID) {
|
||||
userIDs = append(userIDs, authUserID)
|
||||
}
|
||||
|
||||
return s.repo.CreateList(ctx, name, userIDs)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user