| package types | |
| 
 | |
| import ( | |
| 	"net/http" | |
| 	"time" | |
| 
 | |
| 	"gorm.io/gorm" | |
| ) | |
| 
 | |
| /* | |
| 	Base Model | |
| */ | |
| 
 | |
| type Asset struct { | |
| 	ID              uint64         `gorm:"primarykey" json:"id"` | |
| 	Name            string         `json:"name"` | |
| 	Quantity        int            `json:"quantity"` | |
| 	Length          string         `json:"length,omitempty"` | |
| 	Manufacturer    string         `json:"manufacturer,omitempty"` | |
| 	ModelName       string         `json:"model_name,omitempty"` | |
| 	Price           float64        `json:"price,omitempty"` | |
| 	Comments        string         `json:"comments,omitempty"` | |
| 	ShelfLocationID *uint64        `json:"-"` | |
| 	ShelfLocation   *ShelfLocation `json:"shelf_location,omitempty"` | |
| 	CategoryID      *uint64        `json:"-"` | |
| 	Category        *Category      `json:"category,omitempty"` | |
| 	CreatedAt       time.Time      `json:"created_at"` | |
| 	UpdatedAt       time.Time      `json:"updated_at"` | |
| 	DeletedAt       gorm.DeletedAt `gorm:"index" json:"deleted_at,omitempty"` | |
| } | |
| 
 | |
| /* | |
| 	Requests | |
| */ | |
| 
 | |
| type CreateAssetRequest struct { | |
| 	Name            string  `json:"name"` | |
| 	Quantity        int     `json:"quantity"` | |
| 	Length          string  `json:"length,omitempty"` | |
| 	Manufacturer    string  `json:"manufacturer,omitempty"` | |
| 	ModelName       string  `json:"model_name,omitempty"` | |
| 	Price           float64 `json:"price,omitempty"` | |
| 	Comments        string  `json:"comments,omitempty"` | |
| 	ShelfLocationID *uint64 `json:"shelf_location_id,omitempty"` | |
| 	CategoryID      *uint64 `json:"category_id,omitempty"` | |
| } | |
| 
 | |
| func (c CreateAssetRequest) Bind(r *http.Request) error { return nil } | |
| 
 | |
| /* | |
| 	Responses | |
| */ | |
| 
 | |
| type AssetResponse struct { | |
| 	*Response | |
| 	Asset *Asset `json:"asset"` | |
| } | |
| 
 | |
| type MultipleAssetsResponse struct { | |
| 	*Response | |
| 	Assets []*Asset `json:"assets"` | |
| 	Total  int64    `json:"total"` | |
| }
 |