dtos

package
v0.0.0-...-95ef5b1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoginRequestDto

type LoginRequestDto struct {
	Username string `json:"username" validate:"required"`
	Password string `json:"password" validate:"required"`
}

func (*LoginRequestDto) ValidateLoginRequestDto

func (data *LoginRequestDto) ValidateLoginRequestDto() ([]*utils.ErrorResponse, bool)

type LoginResponseDto

type LoginResponseDto struct {
	UserID      uint   `json:"userId"`
	Username    string `json:"username"`
	Email       string `json:"email"`
	Token       string `json:"token"`
	IsSuperuser bool   `json:"isSuperUser"`
}

func ParseToLoginResponseDto

func ParseToLoginResponseDto(token string, u *models.Users) *LoginResponseDto

type TokenClaimPayload

type TokenClaimPayload struct {
	ID          uint   `json:"id"`
	Username    string `json:"username"`
	Email       string `json:"email"`
	IsSuperuser bool   `json:"is_superuser"`
	jwt.StandardClaims
}

type UserCreateDto

type UserCreateDto struct {
	Username string `json:"username" validate:"required,min=4,max=50"`
	Email    string `json:"email" validate:"required,email,min=8,max=100"`
	Password string `json:"password" validate:"required,min=6"`
}

func (*UserCreateDto) ParseFromDto

func (data *UserCreateDto) ParseFromDto() (user *models.Users)

func (*UserCreateDto) ValidateUserCreateDto

func (data *UserCreateDto) ValidateUserCreateDto() ([]*utils.ErrorResponse, bool)

type UserResponseDto

type UserResponseDto struct {
	Id          uint      `json:"id"`
	Username    string    `json:"username"`
	Email       string    `json:"email"`
	IsActive    bool      `json:"is_active"`
	IsSuperuser bool      `json:"is_superuser"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

func ParseUserToResponseDto

func ParseUserToResponseDto(user *models.Users) *UserResponseDto

func ParseUsersListToResponseDto

func ParseUsersListToResponseDto(users *[]models.Users) []UserResponseDto

func (*UserResponseDto) ParseToResponseDto

func (udto *UserResponseDto) ParseToResponseDto(user *models.Users)

type UserUpdateDto

type UserUpdateDto struct {
	Email       string `json:"email" validate:"omitempty,email,min=8,max=100"`
	IsSuperuser *bool  `json:"is_superuser" validate:"omitempty"`
	IsActive    *bool  `json:"is_active" validate:"omitempty"`
}

func (*UserUpdateDto) ValidateUserUpdateDto

func (data *UserUpdateDto) ValidateUserUpdateDto() ([]*utils.ErrorResponse, bool)

Jump to

Keyboard shortcuts

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