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 DbPort Interface #71

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

Add CheckUserPassword Method to DbPort Interface #71

Feyzanrs opened this issue May 17, 2024 · 0 comments
Assignees
Labels
Be enhancement New feature or request refactor Improvements or restructuring of existing functionality security Identification or resolution of security concerns

Comments

@Feyzanrs
Copy link
Member

Feyzanrs commented May 17, 2024

The DbPort interface in internal/application/infrastructure/port/repository/db.go needs to be updated to include a new method, CheckUserPassword. This method will check the password of the given user.

The new version of the code:

package application

import (
    "context"

    "github.com/google/uuid"
    pb_logging "github.com/octoposprime/op-be-shared/pkg/proto/pb/logging"
    me "github.com/octoposprime/op-be-user/internal/domain/model/entity"
)

// DbPort is a port for Hexagonal Architecture Pattern.
// It is used to communicate with the database.
type DbPort interface {
    // SetLogger sets logging call-back function
    SetLogger(LogFunc func(ctx context.Context, logData *pb_logging.LogData) (*pb_logging.LoggingResult, error))

    // GetUsersByFilter returns the users that match the given filter.
    GetUsersByFilter(ctx context.Context, userFilter me.UserFilter) (me.Users, error)

    // SaveUser insert a new user or update the existing one in the database.
    SaveUser(ctx context.Context, user me.User) (me.User, error)

    // DeleteUser soft-deletes the given user in the database.
    DeleteUser(ctx context.Context, user me.User) (me.User, error)

    // GetUserPasswordByUserId returns active password of the given user.
    GetUserPasswordByUserId(ctx context.Context, userId uuid.UUID) (me.UserPassword, error)

    // ChangePassword changes the poassword of the given user in the database.
    ChangePassword(ctx context.Context, userPassword me.UserPassword) (me.UserPassword, error)

    // CheckUserPassword checks the password of the given user.
    CheckUserPassword(ctx context.Context, user me.User, userPassword me.UserPassword) (me.User, error) //new method to DbPort
}

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 refactor Improvements or restructuring of existing functionality security Identification or resolution of security concerns labels May 18, 2024
@Feyzanrs Feyzanrs self-assigned this May 20, 2024
@Feyzanrs Feyzanrs reopened this May 20, 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 refactor Improvements or restructuring of existing functionality security Identification or resolution of security concerns
Projects
None yet
Development

No branches or pull requests

3 participants