service backend
This commit is contained in:
61
api/pkg/model/project.go
Normal file
61
api/pkg/model/project.go
Normal file
@@ -0,0 +1,61 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/tech/sendico/pkg/mservice"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
type ProjectState string
|
||||
|
||||
const (
|
||||
ProjectStateActive ProjectState = "active"
|
||||
ProjectStateHold ProjectState = "hold"
|
||||
ProjectStateBlocked ProjectState = "blocked"
|
||||
)
|
||||
|
||||
type ProjectBase struct {
|
||||
PermissionBound `bson:",inline" json:",inline"`
|
||||
Describable `bson:",inline" json:",inline"`
|
||||
Indexable `bson:",inline" json:",inline"`
|
||||
Taggable `bson:",inline" json:",inline"`
|
||||
LogoURL *string `bson:"logoUrl" json:"logoUrl"`
|
||||
Mnemonic string `bson:"mnemonic" json:"mnemonic"`
|
||||
State ProjectState `bson:"state" json:"state"`
|
||||
PriorityGroupRef primitive.ObjectID `bson:"priorityGroupRef" json:"priorityGroupRef"`
|
||||
StatusGroupRef primitive.ObjectID `bson:"statusGroupRef" json:"statusGroupRef"`
|
||||
}
|
||||
|
||||
func (*ProjectBase) Collection() string {
|
||||
return mservice.Projects
|
||||
}
|
||||
|
||||
type Project struct {
|
||||
ProjectBase `bson:",inline" json:",inline"`
|
||||
NextTaskNumber int `bson:"nextTaskNumber" json:"nextTaskNumber"`
|
||||
}
|
||||
|
||||
type ProjectOverallStats struct {
|
||||
TotalTasks int `json:"totalTasks" bson:"totalTasks"`
|
||||
OpenTasks int `json:"openTasks" bson:"openTasks"`
|
||||
OverDue int `json:"overDue" bson:"overDue"`
|
||||
NextDeadline *time.Time `json:"nextDeadline,omitempty" bson:"nextDeadline,omitempty"`
|
||||
}
|
||||
|
||||
// ProjectPersonallStatsD represents personal task statistics for a project.
|
||||
type ProjectPersonallStatsD struct {
|
||||
FreeTasks int `json:"freeTasks" bson:"freeTasks"`
|
||||
CompleteTasks int `json:"completeTasks" bson:"completeTasks"`
|
||||
MyTasks int `json:"myTasks" bson:"myTasks"`
|
||||
OverDue int `json:"overDue" bson:"overDue"`
|
||||
NextDeadline *time.Time `json:"nextDeadline,omitempty" bson:"nextDeadline,omitempty"`
|
||||
}
|
||||
|
||||
// ProjectPreview represents a preview of project information.
|
||||
type ProjectPreview struct {
|
||||
ProjectRef primitive.ObjectID `json:"projectRef" bson:"projectRef"`
|
||||
Team []primitive.ObjectID `json:"team" bson:"team"`
|
||||
Overall ProjectOverallStats `json:"overall" bson:"overall"`
|
||||
Personal ProjectPersonallStatsD `json:"personal" bson:"personal"`
|
||||
}
|
||||
Reference in New Issue
Block a user