dto

package
v0.0.0-...-bbcf6c5 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWTClaims

type JWTClaims struct {
	ID       uint
	Username string
	jwt.RegisteredClaims
}

type JWTResponse

type JWTResponse struct {
	Access string `json:"access" validate:"required"`
}

func (*JWTResponse) Serializer

func (r *JWTResponse) Serializer(access string)

type LoginRequest

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

type LoginResponse

type LoginResponse struct {
	Access string `json:"access"`
}

func (*LoginResponse) Serializer

func (r *LoginResponse) Serializer(access string)

type Pagination

type Pagination struct {
	Total    int64 `json:"total"`
	Current  int   `json:"current"`
	PageSize int   `json:"page_size"`
}

type PaginationParam

type PaginationParam struct {
	Current  int `json:"current"`
	PageSize int `json:"page_size"`
}

type PostPaginationResponse

type PostPaginationResponse struct {
	List       []PostResponse `json:"list"`
	Pagination *Pagination    `json:"pagination"`
}

func (*PostPaginationResponse) Serializer

func (p *PostPaginationResponse) Serializer(posts *models.Posts)

type PostQueryParam

type PostQueryParam struct {
	PaginationParam
}

type PostRequest

type PostRequest struct {
	Title string `json:"title" validate:"required"`
	Body  string `json:"body" validate:"required"`
}

type PostResponse

type PostResponse struct {
	ID    uint             `json:"id"`
	Title string           `json:"title"`
	Body  string           `json:"body"`
	User  PostUserResponse `json:"user"`
}

func (*PostResponse) Serializer

func (p *PostResponse) Serializer(post *models.Post)

type PostUpdateRequest

type PostUpdateRequest struct {
	Title string `json:"title"`
	Body  string `json:"body"`
}

type PostUserResponse

type PostUserResponse struct {
	ID       uint   `json:"id"`
	Username string `json:"username"`
}

type ProfileResponse

type ProfileResponse struct {
	PhoneNumber string `json:"phone_number,omitempty"`
	Gender      string `json:"gender,omitempty"`
}

type RegisterRequest

type RegisterRequest struct {
	Username string `json:"username" validate:"required"`
	Email    string `json:"email" validate:"required"`
	Password string `json:"password" validate:"required"`
}

type RegisterResponse

type RegisterResponse struct {
	Username string
	Email    string
}

func (*RegisterResponse) Serializer

func (r *RegisterResponse) Serializer(user *models.User)

type UserPaginationResponse

type UserPaginationResponse struct {
	List       []UserResponse `json:"list"`
	Pagination *Pagination    `json:"pagination"`
}

func (*UserPaginationResponse) Serializer

func (p *UserPaginationResponse) Serializer(users *models.Users)

type UserQueryParam

type UserQueryParam struct {
	PaginationParam
}

type UserResponse

type UserResponse struct {
	Username string          `json:"username"`
	Email    string          `json:"email"`
	Profile  ProfileResponse `json:"profile"`
}

func (*UserResponse) Serializer

func (r *UserResponse) Serializer(user *models.User)

Jump to

Keyboard shortcuts

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