Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: postgres store #4626

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
Draft

feat: postgres store #4626

wants to merge 15 commits into from

Conversation

heiytor
Copy link
Contributor

@heiytor heiytor commented Mar 8, 2025

No description provided.

@heiytor heiytor self-assigned this Mar 8, 2025
@heiytor heiytor requested review from a team as code owners March 8, 2025 18:54
@heiytor heiytor marked this pull request as draft March 8, 2025 18:55
Comment on lines +44 to +57
if req.Name != "" {
user.Name = cases.Title(language.AmericanEnglish).String(strings.ToLower(req.Name))
}

if req.Username != "" {
user.Username = strings.ToLower(req.Username)
}

if req.Email != "" {
user.Email = strings.ToLower(req.Email)
}

if req.RecoveryEmail != "" {
user.Preferences.SecurityEmail = strings.ToLower(req.RecoveryEmail)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here we can use the previous strategy, which is always to the lowercase function call. The checking seems to be not worth and it complicates the code without a real, probably, good performance gain.

@@ -88,8 +79,9 @@ func (s *service) Setup(ctx context.Context, req requests.Setup) error {
},
}

// TODO: use a transaction here
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that you want to do the user creation and the namespace creation using a database transaction and avoid the need to create and delete the user just by logic. However, I think that this to-do is likely to be left for the future because it's going to demand some more complicated changes in the datastore layer. So my suggestion is for you to describe it better in the description so we can leave it for the next step of the work.

Copy link
Contributor Author

@heiytor heiytor Mar 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. The comment will be removed before the merge when I've taken notes about what I need to do afterward.

@@ -65,21 +78,20 @@ func (s *service) UpdateUser(ctx context.Context, req *requests.UpdateUser) ([]s
//
// Deprecated, use [Service.UpdateUser] instead.
func (s *service) UpdatePasswordUser(ctx context.Context, id, currentPassword, newPassword string) error {
user, _, err := s.store.UserGetByID(ctx, id, false)
user, err := s.store.UserGet(ctx, store.UserIdentID, id)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that this duplicated function could die before we do the change. So we have a restore reduction that needs to be supported for the next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants