postservice

package
v0.0.0-...-139547c Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePost

func CreatePost(req CreatePostRequest, uID uint) (bool, error)

func CreatePostImage

func CreatePostImage(req CreatePostImageRequest) (bool, error)

func VotePost

func VotePost(req VoteRequest, uID uint)

Types

type CreatePostImageRequest

type CreatePostImageRequest struct {
	PostID   uint   `json:"post_id"`
	ImageURL string `json:"image_url"`
	Index    int    `json:"index"`
	Type     string `json:"type"`
}

type CreatePostRequest

type CreatePostRequest struct {
	CircleID uint        `json:"circle_id" binding:"required"`
	Content  string      `json:"content" binding:"required"`
	Type     string      `json:"type"`
	Vote     VoteRequest `json:"vote"`
}

type GetPostsResponse

type GetPostsResponse struct {
	ID       uint                 `json:"id"`
	Content  string               `json:"content"`
	Type     string               `json:"type"`
	User     TUser                `json:"user"`
	Circle   TCircle              `json:"circle"`
	CreateAt time.Time            `json:"create_at"`
	UpdateAt time.Time            `json:"update_at"`
	Images   []postimagedao.Image `json:"images"`
	Vote     *TVote               `json:"vote"`
}

GetPostsResponse post返回结构体

func ListPost

func ListPost(req ListPostRequest, uID uint) ([]GetPostsResponse, error)

ListPost posts列表

type ListPostRequest

type ListPostRequest struct {
	Page     int
	PageSize int
}

ListPostRequest posts请求

type TCircle

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

TCircle 圈子

type TUser

type TUser struct {
	ID     uint   `json:"id"`
	Avatar string `json:"avatar"`
	Name   string `json:"name"`
}

TUser 用户

type TVote

type TVote struct {
	Title         string                   `json:"title"`
	Options       []postvotedao.VoteOption `json:"options"`
	TotalCount    uint                     `json:"total_count"`
	IsCanVote     bool                     `json:"is_can_vote"`
	IsVoted       bool                     `json:"is_voted"`
	IsExpired     bool                     `json:"is_expired"`
	VotedOptionID uint                     `json:"vote_option"`
	CloseDate     time.Time                `json:"close_date"`
}

TVote 投票

type VotePostRequest

type VotePostRequest struct {
	PostID           uint `json:"post_id" binding:"required"`
	PostVoteID       uint `json:"post_vote_id" binding:"required"`
	PostVoteOptionID uint `json:"post_vote_option_id" binding:"required"`
}

type VoteRequest

type VoteRequest struct {
	Title     string    `json:"title"`
	Options   []string  `json:"options"`
	CloseDate time.Time `json:"close_date"`
}

Jump to

Keyboard shortcuts

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