|
|
@@ -17,7 +17,6 @@ func init() {
|
|
|
bus.AddHandler("sql", SetUsingAccount)
|
|
|
bus.AddHandler("sql", GetAccountById)
|
|
|
bus.AddHandler("sql", GetAccountByLogin)
|
|
|
- bus.AddHandler("sql", GetAccountByToken)
|
|
|
bus.AddHandler("sql", SearchAccounts)
|
|
|
bus.AddHandler("sql", UpdateAccount)
|
|
|
bus.AddHandler("sql", GetSignedInUser)
|
|
|
@@ -111,30 +110,6 @@ func GetAccountById(query *m.GetAccountByIdQuery) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-func GetAccountByToken(query *m.GetAccountByTokenQuery) error {
|
|
|
- var err error
|
|
|
-
|
|
|
- var account m.Account
|
|
|
- sess := x.Join("INNER", "token", "token.account_id = account.id")
|
|
|
- sess.Omit("token.id", "token.account_id", "token.name", "token.token",
|
|
|
- "token.role", "token.updated", "token.created")
|
|
|
- has, err := sess.Where("token.token=?", query.Token).Get(&account)
|
|
|
-
|
|
|
- if err != nil {
|
|
|
- return err
|
|
|
- } else if has == false {
|
|
|
- return m.ErrAccountNotFound
|
|
|
- }
|
|
|
-
|
|
|
- if account.UsingAccountId == 0 {
|
|
|
- account.UsingAccountId = account.Id
|
|
|
- }
|
|
|
-
|
|
|
- query.Result = &account
|
|
|
-
|
|
|
- return nil
|
|
|
-}
|
|
|
-
|
|
|
func GetAccountByLogin(query *m.GetAccountByLoginQuery) error {
|
|
|
if query.LoginOrEmail == "" {
|
|
|
return m.ErrAccountNotFound
|