Add models

This commit is contained in:
Jannis Mattheis 2018-01-19 22:08:44 +01:00 committed by Jannis Mattheis
parent 55b1508fd7
commit d76ab85396
3 changed files with 30 additions and 0 deletions

9
model/message.go Normal file
View File

@ -0,0 +1,9 @@
package model
type Message struct {
ID uint `gorm:"primary_key" gorm:"AUTO_INCREMENT;primary_key;index"`
TokenID string
Message string
Title string
Priority int
}

12
model/token.go Normal file
View File

@ -0,0 +1,12 @@
package model
type Token struct {
Name string
DefaultTitle string
Description string
Icon string
WriteOnly bool
UserID uint `gorm:"index"`
Id string `gorm:"primary_key;unique_index"`
Messages []Message
}

9
model/user.go Normal file
View File

@ -0,0 +1,9 @@
package model
type User struct {
ID uint `gorm:"primary_key;unique_index" gorm:"AUTO_INCREMENT"`
Name string
Pass []byte
Admin bool
Tokens []Token
}