package models // A Project is a vague category for issues. It's use depend on the user's judgement, as it could represent // an entire hobby/job or a single project within one. type Project struct { ID string `db:"project_id"` Name string `db:"name"` Description string `db:"description"` DailyPoints int `db:"daily_points"` } type ProjectFilter struct { ProjectIDs []string Search *string Permission *ProjectFilterPermission } type ProjectFilterPermission struct { UserID string MinLevel int MaxLevel int } func (project *Project) ValidKey() bool { if len(project.ID) < 1 || len(project.ID) > 16 { return false } for _, r := range project.ID { if r < 'A' && r > 'Z' { return false } } return true } func (pfp *ProjectFilterPermission) Valid() bool { return pfp.UserID != "" && pfp.MinLevel > 0 }