19 lines
354 B
Go
19 lines
354 B
Go
package db
|
|
|
|
import (
|
|
uuid "github.com/satori/go.uuid"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type Machine struct {
|
|
Base
|
|
Name string `json:"name" form:"name"`
|
|
Slug string `json:"slug" form:"slug"`
|
|
Tokens []*Token `json:"tokens" gorm:"many2many:token_machines;"`
|
|
}
|
|
|
|
func (m *Machine) BeforeCreate(_ *gorm.DB) error {
|
|
id := uuid.NewV4()
|
|
m.ID = &id
|
|
return nil
|
|
}
|