mirror of
https://github.com/hay-kot/homebox.git
synced 2025-08-03 08:10:28 +00:00
update nil value returns
This commit is contained in:
parent
d41ce08400
commit
9b9141cb7c
1 changed files with 6 additions and 5 deletions
|
@ -97,8 +97,8 @@ type (
|
|||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
|
||||
// Edges
|
||||
Location LocationSummary `json:"location"`
|
||||
Labels []LabelSummary `json:"labels"`
|
||||
Location *LocationSummary `json:"location,omitempty" extensions:"x-nullable,x-omitempty"`
|
||||
Labels []LabelSummary `json:"labels"`
|
||||
}
|
||||
|
||||
ItemOut struct {
|
||||
|
@ -139,12 +139,13 @@ var (
|
|||
)
|
||||
|
||||
func mapItemSummary(item *ent.Item) ItemSummary {
|
||||
var location LocationSummary
|
||||
var location *LocationSummary
|
||||
if item.Edges.Location != nil {
|
||||
location = mapLocationSummary(item.Edges.Location)
|
||||
loc := mapLocationSummary(item.Edges.Location)
|
||||
location = &loc
|
||||
}
|
||||
|
||||
var labels []LabelSummary
|
||||
labels := make([]LabelSummary, len(item.Edges.Label))
|
||||
if item.Edges.Label != nil {
|
||||
labels = mapEach(item.Edges.Label, mapLabelSummary)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue