summaryrefslogtreecommitdiff
path: root/server/admin/models.go
diff options
context:
space:
mode:
authorMichael Hunteman <huntemanmt@gmail.com>2025-02-02 18:57:30 -0600
committerMichael Hunteman <huntemanmt@gmail.com>2025-02-02 19:04:24 -0600
commit5fffbba3b851f6cebfd0e616bef2ff6f0c520c3d (patch)
treefe8b7a5ba77f83f7b82753d5cc58cba51596da2b /server/admin/models.go
parent23bcef02052c45089358d22d0645ceac858de3bb (diff)
Fix error handlingHEADmaster
Diffstat (limited to 'server/admin/models.go')
-rw-r--r--server/admin/models.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/server/admin/models.go b/server/admin/models.go
index 275f617..524099b 100644
--- a/server/admin/models.go
+++ b/server/admin/models.go
@@ -1,6 +1,8 @@
package admin
import (
+ "time"
+
"git.huntm.net/wedding/server/guest"
"github.com/golang-jwt/jwt/v5"
)
@@ -20,3 +22,16 @@ type Login struct {
Guests []guest.Guest `json:"guests"`
Token string `json:"token"`
}
+
+func NewClaims(admin Admin, expirationTime time.Time) *Claims {
+ return &Claims{
+ admin,
+ jwt.RegisteredClaims{
+ ExpiresAt: jwt.NewNumericDate(expirationTime),
+ },
+ }
+}
+
+func NewLogin(guests []guest.Guest, token string) *Login {
+ return &Login{guests, token}
+}