credential

package
v0.0.0-...-5bec41d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Code generated by MockGen. DO NOT EDIT. Source: internal/credential/repository.go

Generated by this command:

mockgen -source=internal/credential/repository.go -package=credential

Package credential is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	ConfigService     *config.Service
	CredentialService *Service
	LocalErrorService *localerror.Service
}

func NewController

func NewController(cfg *config.Service, svc *Service, les *localerror.Service) *Controller

func (*Controller) Delete

func (c *Controller) Delete(w http.ResponseWriter, r *http.Request)

Delete Credentials : HTTP endpoint to delete credentials @Tags Credentials @Description Delete a credential @Produce json @Param employee_id path string true "Employee ID" @Success 200 {object} DeleteResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /credentials/{employee_id} [DELETE]

func (*Controller) DeletePassword

func (c *Controller) DeletePassword(w http.ResponseWriter, r *http.Request)

Reset Password : HTTP endpoint to reset password @Tags Credentials @Description Reset a credential's password @Produce json @Param employee_id path string true "Employee ID" @Success 200 {object} PatchPasswordResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /credentials/{employee_id}/password [DELETE]

func (*Controller) PatchPassword

func (c *Controller) PatchPassword(w http.ResponseWriter, r *http.Request)

Patch Password : HTTP endpoint to patch password @Tags Credentials @Description Patch a credential's password @Accept json @Produce json @Param employee_id path string true "Employee ID" @Param data body PatchPasswordRequestDto true "Password Patch Request" @Success 200 {object} PatchPasswordResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /credentials/{employee_id}/password [PATCH]

func (*Controller) Post

func (c *Controller) Post(w http.ResponseWriter, r *http.Request)

Post Credentials : HTTP endpoint to post new credentials @Tags Credentials @Description Post a new credential @Accept json @Produce json @Param data body PostRequestDto true "Credential Request" @Success 200 {object} PostResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /credentials [POST]

type DeletePasswordResponseDto

type DeletePasswordResponseDto = dtorespwithoutdata.Class

type DeleteResponseDto

type DeleteResponseDto = dtorespwithoutdata.Class

type MockRepository

type MockRepository struct {
	// contains filtered or unexported fields
}

MockRepository is a mock of Repository interface.

func NewMockRepository

func NewMockRepository(ctrl *gomock.Controller) *MockRepository

NewMockRepository creates a new mock instance.

func (*MockRepository) CreateWithDb

func (m *MockRepository) CreateWithDb(db *gorm.DB, employeeId, password string) error

CreateWithDb mocks base method.

func (*MockRepository) DeleteByEmployeeId

func (m *MockRepository) DeleteByEmployeeId(employeeId string) error

DeleteByEmployeeId mocks base method.

func (*MockRepository) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRepository) ExistsByEmployeeIdAndPassword

func (m *MockRepository) ExistsByEmployeeIdAndPassword(employeeId, password string) (bool, error)

ExistsByEmployeeIdAndPassword mocks base method.

func (*MockRepository) ResetPasswordByEmployeeId

func (m *MockRepository) ResetPasswordByEmployeeId(employeeId string) error

ResetPasswordByEmployeeId mocks base method.

func (*MockRepository) UpdatePasswordByEmployeeIdAndPassword

func (m *MockRepository) UpdatePasswordByEmployeeIdAndPassword(newPassword, employeeId, currentPassword string) error

UpdatePasswordByEmployeeIdAndPassword mocks base method.

type MockRepositoryMockRecorder

type MockRepositoryMockRecorder struct {
	// contains filtered or unexported fields
}

MockRepositoryMockRecorder is the mock recorder for MockRepository.

func (*MockRepositoryMockRecorder) CreateWithDb

func (mr *MockRepositoryMockRecorder) CreateWithDb(db, employeeId, password any) *gomock.Call

CreateWithDb indicates an expected call of CreateWithDb.

func (*MockRepositoryMockRecorder) DeleteByEmployeeId

func (mr *MockRepositoryMockRecorder) DeleteByEmployeeId(employeeId any) *gomock.Call

DeleteByEmployeeId indicates an expected call of DeleteByEmployeeId.

func (*MockRepositoryMockRecorder) ExistsByEmployeeIdAndPassword

func (mr *MockRepositoryMockRecorder) ExistsByEmployeeIdAndPassword(employeeId, password any) *gomock.Call

ExistsByEmployeeIdAndPassword indicates an expected call of ExistsByEmployeeIdAndPassword.

func (*MockRepositoryMockRecorder) ResetPasswordByEmployeeId

func (mr *MockRepositoryMockRecorder) ResetPasswordByEmployeeId(employeeId any) *gomock.Call

ResetPasswordByEmployeeId indicates an expected call of ResetPasswordByEmployeeId.

func (*MockRepositoryMockRecorder) UpdatePasswordByEmployeeIdAndPassword

func (mr *MockRepositoryMockRecorder) UpdatePasswordByEmployeeIdAndPassword(newPassword, employeeId, currentPassword any) *gomock.Call

UpdatePasswordByEmployeeIdAndPassword indicates an expected call of UpdatePasswordByEmployeeIdAndPassword.

type PatchPasswordRequestDto

type PatchPasswordRequestDto struct {
	CurrentPassword string `json:"current_password"`
	NewPassword     string `json:"new_password"`
}

type PatchPasswordResponseDto

type PatchPasswordResponseDto = dtorespwithoutdata.Class

type PostRequestDto

type PostRequestDto struct {
	EmployeeId string `json:"employee_id"`
	Password   string `json:"password"`
}

type PostResponseDto

type PostResponseDto = dtorespwithoutdata.Class

type Repository

type Repository interface {
	CreateWithDb(db *gorm.DB, employeeId string, password string) error
	ExistsByEmployeeIdAndPassword(employeeId string, password string) (bool, error)
	DeleteByEmployeeId(employeeId string) error
	UpdatePasswordByEmployeeIdAndPassword(newPassword string, employeeId string, currentPassword string) error
	ResetPasswordByEmployeeId(employeeId string) error
}

func NewRepository

func NewRepository(cfg *config.Service) Repository

type RepositoryImpl

type RepositoryImpl struct {
	ConfigService *config.Service
	TableName     string
}

func (*RepositoryImpl) CreateWithDb

func (r *RepositoryImpl) CreateWithDb(
	db *gorm.DB,
	employeeId string,
	password string,
) error

func (*RepositoryImpl) DeleteByEmployeeId

func (r *RepositoryImpl) DeleteByEmployeeId(employeeId string) error

func (*RepositoryImpl) ExistsByEmployeeIdAndPassword

func (r *RepositoryImpl) ExistsByEmployeeIdAndPassword(
	employeeId string,
	password string,
) (bool, error)

func (*RepositoryImpl) ResetPasswordByEmployeeId

func (r *RepositoryImpl) ResetPasswordByEmployeeId(
	employeeId string,
) error

func (*RepositoryImpl) UpdatePasswordByEmployeeIdAndPassword

func (r *RepositoryImpl) UpdatePasswordByEmployeeIdAndPassword(
	newPassword string,
	employeeId string,
	currentPassword string,
) error

type Service

type Service struct {
	ConfigService        *config.Service
	SecurityService      *security.Service
	CredentialRepository Repository
	ProfileRepository    profile.Repository
}

func NewService

func NewService(
	cfg *config.Service,
	ss *security.Service,
	cr Repository,
	pr profile.Repository,
) *Service

func (*Service) Create

func (s *Service) Create(req PostRequestDto) error

func (*Service) DeleteByEmployeeId

func (s *Service) DeleteByEmployeeId(employeeId string) error

func (*Service) ResetPasswordByEmployeeId

func (s *Service) ResetPasswordByEmployeeId(employeeId string) error

func (*Service) UpdatePasswordByEmployeeId

func (s *Service) UpdatePasswordByEmployeeId(employeeId string, req PatchPasswordRequestDto) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL