Move kind to string

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-03-11 10:18:59 +01:00
parent 764f61bfa7
commit e393411333
19 changed files with 52 additions and 238 deletions

View File

@@ -223,12 +223,12 @@ func (s *Service) CreateUser(
CreatedAt: now,
UpdatedAt: now,
}
if attrs.UserType != "" {
kind := coredata.MembershipProfileKind(attrs.UserType)
profile.Kind = &kind
}
if attrs.UserType != "" {
kind := attrs.UserType
profile.Kind = &kind
}
err = profile.Insert(ctx, tx)
err = profile.Insert(ctx, tx)
if err != nil {
if errors.Is(err, coredata.ErrResourceAlreadyExists) {
return scimerrors.ScimErrorUniqueness
@@ -268,11 +268,11 @@ func (s *Service) CreateUser(
profile.Division = ref.RefOrNil(attrs.Division)
profile.ManagerValue = ref.RefOrNil(attrs.ManagerValue)
profile.UpdatedAt = now
if attrs.UserType != "" {
kind := coredata.MembershipProfileKind(attrs.UserType)
profile.Kind = &kind
}
if err := profile.Update(ctx, tx, scope); err != nil {
if attrs.UserType != "" {
kind := attrs.UserType
profile.Kind = &kind
}
if err := profile.Update(ctx, tx, scope); err != nil {
return fmt.Errorf("cannot update profile: %w", err)
}
}
@@ -524,14 +524,13 @@ func (s *Service) updateUser(
}
if attrs.UserType != nil {
if *attrs.UserType == "" {
profile.Kind = nil
} else {
kind := coredata.MembershipProfileKind(*attrs.UserType)
profile.Kind = &kind
}
profile.UpdatedAt = now
if *attrs.UserType == "" {
profile.Kind = nil
} else {
profile.Kind = attrs.UserType
}
profile.UpdatedAt = now
}
if attrs.NickName != nil {
if *attrs.NickName == "" {