-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a8ecdc
commit 6273199
Showing
41 changed files
with
7,413 additions
and
130 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package types | ||
|
||
import ( | ||
"time" | ||
"github.com/lib/pq" | ||
) | ||
|
||
|
||
type User struct { | ||
ID string `json:"id" gorm:"primaryKey"` | ||
Username string `json:"username" gorm:"uniqueIndex"` | ||
Password string `json:"password"` | ||
FirstName string `json:"first" gorm:"index"` | ||
LastName string `json:"last" gorm:"index"` | ||
Grade string `json:"grade" gorm:"index"` | ||
Code string `json:"code" gorm:"uniqueIndex"` | ||
Machines []*Machine `gorm:"many2many:users_machines"` | ||
CreatedAt time.Time `json:"-" gorm:"index"` | ||
UpdatedAt time.Time `json:"-" gorm:"index"` | ||
} | ||
|
||
type Admin struct { | ||
ID string `json:"id" gorm:"primaryKey"` | ||
Username string `json:"username" gorm:"uniqueIndex"` | ||
Password string `json:"password"` | ||
FirstName string `json:"first" gorm:"index"` | ||
LastName string `json:"last" gorm:"index"` | ||
Code string `json:"code" gorm:"uniqueIndex"` | ||
CreatedAt time.Time `json:"-" gorm:"index"` | ||
UpdatedAt time.Time `json:"-" gorm:"index"` | ||
} | ||
|
||
type Machine struct { | ||
ID string `json:"id" gorm:"primaryKey"` | ||
InUSE bool `json:"in_use" gorm:"index"` | ||
Users []*User `gorm:"many2many:users_machines"` | ||
Actions pq.StringArray `json:"actions" gorm:"type:text[]"` | ||
CreatedAt time.Time `json:"-" gorm:"index"` | ||
UpdatedAt time.Time `json:"-" gorm:"index"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.