22 lines
783 B
Plaintext
22 lines
783 B
Plaintext
package model
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// AccessToken represents a personal API access token.
|
|
// Reference: Chatwoot AccessToken model + P2B M12 spec
|
|
type AccessToken struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
UserID uint `gorm:"not null;index" json:"user_id"`
|
|
Token string `gorm:"size:255;not null;uniqueIndex" json:"token"`
|
|
Name string `gorm:"size:255" json:"name"`
|
|
ExpiresAt *time.Time `json:"expires_at,omitempty"`
|
|
LastUsedAt *time.Time `json:"last_used_at,omitempty"`
|
|
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
|
|
|
|
User User `gorm:"foreignKey:UserID" json:"user,omitempty"`
|
|
}
|
|
|
|
func (AccessToken) TableName() string { return "access_tokens" } |