weekly

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: May 5, 2019 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 ListPager

type ListPager struct {
	Size   int `json:"size" valid:"required"`
	Offset int `json:"offset" valid:"required"`
}

func (*ListPager) Sql

func (this *ListPager) Sql() string

type ListParam

type ListParam struct {
	Uid     string     `json:"uid"`
	GroupId int        `json:"group_id"`
	Pager   *ListPager `json:"pager" valid:"required"`
	Sort    *ListSort  `json:"sort" valid:"required"` // weekly_report.id,work_group_id
}

查询周报参数

type ListSort

type ListSort []*SortField

func (*ListSort) Check

func (this *ListSort) Check(fields []string) bool

func (*ListSort) Sql

func (this *ListSort) Sql() string

type Report

type Report struct {
	Id      int             `json:"id"`
	Uid     string          `json:"uid"`
	Name    string          `json:"name,omitempty" db:"-"`   // staff name
	Avatar  string          `json:"avatar,omitempty" db:"-"` // staff name
	Year    int             `json:"year" db:"iso_year"`
	Week    int             `json:"week" db:"iso_week"`
	Status  Status          `json:"status"` // 0代表正常,1代表休假
	Content json.RawMessage `json:"content"`
	UpCount int             `json:"upCount" db:"up_count"`
	Created time.Time       `db:"created" json:"created"`
	Updated time.Time       `db:"updated" json:"updated,omitempty"`
}

type ReportStat

type ReportStat struct {
	Id      int       `json:"id,omitempty"`
	Uid     string    `json:"uid,omitempty"`
	Year    int       `json:"year" db:"iso_year"`
	Week    int       `json:"week" db:"iso_week"`
	Status  Status    `json:"status"` //0正常,1休假,2表示忽略该用户所有或特定周报
	Created time.Time `db:"created,omitempty" json:"created"`
}

type ReportStatParam

type ReportStatParam struct {
	Start string `json:"start"`
	End   string `json:"end"`
}

周报统计参数

type ReportStatResponse

type ReportStatResponse struct {
	Commited []*ReportStat `json:"commited"`
	All      []*ReportUser `json:"all"`
	Ignores  []*ReportUser `json:"ignores"`
}

周报统计返回数据

type ReportUser

type ReportUser struct {
	Id      int       `json:"id,omitempty"`
	Uid     string    `json:"uid"`
	Name    string    `json:"name"`
	Created time.Time `json:"created"`
}

type ReportWithProblem

type ReportWithProblem struct {
	Id   int `json:"id"`
	Year int `json:"year" db:"iso_year"`
	Week int `json:"week" db:"iso_week"`
	// Status    int64  `json:"status"` // 0代表正常,1代表休假
	Content   string    `json:"content"`
	ProblemId int       `json:"problem_id"`
	Problem   string    `json:"problem"`
	Created   time.Time `db:"created" json:"created"`
	Updated   time.Time `db:"updated,nullempty" json:"updated,omitempty"`
}

type SortField

type SortField struct {
	Field   string `json:"field" valid:"/^[a-z_\.]+$/"`
	Reverse bool   `json:"reverse" valid:"required"`
}

type Status

type Status int
const (
	WRNormal Status = iota
	WRVacation
	WRIgnore
)

type Team

type Team struct {
	ID        int64           `json:"id"`
	Name      string          `json:"name"`
	Leader    string          `json:"leader"`
	Members   json.RawMessage `json:"members"`
	Created   time.Time       `json:"created,omitempty" db:"created"`
	Updated   time.Time       `json:"updated,omitempty" db:"updated,omitempty"`
	StaffUID  string          `json:"staff_uid,omitempty" db:"staff_uid"`
	StaffName string          `json:"staff_name,omitempty" db:"-"`
}

Team work group

type TeamOpParam

type TeamOpParam struct {
	Op     TeamOpType `json:"op" binding:"required" valid:"[1:2]"`
	TeamID int        `json:"group_id" binding:"required" valid:"required"`
	UIDs   []string   `json:"staff_uids" binding:"required" valid:"required"`
}

type TeamOpType

type TeamOpType int
const (
	TeamOpAdd    TeamOpType = 1 + iota // add
	TeamOpRemove                       // remove
)

type TeamRoleType

type TeamRoleType int
const (
	RoleNothing TeamRoleType = iota
	RoleMember
	RoleManager
)

type TeamStore

type TeamStore interface {
	// Get 取一个
	Get(id int) (*Team, error)
	// All 查询全部数据
	All(role TeamRoleType) (data []*Team, err error)
	// Store 保存
	Store(id int, name, leader string, members []string) error
	// Add members
	AddMember(id int, uids ...string) error
	// Remove members
	RemoveMember(id int, uids ...string) error
	// Delete 删除 Team
	Delete(id int) error
	// Add Manager
	AddManager(id int, uid string) error
	// Remove Manager
	RemoveManager(id int, uid string) error
}

TeamStore interface of team storage

type WeeklyStore

type WeeklyStore interface {
	// Get
	Get(id int) (*Report, error)
	// 查询
	All(param ListParam) (data []*Report, total int, err error)
	// 添加
	Add(uid string, content string) error
	// 更新
	Update(id int, content string) error
	// 赞
	Applaud(id int, uid string) error
	// 统计
	Stat(start, end time.Time) (stat *ReportStatResponse, err error)
	// AllStatus
	StatusRecords(status Status) (data []*ReportUser, err error)
	// AddStatus
	AddStatus(uid string, status Status, year int, weeks ...int) error
	// RemoveStatus
	RemoveStatus(ids ...int) error
	// StatusRecordsWithUser
	StatusRecordsWithUser(status Status, uid string) (data []*ReportStat, err error)
}

Jump to

Keyboard shortcuts

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