Added devices and companies models
This commit is contained in:
11
main.go
11
main.go
@@ -26,13 +26,22 @@ func main() {
|
||||
}
|
||||
|
||||
// Db Connect and Close
|
||||
shared.Init()
|
||||
if shared.Init() != nil {
|
||||
panic("Failed to connect to database")
|
||||
}
|
||||
defer shared.CloseDb()
|
||||
|
||||
// Initialize Admin interface
|
||||
Admin := admin.New(&admin.AdminConfig{DB: shared.GetDb()})
|
||||
fmt.Printf("Admin instance: %+v\n", Admin)
|
||||
// Allow Admin to manage User resource
|
||||
company := Admin.AddResource(&models.Company{})
|
||||
company.Meta(&admin.Meta{Name: "Users", Config: &admin.SelectManyConfig{SelectMode: "bottom_sheet"}})
|
||||
company.Meta(&admin.Meta{Name: "Devices", Config: &admin.SelectManyConfig{SelectMode: "bottom_sheet"}})
|
||||
|
||||
// Add User and Device resources
|
||||
Admin.AddResource(&models.User{})
|
||||
Admin.AddResource(&models.Device{})
|
||||
// Initialize HTTP request multiplexer
|
||||
mux := http.NewServeMux()
|
||||
// Mount admin interface to mux
|
||||
|
||||
Reference in New Issue
Block a user