@@ -33,7 +33,7 @@ func (s Scope) Add(ctx domain.RequestContext, account account.Account) (err erro
33
33
account .Created = time .Now ().UTC ()
34
34
account .Revised = time .Now ().UTC ()
35
35
36
- _ , err = ctx .Transaction .Exec ("INSERT INTO account (refid, orgid, userid, admin, editor, users, analytics, active, created, revised) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" ,
36
+ _ , err = ctx .Transaction .Exec ("INSERT INTO account (refid, orgid, userid, ` admin` , editor, users, analytics, active, created, revised) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" ,
37
37
account .RefID , account .OrgID , account .UserID , account .Admin , account .Editor , account .Users , account .Analytics , account .Active , account .Created , account .Revised )
38
38
39
39
if err != nil {
@@ -46,7 +46,7 @@ func (s Scope) Add(ctx domain.RequestContext, account account.Account) (err erro
46
46
// GetUserAccount returns the database account record corresponding to the given userID, using the client's current organizaion.
47
47
func (s Scope ) GetUserAccount (ctx domain.RequestContext , userID string ) (account account.Account , err error ) {
48
48
err = s .Runtime .Db .Get (& account , `
49
- SELECT a.id, a.refid, a.orgid, a.userid, a.editor, a. admin, a.users, a.analytics, a.active, a.created, a.revised,
49
+ SELECT a.id, a.refid, a.orgid, a.userid, a.editor, ` + "a.` admin`" + ` , a.users, a.analytics, a.active, a.created, a.revised,
50
50
b.company, b.title, b.message, b.domain
51
51
FROM account a, organization b
52
52
WHERE b.refid=a.orgid AND a.orgid=? AND a.userid=?` , ctx .OrgID , userID )
@@ -61,7 +61,7 @@ func (s Scope) GetUserAccount(ctx domain.RequestContext, userID string) (account
61
61
// GetUserAccounts returns a slice of database account records, for all organizations that the userID is a member of, in organization title order.
62
62
func (s Scope ) GetUserAccounts (ctx domain.RequestContext , userID string ) (t []account.Account , err error ) {
63
63
err = s .Runtime .Db .Select (& t , `
64
- SELECT a.id, a.refid, a.orgid, a.userid, a.editor, a. admin, a.users, a.analytics, a.active, a.created, a.revised,
64
+ SELECT a.id, a.refid, a.orgid, a.userid, a.editor, ` + "a.` admin`" + ` , a.users, a.analytics, a.active, a.created, a.revised,
65
65
b.company, b.title, b.message, b.domain
66
66
FROM account a, organization b
67
67
WHERE a.userid=? AND a.orgid=b.refid AND a.active=1 ORDER BY b.title` , userID )
@@ -76,7 +76,7 @@ func (s Scope) GetUserAccounts(ctx domain.RequestContext, userID string) (t []ac
76
76
// GetAccountsByOrg returns a slice of database account records, for all users in the client's organization.
77
77
func (s Scope ) GetAccountsByOrg (ctx domain.RequestContext ) (t []account.Account , err error ) {
78
78
err = s .Runtime .Db .Select (& t ,
79
- `SELECT a.id, a.refid, a.orgid, a.userid, a.editor, a. admin, a.users, a.analytics, a.active, a.created, a.revised,
79
+ `SELECT a.id, a.refid, a.orgid, a.userid, a.editor, ` + "a.` admin`" + ` , a.users, a.analytics, a.active, a.created, a.revised,
80
80
b.company, b.title, b.message, b.domain
81
81
FROM account a, organization b
82
82
WHERE a.orgid=b.refid AND a.orgid=? AND a.active=1` , ctx .OrgID )
@@ -109,7 +109,7 @@ func (s Scope) CountOrgAccounts(ctx domain.RequestContext) (c int) {
109
109
func (s Scope ) UpdateAccount (ctx domain.RequestContext , account account.Account ) (err error ) {
110
110
account .Revised = time .Now ().UTC ()
111
111
112
- _ , err = ctx .Transaction .NamedExec ("UPDATE account SET userid=:userid, admin=:admin, editor=:editor, users=:users, analytics=:analytics, active=:active, revised=:revised WHERE orgid=:orgid AND refid=:refid" , & account )
112
+ _ , err = ctx .Transaction .NamedExec ("UPDATE account SET userid=:userid, ` admin` =:admin, editor=:editor, users=:users, analytics=:analytics, active=:active, revised=:revised WHERE orgid=:orgid AND refid=:refid" , & account )
113
113
114
114
if err != sql .ErrNoRows && err != nil {
115
115
err = errors .Wrap (err , fmt .Sprintf ("execute update for account %s" , account .RefID ))
0 commit comments