feat: better API returns, asset update
This commit is contained in:
@@ -26,6 +26,11 @@ type IndexResponse struct {
|
||||
Version APIVersion `json:"version"`
|
||||
}
|
||||
|
||||
type CountResponse struct {
|
||||
*Response
|
||||
Count int64 `json:"count"`
|
||||
}
|
||||
|
||||
type APIError struct {
|
||||
*Response
|
||||
Err error `json:"-"`
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
type Building struct {
|
||||
ID uint64 `gorm:"primarykey" json:"id"`
|
||||
Name string `json:"name"`
|
||||
ShelfLocations []ShelfLocation `json:"shelves"`
|
||||
ShelfLocations []ShelfLocation `json:"shelves,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at,omitempty"`
|
||||
|
||||
@@ -17,7 +17,7 @@ type ShelfLocation struct {
|
||||
RoomNumber string `json:"room_number,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
BuildingID uint64 `json:"-"`
|
||||
Building Building `json:"building"`
|
||||
Building Building `json:"building",omitempty`
|
||||
Assets []Asset `json:"assets,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
|
||||
Reference in New Issue
Block a user