Added devices and companies models
This commit is contained in:
33
models/company.go
Normal file
33
models/company.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package models
|
||||
|
||||
import "github.com/jinzhu/gorm"
|
||||
|
||||
type Company struct {
|
||||
gorm.Model
|
||||
Name string
|
||||
Password string
|
||||
Email string
|
||||
Avatar string
|
||||
Users []User
|
||||
Devices []Device
|
||||
}
|
||||
|
||||
|
||||
// func FetchCompanies(companies *[]Company) (err error) {
|
||||
// db := gorm.GetDb()
|
||||
|
||||
// if err = db.Find(companies).Error; err != nil {
|
||||
// return err
|
||||
// }
|
||||
// return nil
|
||||
// }
|
||||
|
||||
func (Company)Update() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
func (Company)Create() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
func (Company)Delete() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
@@ -1,7 +1,3 @@
|
||||
/**
|
||||
* Created by VoidArtanis on 10/24/2017
|
||||
*/
|
||||
|
||||
package models
|
||||
|
||||
type SimpleCRUD interface {
|
||||
|
||||
20
models/device.go
Normal file
20
models/device.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package models
|
||||
|
||||
import "github.com/jinzhu/gorm"
|
||||
|
||||
type Device struct {
|
||||
gorm.Model
|
||||
DeviceName string
|
||||
DeviceConfiguration string `gorm:"type:json"`
|
||||
CompanyID uint
|
||||
}
|
||||
|
||||
func (Device)Update() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
func (Device)Create() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
func (Device)Delete() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
@@ -1,7 +1,3 @@
|
||||
/**
|
||||
* Created by desha on 10/24/2017
|
||||
*/
|
||||
|
||||
package models
|
||||
|
||||
import "github.com/jinzhu/gorm"
|
||||
@@ -12,14 +8,15 @@ type User struct {
|
||||
Password string
|
||||
Email string
|
||||
Avatar string
|
||||
CompanyID uint
|
||||
}
|
||||
|
||||
func (this User)Update() (bool, error) {
|
||||
func (User)Update() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
func (this User)Create() (bool, error) {
|
||||
func (User)Create() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
func (this User)Delete() (bool, error) {
|
||||
func (User)Delete() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user