fix: use tenant database auth schema
This commit is contained in:
@@ -302,10 +302,10 @@ func (a *adapter) TenantUserDelete(id t.TenantID, uid t.Uid, hard bool) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if _, err = tx.Exec("DELETE FROM im_auth WHERE tenant_id=? AND userid=?", id, decoded); err != nil {
|
||||
if _, err = tx.Exec("DELETE FROM im_auth WHERE userid=?", decoded); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err = tx.Exec("DELETE FROM im_credentials WHERE tenant_id=? AND userid=?", id, decoded); err != nil {
|
||||
if _, err = tx.Exec("DELETE FROM im_credentials WHERE userid=?", decoded); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err = tx.Exec("DELETE FROM im_usertags WHERE tenant_id=? AND userid=?", id, decoded); err != nil {
|
||||
@@ -528,9 +528,9 @@ func (a *adapter) TenantUserGetUnvalidated(id t.TenantID, before time.Time, limi
|
||||
}
|
||||
rows, err := a.db.QueryxContext(ctx,
|
||||
"SELECT u.id,IFNULL(SUM(c.done),0) AS total FROM im_users AS u "+
|
||||
"LEFT JOIN im_credentials AS c ON u.tenant_id=c.tenant_id AND u.id=c.userid "+
|
||||
"WHERE u.tenant_id=? AND u.lastseen IS NULL AND u.updatedat<? "+
|
||||
"GROUP BY u.id,u.updatedat HAVING total=0 ORDER BY u.updatedat ASC LIMIT ?", id, before, limit)
|
||||
"LEFT JOIN im_credentials AS c ON u.id=c.userid "+
|
||||
"WHERE u.lastseen IS NULL AND u.updatedat<? "+
|
||||
"GROUP BY u.id,u.updatedat HAVING total=0 ORDER BY u.updatedat ASC LIMIT ?", before, limit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user