Files
ForgeBucket/internal/models/access_token.go
T

18 lines
683 B
Go

package models
import "time"
// RepoAccessToken grants scoped API (and git) access to a specific repo.
// Stored as a SHA-256 hash; the raw token is shown once on creation.
type RepoAccessToken struct {
ID int64 `xorm:"'id' pk autoincr"`
RepoID int64 `xorm:"'repo_id' notnull index"`
CreatorID int64 `xorm:"'creator_id' notnull"`
Title string `xorm:"'title' notnull"`
TokenHash string `xorm:"'token_hash' notnull unique"`
Scopes string `xorm:"'scopes' notnull"` // "read" | "read,write"
ExpiresAt *time.Time `xorm:"'expires_at'"`
LastUsed *time.Time `xorm:"'last_used_at'"`
CreatedAt time.Time `xorm:"'created_at' created"`
}