mirror of
https://github.com/hay-kot/homebox.git
synced 2025-08-05 09:10:26 +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"`
|
UpdatedAt time.Time `json:"updatedAt"`
|
||||||
|
|
||||||
// Edges
|
// Edges
|
||||||
Location LocationSummary `json:"location"`
|
Location *LocationSummary `json:"location,omitempty" extensions:"x-nullable,x-omitempty"`
|
||||||
Labels []LabelSummary `json:"labels"`
|
Labels []LabelSummary `json:"labels"`
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemOut struct {
|
ItemOut struct {
|
||||||
|
@ -139,12 +139,13 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func mapItemSummary(item *ent.Item) ItemSummary {
|
func mapItemSummary(item *ent.Item) ItemSummary {
|
||||||
var location LocationSummary
|
var location *LocationSummary
|
||||||
if item.Edges.Location != nil {
|
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 {
|
if item.Edges.Label != nil {
|
||||||
labels = mapEach(item.Edges.Label, mapLabelSummary)
|
labels = mapEach(item.Edges.Label, mapLabelSummary)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue