model

package
v0.0.0-...-bf4de7e Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelPollInput

type CancelPollInput struct {
	PollID       uint        `json:"poll_id" dc:"投票 ID"`
	UserID       uint        `json:"user_id" dc:"用户 ID"`
	SentenceUUID string      `json:"sentence_uuid" dc:"句子 UUID"`
	PolledData   *PolledData `json:"polled_data" dc:"投票数据"`
}

type Context

type Context struct {
	User *ContextUser // User in context.
}

type ContextUser

type ContextUser UserCtxSchema

type DailyReportMessageUserInformationPolled

type DailyReportMessageUserInformationPolled struct {
	Total      int `json:"total"`       // 投票参与的总数
	Accept     int `json:"accept"`      // 投批准票的投票数目
	Reject     int `json:"reject"`      // 投拒绝票的投票数目
	NeedEdited int `json:"need_edited"` // 投需要修改的投票数目
}

type DailyReportNotificationMessage

type DailyReportNotificationMessage struct {
	CreatedAt         string                       `json:"created_at"`         // 报告生成时间
	To                string                       `json:"to"`                 // 接收人地址
	UserName          string                       `json:"user_name"`          // 接收人名称
	SystemInformation DailyReportSystemInformation `json:"system_information"` // 系统信息
	UserInformation   DailyReportUserInformation   `json:"user_information"`   // 用户信息
}

type DailyReportSystemInformation

type DailyReportSystemInformation struct {
	Total             int `json:"total"`               // 平台当前剩余的投票数目
	ProcessTotal      int `json:"process_total"`       // 平台处理了的投票数目(过去 24 小时)
	ProcessAccept     int `json:"process_accept"`      // 平台处理为入库的投票数目(过去 24 小时)
	ProcessReject     int `json:"process_reject"`      // 平台处理为驳回的投票数目(过去 24 小时)
	ProcessNeedEdited int `json:"process_need_edited"` // 平台处理为亟待修改的投票数目(过去 24 小时)
}

type DailyReportUserInformation

type DailyReportUserInformation struct {
	Polled         DailyReportMessageUserInformationPolled `json:"polled"`           // 用户参与了的投票数目(过去 24 小时)
	Waiting        int                                     `json:"waiting"`          // 等待其他用户参与的投票数目(基于已投票的数目)
	Accepted       int                                     `json:"accepted"`         // 已入库的投票数目(基于已投票的数目)
	Rejected       int                                     `json:"rejected"`         // 已驳回的投票数目(基于已投票的数目)
	InNeedEdited   int                                     `json:"in_need_edited"`   // 已进入亟待修改状态的投票数目(基于已投票的数目)
	WaitForPolling int                                     `json:"wait_for_polling"` // 基于剩余投票数目,计算出来的等待投票数目。
}

type DoHitokotoV1Update

type DoHitokotoV1Update struct {
	Hitokoto   *string `json:"hitokoto" dc:"句子内容" v:"length:1,255" mapstructure:"hitokoto,omitempty"`
	From       *string `json:"from" dc:"句子来源" v:"min-length:1" mapstructure:"from,omitempty"`
	FromWho    *string `json:"from_who" dc:"句子来源者" v:"length:1,255" mapstructure:"from_who,omitempty" `
	Type       *string `json:"type" dc:"句子类型" v:"length:1,255" mapstructure:"type,omitempty"`
	CommitFrom *string `json:"commit_from" dc:"句子提交来源" v:"length:1,255" mapstructure:"commit_from,omitempty"`
	Creator    *string `json:"creator" dc:"句子创建者" v:"length:1,255" mapstructure:"creator,omitempty"`
	CreatorUID *uint   `json:"creator_uid" dc:"句子创建者 ID" v:"min:1" mapstructure:"creator_uid,omitempty"`
	Reviewer   *uint   `json:"reviewer" dc:"句子审查者 ID" v:"min:1" mapstructure:"reviewer,omitempty"`
	CreatedAt  *string `json:"created_at" dc:"创建时间" v:"length:1,255" mapstructure:"created_at,omitempty"`
}

type GetHitokotoV1SchemaListInput

type GetHitokotoV1SchemaListInput struct {
	Page     int    `json:"page" v:"min:1" d:"1" dc:"页码"`
	PageSize int    `json:"page_size" v:"min:0|max:1000" d:"30" dc:"每页数量"`
	Order    string `json:"order" v:"in:desc,asc" d:"desc" dc:"排序方式"`
	// 搜索参数
	UUIDs    []string               `json:"uuids" dc:"句子 UUID"`
	Keywords *string                `json:"keyword" dc:"句子内容"`
	Creator  *string                `json:"creator" dc:"句子创建者(或 ID)"`
	From     *string                `json:"from" dc:"句子来源"`
	FromWho  *string                `json:"from_who" dc:"句子来源者"`
	Type     *string                `json:"type" dc:"句子类型"`
	Status   *consts.HitokotoStatus `json:"status" dc:"句子状态" v:"in:pending,approved,rejected"`
	Start    *gtime.Time            `json:"start" dc:"开始时间"`
	End      *gtime.Time            `json:"end" dc:"结束时间"`
}

type GetHitokotoV1SchemaListOutput

type GetHitokotoV1SchemaListOutput Page[HitokotoV1WithPoll]

type GetPollListInput

type GetPollListInput struct {
	StatusStart     int
	StatusEnd       int
	Order           string
	UserID          uint // 仅当 WithPollRecords 为 true 时有效
	WithPollRecords bool
	WithMarks       bool
	WithCache       bool
	PolledFilter    consts.PollListPolledFilter
	Page            int
	PageSize        int
}

type GetPollListOutput

type GetPollListOutput Page[PollListElement]

type GetUserPollLogsInput

type GetUserPollLogsInput struct {
	UserID    uint   // 用户 ID
	Order     string // 排序方式 `dc:"排序方式"`
	Page      int
	PageSize  int
	WithCache bool
}

type GetUserPollLogsOutput

type GetUserPollLogsOutput Page[UserPollLog]

type GetUserPollLogsWithPollResultInput

type GetUserPollLogsWithPollResultInput = GetUserPollLogsInput

type GetUserPollLogsWithPollResultOutput

type GetUserPollLogsWithPollResultOutput Page[UserPollElement]

type GetUserPollLogsWithSentenceInput

type GetUserPollLogsWithSentenceInput = GetUserPollLogsInput

type GetUserPollLogsWithSentenceOutput

type GetUserPollLogsWithSentenceOutput Page[UserPollLogWithSentenceAndUserMarks]

type GetUserScoreRecordsInput

type GetUserScoreRecordsInput struct {
	UserID    uint   `json:"user_id" dc:"用户 ID"`
	Page      int    `json:"page" dc:"当前页数"`
	PageSize  int    `json:"page_size" dc:"每页数量"`
	Order     string `json:"order" dc:"排序方式"`
	WithCache bool
}

type GetUserScoreRecordsOutput

type GetUserScoreRecordsOutput struct {
	Collection []UserScoreRecord `json:"collection" dc:"数据"`
	Total      int               `json:"total" dc:"总数"`
	Page       int               `json:"page" dc:"当前页数"`
	PageSize   int               `json:"page_size" dc:"每页数量"`
}

type HitokotoV1

type HitokotoV1 struct {
	ID         uint                  `json:"id" dc:"句子 ID"`
	UUID       string                `json:"uuid" dc:"句子 UUID"`
	Hitokoto   string                `json:"hitokoto" dc:"句子内容"`
	Type       consts.HitokotoType   `json:"type" dc:"句子类型"`
	From       string                `json:"from" dc:"句子来源"`
	FromWho    *string               `json:"from_who" dc:"句子来源者"`
	Creator    string                `json:"creator" dc:"句子创建者"`
	CreatorUID uint                  `json:"creator_uid" dc:"句子创建者 ID"`
	Reviewer   uint                  `json:"reviewer" dc:"句子审查者 ID"`
	CommitFrom string                `json:"commit_from" dc:"句子提交来源"`
	Status     consts.HitokotoStatus `json:"status" dc:"句子状态"`
	CreatedAt  string                `json:"created_at" dc:"创建时间"`
}

type HitokotoV1WithPoll

type HitokotoV1WithPoll struct {
	HitokotoV1
	PollStatus consts.PollStatus `json:"poll_status" dc:"句子投票状态"`
}

type ModifySentenceParams

type ModifySentenceParams struct {
	Hitokoto string `json:"hitokoto" dc:"句子内容" v:"length:1,1000#句子长度应该在 1-1000 之间"`
	Type     string `json:"type" dc:"句子类型" v:"length:1,100#句子类型长度应该在 1-100 之间"`
	From     string `json:"from" dc:"句子来源" v:"length:1,100#来源长度应该在 1-100 之间"`
	FromWho  string `json:"from_who" dc:"句子来源者" v:"length:1,100#来源者长度应该在 1-100 之间"`
	Creator  string `json:"creator" dc:"句子创建者" v:"length:1,100#创建者长度应该在 1-100 之间"`
}

type Page

type Page[T any] struct {
	Total      int `json:"total" dc:"总数"`
	Page       int `json:"page" dc:"页码"`
	PageSize   int `json:"page_size" dc:"每页数量"`
	Collection []T `json:"collection" dc:"数据"`
}

type PollElement

type PollElement struct {
	ID                 uint                `json:"id" dc:"投票 ID"`
	SentenceUUID       string              `json:"sentence_uuid" dc:"句子 UUID"`
	Sentence           *HitokotoV1WithPoll `json:"sentence" dc:"句子"`
	Status             consts.PollStatus   `json:"status" dc:"投票状态"`
	Approve            int                 `json:"approve" dc:"赞同票数"`
	Reject             int                 `json:"reject" dc:"反对票数"`
	NeedModify         int                 `json:"need_edited" dc:"需要修改票数"`
	NeedCommonUserPoll int                 `json:"need_common_user_poll" dc:"需要普通用户投票"`
	CreatedAt          *time.Time          `json:"created_at" dc:"创建时间"`
	UpdatedAt          *time.Time          `json:"updated_at" dc:"更新时间"`
}

type PollInput

type PollInput struct {
	Method       consts.PollMethod `json:"method" dc:"投票方式"`
	Point        int               `json:"point" dc:"投票点数"`
	PollID       uint              `json:"poll_id" dc:"投票 ID"`
	SentenceUUID string            `json:"sentence_uuid" dc:"句子 UUID"`
	Comment      string            `json:"comment" dc:"理由"`
	UserID       uint              `json:"user_id" dc:"用户 ID"`
	IsAdmin      bool              `json:"is_admin" dc:"是否为管理员"`
	Marks        []int             `json:"marks" dc:"标记"`
}

type PollListCommentElement

type PollListCommentElement struct {
	UserID    uint       `json:"user_id" dc:"用户 ID"`
	Comment   string     `json:"comment" dc:"评论"`
	CreatedAt *time.Time `json:"created_at" dc:"评论时间"`
	UpdatedAt *time.Time `json:"updated_at" dc:"更新时间"`
}

type PollListElement

type PollListElement struct {
	PollElement
	Marks      []int        `json:"marks" dc:"标记"`
	PolledData *PolledData  `json:"polled_data" dc:"投票数据"`
	Records    []PollRecord `json:"records" dc:"评论列表"`
}

type PollLogWithSentence

type PollLogWithSentence struct {
	entity.PollLog
	Sentence *HitokotoV1WithPoll // Nullable
}

type PollMark

type PollMark struct {
	ID           uint                    `json:"id" dc:"标记 ID"`
	Text         string                  `json:"text" dc:"标记文本"`
	Level        consts.PollMarkLevel    `json:"level" dc:"标记等级"`
	Property     consts.PollMarkProperty `json:"property" dc:"标记属性"`
	DeprecatedAt *time.Time              `json:"deprecated_at" dc:"废弃时间"`
	UpdatedAt    *time.Time              `json:"updated_at" dc:"更新时间"`
	CreatedAt    *time.Time              `json:"created_at" dc:"创建时间"`
}

type PollRecord

type PollRecord struct {
	User      *UserPublicInfo   `json:"user" dc:"用户"`
	Point     int               `json:"point" dc:"投票点数"`
	Method    consts.PollMethod `json:"method" dc:"投票类型"`
	Comment   string            `json:"comment" dc:"理由"`
	CreatedAt *time.Time        `json:"created_at" dc:"投票时间"`
	UpdatedAt *time.Time        `json:"updated_at" dc:"更新时间"`
}

type PolledData

type PolledData struct {
	Point     int               `json:"point" dc:"投票点数"`
	Method    consts.PollMethod `json:"method" dc:"投票方式"`
	CreatedAt *time.Time        `json:"created_at" dc:"投票时间"`
	UpdatedAt *time.Time        `json:"updated_at" dc:"更新时间"`
}

type UserCtxSchema

type UserCtxSchema struct {
	entity.Users
	Status consts.UserStatus `json:"status" dc:"用户状态"`
	Role   consts.UserRole   `json:"role" dc:"用户角色"`
	Poll   entity.PollUsers  `json:"poll" dc:"用户投票信息"`
}

UserCtxSchema 用户上下文模型,存储在 bizctx 中

type UserPoll

type UserPoll struct {
	Points       UserPollPoints `json:"points" dc:"投票点数"`
	Count        int            `json:"count" dc:"投票次数"`
	Score        int            `json:"score" dc:"积分"`
	AdoptionRate float64        `json:"adoption_rate" dc:"采纳率"`
	CreatedAt    *time.Time     `json:"created_at" dc:"创建时间"`
	UpdatedAt    *time.Time     `json:"updated_at" dc:"更新时间"`
}

type UserPollElement

type UserPollElement struct {
	UserPollLogWithSentenceAndUserMarks
	PollInfo  *PollElement `json:"poll_info" dc:"投票信息"`
	PollMarks []int        `json:"poll_marks" dc:"投票标记"`
}

type UserPollLog

type UserPollLog struct {
	PollID       uint              `json:"poll_id" dc:"投票 ID"`
	Point        int               `json:"point" dc:"投票点数"`
	SentenceUUID string            `json:"sentence_uuid" dc:"句子 UUID"`
	Method       consts.PollMethod `json:"type" dc:"投票类型"`
	Comment      string            `json:"comment" dc:"理由"`
	CreatedAt    *time.Time        `json:"created_at" dc:"投票时间"`
	UpdatedAt    *time.Time        `json:"updated_at" dc:"更新时间"`
}

type UserPollLogWithSentenceAndUserMarks

type UserPollLogWithSentenceAndUserMarks struct {
	UserPollLog
	Sentence  *HitokotoV1WithPoll `json:"sentence" dc:"句子信息"`
	UserMarks []int               `json:"user_marks" dc:"用户投票标记"`
}

type UserPollPoints

type UserPollPoints struct {
	Total      int `json:"total" dc:"总投票点数"`
	Approve    int `json:"approved" dc:"赞成票"`
	Reject     int `json:"rejected" dc:"反对票"`
	NeedModify int `json:"need_modify" dc:"需修改票"`
}

type UserPollResult

type UserPollResult struct {
	Total uint `json:"total" dc:"总数"`
	GetUserPollLogsWithPollResultOutput
}

type UserPollScoreInput

type UserPollScoreInput struct {
	UserID       uint
	PollID       uint
	Score        int
	SentenceUUID string
	Reason       string
	Tx           gdb.TX
}

type UserPublicInfo

type UserPublicInfo struct {
	ID        uint   `json:"id" dc:"用户 ID"`
	Name      string `json:"name" dc:"用户名"`
	EmailHash string `json:"email_hash" dc:"邮箱哈希"`
}

UserPublicInfo 用户公开信息

type UserScoreRecord

type UserScoreRecord struct {
	ID           uint                 `json:"id" dc:"ID"`
	PollID       uint                 `json:"poll_id" dc:"投票 ID"`
	UserID       uint                 `json:"user_id" dc:"用户 ID"`
	SentenceUUID string               `json:"sentence_uuid" dc:"句子 UUID"`
	Score        int                  `json:"score" dc:"积分"`
	Type         consts.UserScoreType `json:"type" dc:"类型"`
	Reason       string               `json:"reason" dc:"原因"`
	UpdatedAt    *time.Time           `json:"updated_at" dc:"更新时间"`
	CreatedAt    *time.Time           `json:"created_at" dc:"创建时间"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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