domain

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_TIME_FORMAT = "15:04"
View Source
const DEFAULT_TOLERANCE = 30

Variables

View Source
var CronScheduledMap map[string]cron.EntryID

Functions

This section is empty.

Types

type BaseResponse

type BaseResponse struct {
	Code   int    `json:"code"`
	Url    string `json:"url"`
	Method string `json:"method"`
}

type DayOff

type DayOff struct {
	ID        string         `gorm:"primaryKey;type:varchar(100)" json:"-"`
	UserID    string         `gorm:"type:varchar(100);not null" json:"user_id"`
	Year      int            `json:"year"`
	Month     int            `json:"month"`
	Date      int            `json:"date"`
	CreatedAt time.Time      `json:"-"`
	UpdatedAt time.Time      `json:"-"`
	DeletedAt gorm.DeletedAt `json:"-"`
}

func (*DayOff) BeforeCreate

func (d *DayOff) BeforeCreate(_ *gorm.DB) (err error)

BeforeCreate will set snowflake id rather than numeric id.

type Expression added in v1.1.2

type Expression struct {
	PunchIn  string `json:"punch_in"`
	PunchOut string `json:"punch_out"`
}

type LoginRequest

type LoginRequest struct {
	Account  string `json:"account"`
	Password string `json:"password"`
}

type LoginResponse

type LoginResponse struct {
	BaseResponse
	Result LoginResult `json:"result"`
}

type LoginResult

type LoginResult struct {
	UserID       string `json:"userId"`
	Account      string `json:"account"`
	UserName     string `json:"userName"`
	Role         string `json:"role"`
	Avatar       string `json:"avatar"`
	OrganizeID   string `json:"organizeId"`
	OrganizeName string `json:"organizeName"`
	AccessToken  string `json:"accessToken"`
}

type PunchResponse

type PunchResponse struct {
	BaseResponse
	Result PunchResult `json:"result"`
}

type PunchResult

type PunchResult struct {
	IsSuccess bool   `json:"isSuccess"`
	ErrorType string `json:"errorType"`
	UserName  string `json:"userName"`
	Avatar    string `json:"avatar"`
}

type PunchUsecase

type PunchUsecase interface {
	Punch(discordUserID string) error
}

type Schedule added in v1.1.2

type Schedule struct {
	ID        string         `gorm:"primaryKey;type:varchar(100)" json:"-"`
	PunchIn   string         `gorm:"embedded" json:"punch_in"`
	PunchOut  string         `gorm:"embedded" json:"punch_out"`
	CreatedAt time.Time      `json:"-"`
	UpdatedAt time.Time      `json:"-"`
	DeletedAt gorm.DeletedAt `json:"-"`

	// belongs to user
	UserID string `gorm:"type:varchar(100);not null" json:"user_id"`
	User   User   `json:"-"`
}

func (*Schedule) BeforeCreate added in v1.1.2

func (s *Schedule) BeforeCreate(_ *gorm.DB) (err error)

BeforeCreate will set snowflake id rather than numeric id.

func (*Schedule) GetCronEntry added in v1.1.2

func (s *Schedule) GetCronEntry(punchType enums.PunchType) cron.EntryID

func (*Schedule) GetCronEntryKey added in v1.1.2

func (s *Schedule) GetCronEntryKey(punchType enums.PunchType) string

func (*Schedule) GetCronExpression added in v1.1.2

func (s *Schedule) GetCronExpression() Expression

type User

type User struct {
	ID            string         `gorm:"primaryKey;type:varchar(100)" json:"-"`
	Name          string         `gorm:"type:varchar(100)" json:"name"`
	Account       string         `gorm:"type:varchat(100);not null" json:"account"`
	Password      string         `gorm:"type:varchar(255);not null" json:"password"`
	DiscordUserID string         `gorm:"type:varchar(255);not null" json:"discord_user_id"`
	IsEnable      bool           `gorm:"index" json:"-"`
	Role          enums.RoleType `gorm:"type:int" json:"role"`
	CreatedAt     time.Time      `json:"-"`
	UpdatedAt     time.Time      `json:"-"`
	DeletedAt     gorm.DeletedAt `json:"-"`
}

func (*User) BeforeCreate

func (u *User) BeforeCreate(_ *gorm.DB) (err error)

BeforeCreate will set snowflake id rather than numeric id.

Jump to

Keyboard shortcuts

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