More migration to command/query and sql tests, looking good
This commit is contained in:
+17
-11
@@ -6,10 +6,9 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
SaveAccount func(account *Account) error
|
||||
GetAccountByLogin func(emailOrName string) (*Account, error)
|
||||
GetAccount func(accountId int64) (*Account, error)
|
||||
GetOtherAccountsFor func(accountId int64) ([]*OtherAccount, error)
|
||||
SaveAccount func(account *Account) error
|
||||
GetAccountByLogin func(emailOrName string) (*Account, error)
|
||||
GetAccount func(accountId int64) (*Account, error)
|
||||
)
|
||||
|
||||
// Typed errors
|
||||
@@ -17,13 +16,6 @@ var (
|
||||
ErrAccountNotFound = errors.New("Account not found")
|
||||
)
|
||||
|
||||
// Projection from User -> other account given access to
|
||||
type OtherAccount struct {
|
||||
Id int64
|
||||
Email string
|
||||
Role string
|
||||
}
|
||||
|
||||
type Account struct {
|
||||
Id int64
|
||||
Login string `xorm:"UNIQUE NOT NULL"`
|
||||
@@ -41,6 +33,14 @@ type Account struct {
|
||||
Updated time.Time
|
||||
}
|
||||
|
||||
// api projection
|
||||
type OtherAccountDTO struct {
|
||||
Id int64 `json:"id"`
|
||||
Email string `json:"email"`
|
||||
Role string `json:"role"`
|
||||
IsUsing bool `json:"isUsing"`
|
||||
}
|
||||
|
||||
// api projection model
|
||||
type CollaboratorDTO struct {
|
||||
AccountId int64 `json:"accountId"`
|
||||
@@ -60,3 +60,9 @@ type GetAccountInfoQuery struct {
|
||||
Id int64
|
||||
Result AccountDTO
|
||||
}
|
||||
|
||||
// returns a view projection
|
||||
type GetOtherAccountsQuery struct {
|
||||
AccountId int64
|
||||
Result []*OtherAccountDTO
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user