package types
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
/*
|
|
Base Model
|
|
*/
|
|
|
|
type ShelfLocation struct {
|
|
ID uint64 `gorm:"primarykey" json:"id"`
|
|
Name string `gorm:"index:unique" json:"name"`
|
|
RoomNumber string `json:"room_number,omitempty"`
|
|
Description string `json:"description,omitempty"`
|
|
BuildingID uint64 `json:"building_id"`
|
|
Building Building `json:"building,omitempty"`
|
|
Assets []Asset `json:"assets,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at,omitempty"`
|
|
}
|
|
|
|
/*
|
|
Requests
|
|
*/
|
|
|
|
type CreateShelfRequest struct {
|
|
Name string `json:"name"`
|
|
RoomNumber string `json:"room_number,omitempty"`
|
|
Description string `json:"description,omitempty"`
|
|
BuildingID *uint64 `json:"building_id"`
|
|
}
|
|
|
|
func (c CreateShelfRequest) Bind(r *http.Request) error { return nil }
|
|
|
|
/*
|
|
Responses
|
|
*/
|
|
|
|
type ShelfResponse struct {
|
|
*Response
|
|
ShelfLocation *ShelfLocation `json:"shelf"`
|
|
}
|
|
|
|
type MultipleShelfResponse struct {
|
|
*Response
|
|
ShelfLocations []*ShelfLocation `json:"shelves"`
|
|
Total int64 `json:"total"`
|
|
}
|