63 lines
1.6 KiB
Go
63 lines
1.6 KiB
Go
package entities
|
|
|
|
import (
|
|
"git.aiterp.net/stufflog3/stufflog3/models"
|
|
"time"
|
|
)
|
|
|
|
type Project struct {
|
|
ID int `json:"id"`
|
|
ScopeID int `json:"scopeId"`
|
|
OwnerID string `json:"ownerId"`
|
|
CreatedTime time.Time `json:"createdTime"`
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
Status models.Status `json:"status"`
|
|
}
|
|
|
|
func (project *Project) Update(update models.ProjectUpdate) {
|
|
if update.OwnerID != nil {
|
|
project.OwnerID = *update.OwnerID
|
|
}
|
|
if update.Name != nil {
|
|
project.Name = *update.Name
|
|
}
|
|
if update.Description != nil {
|
|
project.Description = *update.Description
|
|
}
|
|
if update.Status != nil {
|
|
project.Status = *update.Status
|
|
}
|
|
}
|
|
|
|
type Requirement struct {
|
|
ID int `json:"id"`
|
|
ScopeID int `json:"scopeId"`
|
|
ProjectID int `json:"projectId"`
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
IsCoarse bool `json:"isCoarse"`
|
|
Status models.Status `json:"status"`
|
|
}
|
|
|
|
func (requirement *Requirement) Update(update models.RequirementUpdate) {
|
|
if update.Name != nil && *update.Name != "" {
|
|
requirement.Name = *update.Name
|
|
}
|
|
if update.Description != nil {
|
|
requirement.Description = *update.Description
|
|
}
|
|
if update.Status != nil && update.Status.Valid() {
|
|
requirement.Status = *update.Status
|
|
}
|
|
if update.IsCoarse != nil {
|
|
requirement.IsCoarse = *update.IsCoarse
|
|
}
|
|
}
|
|
|
|
type RequirementStat struct {
|
|
RequirementID int `json:"requirementId"`
|
|
StatID int `json:"statId"`
|
|
Required int `json:"required"`
|
|
}
|