adding dboverview route, fixing add new location and add new room

This commit is contained in:
2022-04-09 22:27:26 -04:00
parent 25deaf43c8
commit c79dc69bb0
10 changed files with 274 additions and 53 deletions

View File

@@ -38,7 +38,7 @@ type Room struct {
// Cabinet is a containerized area in a room
type Cabinet struct {
ID int `storm:"id, increment"`
ID int `storm:"id,increment,index"`
RoomID int // Room ID that the cabinet is assigned to
RoomName string // Room name cabinet belongs to
CoverPhoto string // A "Cover photo" for this item
@@ -49,7 +49,7 @@ type Cabinet struct {
// Item is contained inside a room or cabinet
type Item struct {
ID int `storm:"id, increment"`
ID int `storm:"id,increment,index"`
LocType string // Can be Room or Cabinet to show where it is stored
RoomID int // Room ID that item is assigned to (can also be in a cabinet)
RoomName string // Room name that item is assigned to
@@ -66,3 +66,15 @@ type Item struct {
DatePurchased string
Files []string //filepath to any files relevant to this item
}
// DatabaseOverview provides some details about the database
type DatabaseOverview struct {
NumLocations int
LastAddedLocation *Location
NumRooms int
LastAddedRoom *Room
NumCabinets int
LastAddedCabinet *Cabinet
NumItems int
LastAddedItem *Item
}