dto

package
v0.0.0-...-042b7a9 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlogPost

type BlogPost struct {
	ID    uint            `json:"id"`
	Title string          `json:"title"`
	Body  string          `json:"body"`
	User  *UserInBlogPost `json:"user"`
}

type BlogPostCreateRequest

type BlogPostCreateRequest struct {
	Title string `json:"title" validate:"required,min=10,max=200"`
	Body  string `json:"body" validate:"required,min=10"`
}

type BlogPostCreateResponse

type BlogPostCreateResponse struct {
	ID    uint   `json:"id"`
	Title string `json:"title"`
	Body  string `json:"body"`
}

type BlogPostPagination

type BlogPostPagination struct {
	List       []*BlogPost `json:"list"`
	Pagination *Pagination `json:"pagination"`
}

type BlogPostQueryParams

type BlogPostQueryParams struct {
	SearchFilter
	OrderFilter
	PaginationParams
}

func (BlogPostQueryParams) DefaultPageSize

func (q BlogPostQueryParams) DefaultPageSize() int

func (BlogPostQueryParams) OrderFields

func (q BlogPostQueryParams) OrderFields() []string

func (BlogPostQueryParams) SearchFields

func (q BlogPostQueryParams) SearchFields() []string

type BlogPostUpdateRequest

type BlogPostUpdateRequest struct {
	Title string `json:"title" validate:"min=10,max=200"`
	Body  string `json:"body" validate:"min=10"`
}

type BlogPostUpdateResponse

type BlogPostUpdateResponse struct {
	ID    uint   `json:"id"`
	Title string `json:"title"`
	Body  string `json:"body"`
}

type Comment

type Comment struct {
	ID   uint           `json:"id"`
	Body string         `json:"body"`
	User *UserInComment `json:"user"`
	Post *PostInComment `json:"post"`
}

type CommentCreateRequest

type CommentCreateRequest struct {
	Body   string `json:"body" validate:"required,min=10,max=500"`
	PostID uint   `json:"post_id" validate:"required,gte=0"`
}

type CommentCreateResponse

type CommentCreateResponse struct {
	ID     uint   `json:"id"`
	Body   string `json:"body"`
	PostID uint   `json:"post_id"`
}

type CommentPagination

type CommentPagination struct {
	List       []*Comment  `json:"list"`
	Pagination *Pagination `json:"pagination"`
}

type CommentQueryParams

type CommentQueryParams struct {
	SearchFilter
	OrderFilter
	PaginationParams
}

func (CommentQueryParams) DefaultPageSize

func (q CommentQueryParams) DefaultPageSize() int

func (CommentQueryParams) OrderFields

func (q CommentQueryParams) OrderFields() []string

func (CommentQueryParams) SearchFields

func (q CommentQueryParams) SearchFields() []string

type CommentUpdateRequest

type CommentUpdateRequest struct {
	Body string `json:"body" validate:"min=10,max=500"`
}

type CommentUpdateResponse

type CommentUpdateResponse struct {
	ID     uint   `json:"id"`
	Body   string `json:"body"`
	PostID uint   `json:"post_id"`
}

type FollowerCreateRequest

type FollowerCreateRequest struct {
	UserID uint `json:"user_id" validate:"required"`
}

type JWTToken

type JWTToken struct {
	ID       string
	Username string
}

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email" validate:"required,email"`
	Password string `json:"password" validate:"required,min=8,max=20"`
}

type LoginResponse

type LoginResponse struct {
	Token string `json:"token"`
}

type MePasswordRequest

type MePasswordRequest struct {
	OldPassword     string `json:"old_password" validate:"required,min=8,max=20"`
	NewPassword     string `json:"new_password" validate:"required,min=8,max=20"`
	ConfirmPassword string `json:"confirm_password" validate:"required,min=8,max=20"`
}

func (MePasswordRequest) PasswordMatches

func (d MePasswordRequest) PasswordMatches() bool

type MeResponse

type MeResponse struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

type MeUpdateRequest

type MeUpdateRequest struct {
	Name string `json:"name"`
}

type OrderFilter

type OrderFilter struct {
	OrderBy string `json:"order_by" query:"order_by"`
}

func (OrderFilter) ParseOrderFilter

func (f OrderFilter) ParseOrderFilter(safeFilters []string) string

type Pagination

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

type PaginationParams

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

func (*PaginationParams) SetDefaultPageSize

func (p *PaginationParams) SetDefaultPageSize(pageSize int)

type PostInComment

type PostInComment struct {
	ID    uint   `json:"id"`
	Title string `json:"title"`
}

type RegisterRequest

type RegisterRequest struct {
	Email    string `json:"email" validate:"required,email"`
	Name     string `json:"name" validate:"required,min=3,max=20"`
	Password string `json:"password" validate:"required,min=8,max=20"`
}

type RegisterResponse

type RegisterResponse struct {
	Email string `json:"email"`
	Name  string `json:"name"`
}

type SearchFilter

type SearchFilter struct {
	Q string `json:"q" query:"q"`
}

func (SearchFilter) GetSearch

func (f SearchFilter) GetSearch(search []string) string

type UnFollowerCreateRequest

type UnFollowerCreateRequest struct {
	UserID uint `json:"user_id" validate:"required"`
}

type User

type User struct {
	ID   uint   `json:"id"`
	Name string `json:"name"`
}

type UserInBlogPost

type UserInBlogPost struct {
	ID   uint   `json:"id"`
	Name string `json:"name"`
}

type UserInComment

type UserInComment struct {
	ID    uint   `json:"id"`
	Name  string `json:"name"`
	Email string `json:"email"`
}

type UserInFollower

type UserInFollower struct {
	ID   uint   `json:"id"`
	Name string `json:"name"`
}

type UserPagination

type UserPagination struct {
	List       []*User     `json:"list"`
	Pagination *Pagination `json:"pagination"`
}

type UserQueryParams

type UserQueryParams struct {
	SearchFilter
	OrderFilter
	PaginationParams
}

func (UserQueryParams) DefaultPageSize

func (q UserQueryParams) DefaultPageSize() int

func (UserQueryParams) OrderFields

func (q UserQueryParams) OrderFields() []string

func (UserQueryParams) SearchFields

func (q UserQueryParams) SearchFields() []string

Jump to

Keyboard shortcuts

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