Loggest thine Stuff
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.
 
 
 
 
 
 

57 lines
1.5 KiB

package entities
import (
"git.aiterp.net/stufflog3/stufflog3/models"
"time"
)
type Item struct {
ID int `json:"id"`
ScopeID int `json:"scopeId"`
OwnerID string `json:"ownerId"`
ProjectID *int `json:"projectId,omitempty"`
ProjectRequirementID *int `json:"projectRequirementId,omitempty"`
Name string `json:"name"`
Description string `json:"description"`
CreatedTime time.Time `json:"createdTime"`
AcquiredTime *time.Time `json:"acquiredTime"`
ScheduledDate *models.Date `json:"scheduledDate"`
}
type ItemProgress struct {
ItemID int `json:"itemId"`
StatID int `json:"statId"`
Acquired int `json:"acquired"`
Required int `json:"required"`
}
func (item *Item) ApplyUpdate(update models.ItemUpdate) {
if update.ProjectRequirementID != nil {
if *update.ProjectRequirementID <= 0 {
item.ProjectRequirementID = nil
} else {
item.ProjectRequirementID = update.ProjectRequirementID
}
}
if update.OwnerID != nil {
item.OwnerID = *update.OwnerID
}
if update.Name != nil {
item.Name = *update.Name
}
if update.Description != nil {
item.Description = *update.Description
}
if update.AcquiredTime != nil {
item.AcquiredTime = update.AcquiredTime
}
if update.ScheduledDate != nil {
item.ScheduledDate = update.ScheduledDate
}
if update.ClearScheduledDate {
item.ScheduledDate = nil
}
if update.ClearAcquiredTime {
item.AcquiredTime = nil
}
}