2021-03-21 20:38:37 +00:00
|
|
|
package models
|
|
|
|
|
2021-04-11 21:46:06 +00:00
|
|
|
import (
|
|
|
|
"reflect"
|
|
|
|
"time"
|
|
|
|
)
|
2021-03-31 03:55:19 +00:00
|
|
|
|
2021-03-21 20:38:37 +00:00
|
|
|
const HMNProjectID = 1
|
|
|
|
|
2021-03-31 03:55:19 +00:00
|
|
|
var ProjectType = reflect.TypeOf(Project{})
|
|
|
|
|
2021-05-05 20:34:32 +00:00
|
|
|
type ProjectLifecycle int
|
|
|
|
|
|
|
|
const (
|
|
|
|
ProjectLifecycleUnapproved = iota
|
|
|
|
ProjectLifecycleApprovalRequired
|
|
|
|
ProjectLifecycleActive
|
|
|
|
ProjectLifecycleHiatus
|
|
|
|
ProjectLifecycleDead
|
|
|
|
ProjectLifecycleLTSRequired
|
|
|
|
ProjectLifecycleLTS
|
|
|
|
)
|
|
|
|
|
2021-03-21 20:38:37 +00:00
|
|
|
type Project struct {
|
|
|
|
ID int `db:"id"`
|
|
|
|
|
2021-03-31 03:55:19 +00:00
|
|
|
Slug *string `db:"slug"` // TODO: Migrate these to NOT NULL
|
|
|
|
Name *string `db:"name"`
|
|
|
|
Blurb *string `db:"blurb"`
|
|
|
|
Description *string `db:"description"`
|
2021-03-21 20:38:37 +00:00
|
|
|
|
2021-05-05 20:34:32 +00:00
|
|
|
Lifecycle ProjectLifecycle `db:"lifecycle"`
|
|
|
|
|
2021-03-21 20:38:37 +00:00
|
|
|
Color1 string `db:"color_1"`
|
|
|
|
Color2 string `db:"color_2"`
|
2021-04-11 21:46:06 +00:00
|
|
|
|
|
|
|
AllLastUpdated time.Time `db:"all_last_updated"`
|
2021-03-21 20:38:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *Project) IsHMN() bool {
|
|
|
|
return p.ID == HMNProjectID
|
|
|
|
}
|
2021-04-22 23:02:50 +00:00
|
|
|
|
|
|
|
func (p *Project) Subdomain() string {
|
|
|
|
if p.IsHMN() {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
return *p.Slug
|
|
|
|
}
|