Add access token check to auth

This commit is contained in:
Melody Becker 2025-04-04 16:15:25 +02:00
parent 8f53e8a967
commit 6a2b213787
Signed by: mstar
SSH key fingerprint: SHA256:9VAo09aaVNTWKzPW7Hq2LW+ox9OdwmTSHRoD4mlz1yI
4 changed files with 34 additions and 7 deletions

View file

@ -2,6 +2,8 @@ package models
import (
"time"
"gorm.io/gen"
)
// AccessToken maps a unique token to one account.
@ -18,3 +20,10 @@ type AccessToken struct {
// 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 {
// Get the data for a token
//
// SELECT * FROM @@table WHERE token = @token
GetTokenIfValid(token string) (*gen.T, error)
}