models

package
v0.1.0-a Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAdmin

func CreateAdmin(username, password string) error

func CreateEmployee

func CreateEmployee(name, username, password string, superiorID *int) error

func CreateProject

func CreateProject(name, code string) error

func DeleteEmployee

func DeleteEmployee(id string) error

func DeleteProject

func DeleteProject(id string) error

func GetCurrentMonthTotalHours

func GetCurrentMonthTotalHours() (float64, error)

func GetEmployeeCount

func GetEmployeeCount() (int, error)

func GetProjectCount

func GetProjectCount() (int, error)

func InitDefaultAdmin

func InitDefaultAdmin(username, password string) error

func IsProjectCodeExist

func IsProjectCodeExist(code string) (bool, error)

func IsProjectNameExist

func IsProjectNameExist(name string) (bool, error)

func IsUsernameExist

func IsUsernameExist(username string) (bool, error)

添加这个新函数

func ResetEmployeePassword

func ResetEmployeePassword(id string, newPassword string) error

func SubmitTimesheet

func SubmitTimesheet(employeeID, projectID int, hours float64, month time.Time, description string) error

func UpdateAdminPassword

func UpdateAdminPassword(adminID int, newPassword string) error

func UpdateEmployee

func UpdateEmployee(id string, name, username string, superiorID *int) error

func UpdateEmployeePassword

func UpdateEmployeePassword(employeeID int, newPassword string) error

func UpdateProject

func UpdateProject(id, name, code string) error

func UpdateTimesheet

func UpdateTimesheet(id string, employeeID, projectID int, hours float64, month time.Time, description string) error

Types

type Admin

type Admin struct {
	ID       int
	Username string
	Password string
}

func GetAdminByUsername

func GetAdminByUsername(username string) (*Admin, error)

type Employee

type Employee struct {
	ID           int
	Name         string
	Username     string
	Password     string
	SuperiorID   sql.NullInt64
	SuperiorName sql.NullString
}

func GetAllEmployees

func GetAllEmployees() ([]Employee, error)

func GetEmployeeByID

func GetEmployeeByID(id int) (*Employee, error)

func GetEmployeeByUsername

func GetEmployeeByUsername(username string) (*Employee, error)

type MonthlyProjectHours

type MonthlyProjectHours struct {
	ProjectID   int
	ProjectName string
	Hours       float64
}

func GetEmployeeMonthlyHours

func GetEmployeeMonthlyHours(employeeID int, month time.Time) ([]MonthlyProjectHours, float64, error)

type Project

type Project struct {
	ID   int
	Name string
	Code string
}

func GetAllProjects

func GetAllProjects() ([]Project, error)

func GetProjectByID

func GetProjectByID(id int) (*Project, error)

type Timesheet

type Timesheet struct {
	ID          int
	EmployeeID  int
	ProjectID   int
	Hours       float64
	Month       time.Time // 修改为月份
	Description string
	SubmitDate  time.Time // 新增提交日期字段
}

func GetTimesheetsByDateRange

func GetTimesheetsByDateRange(start, end time.Time) ([]Timesheet, error)

func GetTimesheetsByEmployee

func GetTimesheetsByEmployee(employeeID int, limit int) ([]Timesheet, error)

func GetTimesheetsByMonth

func GetTimesheetsByMonth(month time.Time) ([]Timesheet, error)

GetTimesheetsByMonth 获取指定月份的所有工时记录

Jump to

Keyboard shortcuts

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