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

Add CheckUserPassword Method to CommandAdapter #75

Closed
Feyzanrs opened this issue May 19, 2024 · 0 comments
Closed

Add CheckUserPassword Method to CommandAdapter #75

Feyzanrs opened this issue May 19, 2024 · 0 comments
Assignees
Labels
Be enhancement New feature or request feature Proposal or implementation of new features

Comments

@Feyzanrs
Copy link
Member

Feyzanrs commented May 19, 2024

This update adds a new method CheckUserPassword to the CommandAdapter to enhance password verification functionality. This method ensures that the user password can be checked in the application layer.

Path of the file to be changed

internal/application/presentation/adapter/command/user.go

Updated Code

package application

import (
	"context"

	me "github.com/octoposprime/op-be-user/internal/domain/model/entity"
)

// CreateUser sends the given user to the application layer for creating a new user.
func (a CommandAdapter) CreateUser(ctx context.Context, user me.User) (me.User, error) {
	return a.Service.CreateUser(ctx, user)
}

// UpdateUserBase sends the given base values of the user to the repository of the infrastructure layer for updating base values of user data.
func (a CommandAdapter) UpdateUserBase(ctx context.Context, user me.User) (me.User, error) {
	return a.Service.UpdateUserBase(ctx, user)
}

// UpdateUserStatus sends the given status value of the user to the repository of the infrastructure layer for updating status of user data.
func (a CommandAdapter) UpdateUserStatus(ctx context.Context, user me.User) (me.User, error) {
	return a.Service.UpdateUserStatus(ctx, user)
}

// UpdateUserRole sends the given type value of the user to the repository of the infrastructure layer for updating role of user data.
func (a CommandAdapter) UpdateUserRole(ctx context.Context, user me.User) (me.User, error) {
	return a.Service.UpdateUserRole(ctx, user)
}

// DeleteUser sends the given user to the application layer for deleting data.
func (a CommandAdapter) DeleteUser(ctx context.Context, user me.User) (me.User, error) {
	return a.Service.DeleteUser(ctx, user)
}

// ChangePassword sends the given user password to the application layer for changing user password.
func (a CommandAdapter) ChangePassword(ctx context.Context, userPassword me.UserPassword) error {
	return a.Service.ChangePassword(ctx, userPassword)
}

// CheckUserPassword sends the given user and user password to the application layer for checking user password.
func (a CommandAdapter) CheckUserPassword(ctx context.Context, user me.User, userPassword me.UserPassword) (me.User, error) {
    return a.Service.CheckUserPassword(ctx, user, userPassword)
}

The changes will be merged into the enhance/team/66/implement-password-validation branch first. Therefore, set the base branch of the pull request as enhance/team/66/implement-password-validation.

@Feyzanrs Feyzanrs added enhancement New feature or request feature Proposal or implementation of new features labels May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Be enhancement New feature or request feature Proposal or implementation of new features
Projects
None yet
Development

No branches or pull requests

4 participants