Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions taco/internal/domain/organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ var (
ErrInvalidOrgID = errors.New("invalid organization ID format")
)

// OrgIDPattern defines valid organization ID format: lowercase alphanumeric, hyphens, underscores
var OrgIDPattern = regexp.MustCompile(`^[a-z0-9][a-z0-9_-]*[a-z0-9]$`)
// OrgIDPattern defines valid organization ID format: alphanumeric, hyphens, underscores
var OrgIDPattern = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9_-]*[a-zA-Z0-9]$`)

// ============================================
// Domain Models
Expand Down Expand Up @@ -69,13 +69,13 @@ var (
type UserRepository interface {
// Create or get a user (idempotent)
EnsureUser(ctx context.Context, subject, email string) (*User, error)

// Get user by subject
Get(ctx context.Context, subject string) (*User, error)

// Get user by email
GetByEmail(ctx context.Context, email string) (*User, error)

// List all users
List(ctx context.Context) ([]*User, error)
}
Expand All @@ -94,9 +94,7 @@ func ValidateOrgID(orgID string) error {
return fmt.Errorf("%w: must be at most 50 characters", ErrInvalidOrgID)
}
if !OrgIDPattern.MatchString(orgID) {
return fmt.Errorf("%w: must contain only lowercase letters, numbers, hyphens, and underscores", ErrInvalidOrgID)
return fmt.Errorf("%w: must contain only letters, numbers, hyphens, and underscores", ErrInvalidOrgID)
}
return nil
}


Loading
Loading