Documentation
¶
Index ¶
- Constants
- type ProfileHandler
- type ProfileService
- type ProfileServiceImpl
- func (service *ProfileServiceImpl) DeleteProfileByUserUuid(ctx context.Context, userUUID uuid.UUID) (user.UserEntity, error)
- func (service *ProfileServiceImpl) GetProfileByUserUuid(ctx context.Context, userUUID uuid.UUID) (user.User, error)
- func (service *ProfileServiceImpl) PushUserEvent(event user.UserChangeEvent)
- func (service *ProfileServiceImpl) UpdateImageByUserUuid(ctx context.Context, userUUID uuid.UUID, p UpdateImageParams) (user.UserEntity, error)
- func (service *ProfileServiceImpl) UpdatePasswordByUserUuid(ctx context.Context, userUUID uuid.UUID, p UpdatePasswordParams) (user.UserEntity, error)
- func (service *ProfileServiceImpl) UpdateProfileByUserUuid(ctx context.Context, userUUID uuid.UUID, p UpdateProfileParams) (user.UserEntity, error)
- type UpdateImageParams
- type UpdatePasswordParams
- type UpdatePasswordRequest
- type UpdateProfileParams
- type UpdateProfileRequest
Constants ¶
const ( TmpDir = "tmp" ValidExtensions = ".jpg,.jpeg,.png,.gif" S3Dir = "profile" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProfileHandler ¶
type ProfileHandler struct {
conf.Config
*validator.Validate
ProfileService
storage.StorageService
}
func NewProfileHandler ¶
func NewProfileHandler(profileService ProfileService, storageService storage.StorageService, config conf.Config, validate *validator.Validate) ProfileHandler
func (*ProfileHandler) DeleteProfile ¶
func (h *ProfileHandler) DeleteProfile(ctx *gin.Context)
@BasePath /api DeleteProfile godoc @Summary delete profile @Description delete profile @Tags profile @Accept json @Produce json @Param Authorization header string true "Bearer token" @Success 200 {object} common.MessageResponse @Failure 400 {object} exception.ErrorResponse @Failure 401 {object} exception.ErrorResponse @Failure 403 {object} exception.ErrorResponse @Failure 404 {object} exception.ErrorResponse @Failure 500 {object} exception.ErrorResponse @Router /v1/profile [delete]
func (*ProfileHandler) GetProfile ¶
func (h *ProfileHandler) GetProfile(ctx *gin.Context)
@BasePath /api GetProfile godoc @Summary get profile @Description get profile @Tags profile @Accept json @Produce json @Param Authorization header string true "Bearer token" @Success 200 {object} user.User @Failure 401 {object} exception.ErrorResponse @Failure 403 {object} exception.ErrorResponse @Failure 404 {object} exception.ErrorResponse @Failure 500 {object} exception.ErrorResponse @Router /v1/profile [get]
func (*ProfileHandler) UpdateImage ¶
func (h *ProfileHandler) UpdateImage(ctx *gin.Context)
@BasePath /api UpdateImage godoc @Summary update image @Description update image @Tags profile @Accept mpfd @Produce json @Param image formData file true "image file" @Param Authorization header string true "Bearer token" @Success 200 {object} user.User @Failure 401 {object} exception.ErrorResponse @Failure 403 {object} exception.ErrorResponse @Failure 404 {object} exception.ErrorResponse @Failure 500 {object} exception.ErrorResponse @Router /v1/profile/image [put]
func (*ProfileHandler) UpdatePassword ¶
func (h *ProfileHandler) UpdatePassword(ctx *gin.Context)
@BasePath /api UpdatePassword godoc @Summary update password @Description update password @Tags profile @Accept json @Produce json @Param UpdatePasswordRequest body UpdatePasswordRequest true "Update Password Request" @Param Authorization header string true "Bearer token" @Success 200 {object} user.User @Failure 401 {object} exception.ErrorResponse @Failure 403 {object} exception.ErrorResponse @Failure 404 {object} exception.ErrorResponse @Failure 500 {object} exception.ErrorResponse @Router /v1/profile/password [put]
func (*ProfileHandler) UpdateProfile ¶
func (h *ProfileHandler) UpdateProfile(ctx *gin.Context)
@BasePath /api UpdateProfile godoc @Summary update profile @Description update profile @Tags profile @Accept json @Produce json @Param UpdateProfileRequest body UpdateProfileRequest true "Update Profile Request" @Param Authorization header string true "Bearer token" @Success 200 {object} user.User @Failure 401 {object} exception.ErrorResponse @Failure 403 {object} exception.ErrorResponse @Failure 404 {object} exception.ErrorResponse @Failure 500 {object} exception.ErrorResponse @Router /v1/profile [put]
type ProfileService ¶
type ProfileService interface {
GetProfileByUserUuid(ctx context.Context, userUUID uuid.UUID) (user.User, error)
UpdateProfileByUserUuid(ctx context.Context, userUUID uuid.UUID, req UpdateProfileParams) (user.UserEntity, error)
UpdatePasswordByUserUuid(ctx context.Context, userUUID uuid.UUID, req UpdatePasswordParams) (user.UserEntity, error)
UpdateImageByUserUuid(ctx context.Context, userUUID uuid.UUID, req UpdateImageParams) (user.UserEntity, error)
DeleteProfileByUserUuid(ctx context.Context, userUUID uuid.UUID) (user.UserEntity, error)
PushUserEvent(event user.UserChangeEvent)
}
func NewProfileService ¶
func NewProfileService(datastore db.DataStore, userService user.UserService) ProfileService
type ProfileServiceImpl ¶
type ProfileServiceImpl struct {
// contains filtered or unexported fields
}
func (*ProfileServiceImpl) DeleteProfileByUserUuid ¶
func (service *ProfileServiceImpl) DeleteProfileByUserUuid(ctx context.Context, userUUID uuid.UUID) (user.UserEntity, error)
func (*ProfileServiceImpl) GetProfileByUserUuid ¶
func (*ProfileServiceImpl) PushUserEvent ¶
func (service *ProfileServiceImpl) PushUserEvent(event user.UserChangeEvent)
func (*ProfileServiceImpl) UpdateImageByUserUuid ¶
func (service *ProfileServiceImpl) UpdateImageByUserUuid(ctx context.Context, userUUID uuid.UUID, p UpdateImageParams) (user.UserEntity, error)
func (*ProfileServiceImpl) UpdatePasswordByUserUuid ¶
func (service *ProfileServiceImpl) UpdatePasswordByUserUuid(ctx context.Context, userUUID uuid.UUID, p UpdatePasswordParams) (user.UserEntity, error)
func (*ProfileServiceImpl) UpdateProfileByUserUuid ¶
func (service *ProfileServiceImpl) UpdateProfileByUserUuid(ctx context.Context, userUUID uuid.UUID, p UpdateProfileParams) (user.UserEntity, error)
type UpdateImageParams ¶
type UpdatePasswordParams ¶
type UpdatePasswordRequest ¶
type UpdateProfileParams ¶
type UpdateProfileParams struct {
Name string `json:"name" validate:"required,max=100"`
}
type UpdateProfileRequest ¶
type UpdateProfileRequest struct {
Name string `json:"name" validate:"required,max=100"`
}