mirror of
https://github.com/emo2007/block-accounting.git
synced 2025-04-12 08:56:28 +00:00
55 lines
700 B
Go
55 lines
700 B
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type UserIdentity interface {
|
|
Id() uuid.UUID
|
|
Seed() []byte
|
|
IsAdmin() bool
|
|
}
|
|
|
|
type User struct {
|
|
ID uuid.UUID
|
|
Bip32Seed []byte
|
|
Admin bool
|
|
Activated bool
|
|
CreatedAt time.Time
|
|
}
|
|
|
|
func NewUser(
|
|
id uuid.UUID,
|
|
seed []byte,
|
|
isAdmin bool,
|
|
activated bool,
|
|
createdAt time.Time,
|
|
) *User {
|
|
return &User{
|
|
ID: id,
|
|
Bip32Seed: seed,
|
|
Admin: isAdmin,
|
|
Activated: activated,
|
|
CreatedAt: createdAt,
|
|
}
|
|
}
|
|
|
|
func (u *User) Id() uuid.UUID {
|
|
return u.ID
|
|
}
|
|
|
|
func (u *User) Seed() []byte {
|
|
return u.Bip32Seed
|
|
}
|
|
|
|
func (u *User) IsAdmin() bool {
|
|
return u.Admin
|
|
}
|
|
|
|
type OrganizationUser struct {
|
|
User
|
|
// add org info
|
|
}
|