_type

package
v0.0.0-...-32bdbe6 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthActionLogin    = ActionType("login")
	AuthActionRegister = ActionType("register")
)

Variables

View Source
var (
	Banners []*Banner
)

Functions

This section is empty.

Types

type ActionType

type ActionType string

func (ActionType) String

func (a ActionType) String() string

type AddPointRequest

type AddPointRequest struct {
	InvitedBy   string `json:"invited_by" binding:"required"`
	BonusPoints uint64 `json:"bonus_points" binding:"required"`
}

type AliyunOssRequest

type AliyunOssRequest struct {
	Storage string `json:"storage" binding:"required,ossStorage"`
	Ext     string `json:"ext" binding:"required,ossImageExt"`
}

type AliyunOssResponse

type AliyunOssResponse struct {
	SignUrl          string `json:"signUrl"`
	ExpiredTimestamp int64  `json:"expired"`
}
type Banner struct {
	Image string `json:"image"`
	Link  string `json:"link"`
	Title string `json:"title"`
}

type BannerListResponse

type BannerListResponse struct {
	Banners []*Banner `json:"banners"`
}

func (*BannerListResponse) WithBanners

func (b *BannerListResponse) WithBanners(banners []*Banner) *BannerListResponse

type BaseGroupInfoResponse

type BaseGroupInfoResponse struct {
	Uuid        string `json:"uuid"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

func (BaseGroupInfoResponse) WithGroup

type BaseUserDetailResponse

type BaseUserDetailResponse struct {
	*BaseUserInfoResponse
	Followed bool `json:"followed"`
	Follower bool `json:"follower"`
}

func (*BaseUserDetailResponse) WithBaseInfoResponseUser

func (b *BaseUserDetailResponse) WithBaseInfoResponseUser(user *BaseUserInfoResponse, follower, followed bool) *BaseUserDetailResponse

type BaseUserInfoResponse

type BaseUserInfoResponse struct {
	Uuid     string `json:"uuid"`
	NickName string `json:"nick_name"`
	Avatar   string `json:"avatar"`
}

func (*BaseUserInfoResponse) WithUser

func (*BaseUserInfoResponse) WithUsers

func (b *BaseUserInfoResponse) WithUsers(users []*model.User) []*BaseUserInfoResponse

type CommentResponse

type CommentResponse struct {
	UUID      string                `json:"uuid"`
	PostID    string                `json:"post_id"`
	ParentID  string                `json:"parent_id"`
	Content   string                `json:"content"`
	Creator   *BaseUserInfoResponse `json:"creator"`
	Likes     uint                  `json:"likes"`
	Liked     bool                  `json:"liked"`
	Comments  uint                  `json:"comments"`
	Replies   []CommentResponse     `json:"replies"`
	CreatedAt string                `json:"created_at"`
	UpdatedAt string                `json:"updated_at"`
}

func (*CommentResponse) WithComment

func (c *CommentResponse) WithComment(comment *model.Comment, replies []*model.Comment, users map[string]*model.User, liked map[string]bool) *CommentResponse

type EditUserProfileRequest

type EditUserProfileRequest struct {
	NickName string `json:"nick_name"`
	Avatar   string `json:"avatar"`
}

type EmailLoginRequest

type EmailLoginRequest struct {
	Email string `json:"email" binding:"required,email"`
	Code  string `json:"code" binding:"required"`
}

type EmailVerificationCodeRequest

type EmailVerificationCodeRequest struct {
	To string `json:"to" binding:"required,email"`
}

type EthereumEip712SignatureNonceRequest

type EthereumEip712SignatureNonceRequest struct {
	EthAddress string `json:"eth_address" binding:"required,hexString"`
}

type EthereumEip712SignatureRequest

type EthereumEip712SignatureRequest struct {
	TypedData     string `json:"typedData" binding:"required,hexString"`
	TypedDataHash string `json:"typedDataHash" binding:"required,hexString"`
	Signature     string `json:"signature" binding:"required,hexString"`
}

func (EthereumEip712SignatureRequest) GetTypedData

func (e EthereumEip712SignatureRequest) GetTypedData() string

type GroupCreateParams

type GroupCreateParams struct {
	Name        string `json:"name" binding:"required,max=256"`
	Description string `json:"description" binding:"required,max=256"`
	IsPrivate   bool   `json:"is_private"`
}

type GroupListResponse

type GroupListResponse struct {
	List []*GroupResponse `json:"list"`
}

func (*GroupListResponse) WithGroups

func (g *GroupListResponse) WithGroups(groups []*model.Group, users map[string]*model.User) *GroupListResponse

type GroupResponse

type GroupResponse struct {
	*BaseGroupInfoResponse
	Creator   *BaseUserInfoResponse `json:"creator"`
	IsPrivate bool                  `json:"is_private"`
	Posts     uint64                `json:"posts"`
	Users     uint64                `json:"users"`
	CreatedAt string                `json:"created_at"`
}

func (*GroupResponse) WithGroup

func (g *GroupResponse) WithGroup(group *model.Group, baseUserInfo *BaseUserInfoResponse) *GroupResponse

type GroupUserAddParams

type GroupUserAddParams struct {
	UserID string `json:"user_id" binding:"required,userExists"`
}

type PostCommentListRequest

type PostCommentListRequest struct {
	pages.PageRequest
}

type PostCommentListResponse

type PostCommentListResponse struct {
	Comments []*CommentResponse `json:"comments"`
}

func (*PostCommentListResponse) WithComments

func (p *PostCommentListResponse) WithComments(comments []*model.Comment, replies map[string][]*model.Comment, users map[string]*model.User, liked map[string]bool) *PostCommentListResponse

type PostCreateCommentRequest

type PostCreateCommentRequest struct {
	Content string `json:"content" binding:"required"`
}

type PostCreateParamRequest

type PostCreateParamRequest struct {
	Title   string   `json:"title" binding:"required"`
	Content string   `json:"content" binding:"required"`
	Topics  []string `json:"topics"`
	Images  []string `json:"images"`
}

type PostEditParamRequest

type PostEditParamRequest struct {
	Title   string   `json:"title"`
	Content string   `json:"content"`
	Topics  []string `json:"topics"`
	Images  []string `json:"images"`
}

type PostListRequest

type PostListRequest struct {
	pages.PageRequest
	Orders string `json:"orders"`
}

func (PostListRequest) IsValidOrderParam

func (p PostListRequest) IsValidOrderParam() bool

type PostListResponse

type PostListResponse struct {
	List []*PostResponse `json:"list"`
}

func (*PostListResponse) WithLikes

func (p *PostListResponse) WithLikes(likes map[string]bool) *PostListResponse

根据传入查询的结果,来给返回的列表中的每个post添加是否被点赞

func (*PostListResponse) WithPosts

func (p *PostListResponse) WithPosts(posts []*model.Post, users []*model.User, groups map[string]*model.Group) *PostListResponse

func (*PostListResponse) WithShares

func (p *PostListResponse) WithShares(shares map[string]bool) *PostListResponse

type PostResponse

type PostResponse struct {
	UUID      string                 `json:"uuid"`
	Title     string                 `json:"title"`
	Content   string                 `json:"content"`
	Liked     bool                   `json:"liked"`
	Shared    bool                   `json:"shared"`
	Likes     uint64                 `json:"likes"`
	Comments  uint64                 `json:"comments"`
	Views     uint64                 `json:"views"`
	Images    []string               `json:"images"`
	Group     *BaseGroupInfoResponse `json:"group"`
	Creator   *BaseUserInfoResponse  `json:"creator"`
	CreatedAt string                 `json:"created_at"`
	UpdatedAt string                 `json:"updated_at"`
}

func (*PostResponse) WithLiked

func (p *PostResponse) WithLiked(liked bool) *PostResponse

func (*PostResponse) WithPost

func (p *PostResponse) WithPost(post *model.Post, user *model.User, group *model.Group) *PostResponse

func (*PostResponse) WithShared

func (p *PostResponse) WithShared(shared bool) *PostResponse

type TopicCreateParamRequest

type TopicCreateParamRequest struct {
	Name string `json:"name" binding:"required,max=256"`
}

type TopicResponse

type TopicResponse struct {
	UUID string `json:"uuid"`
	Name string `json:"name"`
}

type UpdatePointRequest

type UpdatePointRequest struct {
	UserID      string `json:"user_id" binding:"required"`
	BonusPoints uint64 `json:"bonus_points" binding:"required"`
}

type UserInfoResponse

type UserInfoResponse struct {
	BaseUserInfoResponse
	Email      string `json:"email"`
	EthAddress string `json:"eth_address"`
	CreatedAt  string `json:"created_at"`
	UpdatedAt  string `json:"updated_at"`
}

func (*UserInfoResponse) WithUser

func (u *UserInfoResponse) WithUser(user *model.User) *UserInfoResponse

Jump to

Keyboard shortcuts

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