Update new storage types and regenerate
This commit is contained in:
parent
0932f19f71
commit
41e432b56e
28 changed files with 6561 additions and 23 deletions
22
storage-new/models/TokenAccess.go
Normal file
22
storage-new/models/TokenAccess.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gen"
|
||||
)
|
||||
|
||||
type AccessToken struct {
|
||||
User User
|
||||
UserId string
|
||||
Token string `gorm:"primarykey;type:uuid;default:gen_random_uuid()"`
|
||||
Name string // Token name will be empty if autogenerated with sucessful login
|
||||
// Every token expires, even if set to "not expire". If set to "not expire", it just expires
|
||||
// at a point in the future this server should never reach
|
||||
ExpiresAt time.Time `gorm:"default:TIMESTAMP WITH TIME ZONE '9999-12-30 23:59:59+00'"`
|
||||
}
|
||||
|
||||
type IAccessToken interface {
|
||||
// INSERT INTO @@table (user_id, token, name, {{if expiresAt != nil}}, )
|
||||
NewToken(user *User, name string, expiresAt *time.Time) (gen.T, error)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue