You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.7 KiB
70 lines
1.7 KiB
package entities
|
|
|
|
import (
|
|
"git.aiterp.net/stufflog3/stufflog3/models"
|
|
"time"
|
|
)
|
|
|
|
type Sprint struct {
|
|
ID int `json:"id"`
|
|
ScopeID int `json:"scopeId"`
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
Kind models.SprintKind `json:"kind"`
|
|
|
|
Tags []string `json:"tags"`
|
|
|
|
FromTime time.Time `json:"fromTime"`
|
|
ToTime time.Time `json:"toTime"`
|
|
|
|
IsTimed bool `json:"isTimed"`
|
|
IsCoarse bool `json:"isCoarse"`
|
|
IsUnweighted bool `json:"isUnweighted"`
|
|
|
|
AggregateName string `json:"aggregateName"`
|
|
AggregateRequired int `json:"aggregateRequired"`
|
|
}
|
|
|
|
// SprintPart is not meant for the frontend, but it can be submitted.
|
|
type SprintPart struct {
|
|
SprintID int `json:"sprintId"`
|
|
PartID int `json:"partId"`
|
|
Required int `json:"required,omitempty"`
|
|
}
|
|
|
|
func (sprint *Sprint) ApplyUpdate(update models.SprintUpdate) {
|
|
if update.Name != nil {
|
|
sprint.Name = *update.Name
|
|
}
|
|
if update.Description != nil {
|
|
sprint.Description = *update.Description
|
|
}
|
|
if update.FromTime != nil {
|
|
sprint.FromTime = *update.FromTime
|
|
}
|
|
if update.ToTime != nil {
|
|
sprint.ToTime = *update.ToTime
|
|
}
|
|
if update.IsTimed != nil {
|
|
sprint.IsTimed = *update.IsTimed
|
|
}
|
|
if update.IsCoarse != nil {
|
|
sprint.IsCoarse = *update.IsCoarse
|
|
}
|
|
if update.IsUnweighted != nil {
|
|
sprint.IsUnweighted = *update.IsUnweighted
|
|
}
|
|
if update.AggregateName != nil {
|
|
sprint.AggregateName = *update.AggregateName
|
|
}
|
|
if update.AggregateRequired != nil {
|
|
sprint.AggregateRequired = *update.AggregateRequired
|
|
}
|
|
if update.Tags != nil {
|
|
if len(update.Tags) == 0 {
|
|
sprint.Tags = nil
|
|
} else {
|
|
sprint.Tags = update.Tags
|
|
}
|
|
}
|
|
}
|