summaryrefslogtreecommitdiff
path: root/internal/models/user.go
blob: 938cf71a5e7c548784cd790411594bfeed572b9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package models

import "time"

// this is more than likely going to change
type Password [16]byte
type SessionID [16]byte

type Token struct {
	ID        ID        `json:"id"`
	String    string    `json:"string"`
	ExpiresAt time.Time `json:"expires_at"`
}

type User struct {
	ID          ID        `json:"id"`
	Name        string    `json:"name"`
	Password    Password  `json:"password"`
	Admin       bool      `json:"admin"`
	Token       Token     `json:"token"`
	CreatedAt   time.Time `json:"created_at"`
	LastUpdated time.Time `json:"last_updated"`
}

type UserSession struct {
	SessionID   SessionID `json:"session_id"`
	IP          string    `json:"ip"`
	UA          string    `json:"ua"`
	UserID      ID        `json:"user_id"`
	ExpiresAt   time.Time `json:"expires_at"`
	LastUpdated time.Time `json:"last_login"`
}