2015-07-16 10:59:11 -05:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Typed errors
|
|
|
|
var (
|
|
|
|
ErrTempUserNotFound = errors.New("User not found")
|
|
|
|
)
|
|
|
|
|
2015-07-17 02:51:34 -05:00
|
|
|
// TempUser holds data for org invites and unconfirmed sign ups
|
2015-07-16 10:59:11 -05:00
|
|
|
type TempUser struct {
|
2015-07-17 02:51:34 -05:00
|
|
|
Id int64
|
|
|
|
OrgId int64
|
|
|
|
Version int
|
|
|
|
Email string
|
|
|
|
Name string
|
|
|
|
Role string
|
|
|
|
IsInvite bool
|
|
|
|
InvitedByUserId int64
|
2015-07-16 10:59:11 -05:00
|
|
|
|
|
|
|
EmailSent bool
|
|
|
|
EmailSentOn time.Time
|
|
|
|
Code string
|
|
|
|
|
|
|
|
Created time.Time
|
|
|
|
Updated time.Time
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------
|
|
|
|
// COMMANDS
|
|
|
|
|
|
|
|
type CreateTempUserCommand struct {
|
2015-07-17 02:51:34 -05:00
|
|
|
Email string
|
|
|
|
Name string
|
|
|
|
OrgId int64
|
|
|
|
IsInvite bool
|
|
|
|
InvitedByUserId int64
|
|
|
|
Code string
|
2015-07-16 10:59:11 -05:00
|
|
|
|
|
|
|
Result *TempUser
|
|
|
|
}
|
|
|
|
|
|
|
|
type GetTempUsersForOrgQuery struct {
|
|
|
|
OrgId int64
|
|
|
|
|
|
|
|
Result []*TempUserDTO
|
|
|
|
}
|
|
|
|
|
|
|
|
type TempUserDTO struct {
|
|
|
|
Id int64 `json:"id"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
Email string `json:"email"`
|
|
|
|
Role string `json:"role"`
|
|
|
|
EmailSent bool `json:"emailSent"`
|
|
|
|
EmailSentOn time.Time `json:"emailSentOn"`
|
|
|
|
Created time.Time `json:"createdOn"`
|
|
|
|
}
|