Initial commit
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package model
|
||||
|
||||
import "git.phc.dm.unipi.it/phc/website/libs/db"
|
||||
|
||||
type User struct {
|
||||
// Id è l'id unico di questo utente, non è modificabile una volta creato
|
||||
// l'utente.
|
||||
Id db.Ref[User] `db:"id"`
|
||||
|
||||
// Username è il nome leggibile di questo utente utilizzato anche per le
|
||||
// route per singolo utente, deve essere unico nel sito.
|
||||
//
|
||||
// NOTE: Quando un utente accede per la prima volta di default gli viene
|
||||
// chiesto se usare quello dell'account che sta usando o se cambiarlo
|
||||
// (in teoria non dovrebbe essere un problema poterlo modificare
|
||||
// successivamente).
|
||||
Username string `db:"username"`
|
||||
|
||||
// FullName da mostrare in giro per il sito
|
||||
FullName db.Option[string] `db:"full_name"`
|
||||
|
||||
// Email per eventuale contatto
|
||||
Email db.Option[string] `db:"email"`
|
||||
}
|
||||
|
||||
type ProviderType string
|
||||
|
||||
const AteneoProvider ProviderType = "ateneo"
|
||||
const PoissonProvider ProviderType = "poisson"
|
||||
|
||||
type Account struct {
|
||||
Id db.Ref[Account] `db:"id"` // Id of this entity
|
||||
UserId db.Ref[User] `db:"user_id"` // UserId tells the owner of this account binding
|
||||
Provider ProviderType `db:"provider"` // Provider is the name of the authentication method
|
||||
|
||||
Token string `db:"token"` // Token to use to make requests on behalf of this user
|
||||
}
|
||||
Reference in New Issue
Block a user