profile

package
v0.0.0-...-b8bede0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TmpDir          = "tmp"
	ValidExtensions = ".jpg,.jpeg,.png,.gif"
	S3Dir           = "profile"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ProfileHandler

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 (service *ProfileServiceImpl) GetProfileByUserUuid(ctx context.Context, userUUID uuid.UUID) (user.User, error)

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 UpdateImageParams struct {
	ImageID  string `json:"imageId" validate:"required"`
	ImageURL string `json:"imageUrl" validate:"required,url"`
}

type UpdatePasswordParams

type UpdatePasswordParams struct {
	OldPassword string `json:"oldPassword" validate:"required,min=8"`
	NewPassword string `json:"newPassword" validate:"required,min=8"`
}

type UpdatePasswordRequest

type UpdatePasswordRequest struct {
	OldPassword string `json:"oldPassword" validate:"required,min=8"`
	NewPassword string `json:"newPassword" validate:"required,min=8"`
}

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"`
}

Jump to

Keyboard shortcuts

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