mirror of
https://github.com/documize/community.git
synced 2025-07-24 07:39:43 +02:00
major package structure refactoring
This commit is contained in:
parent
7b8cec9a6c
commit
cf58f8164d
73 changed files with 549 additions and 389 deletions
|
@ -18,7 +18,7 @@ import (
|
|||
|
||||
"github.com/documize/community/core/api/entity"
|
||||
"github.com/documize/community/core/log"
|
||||
"github.com/documize/community/core/utility"
|
||||
"github.com/documize/community/core/streamutil"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
@ -28,7 +28,7 @@ func (p *Persister) AddAccount(account entity.Account) (err error) {
|
|||
account.Revised = time.Now().UTC()
|
||||
|
||||
stmt, err := p.Context.Transaction.Preparex("INSERT INTO account (refid, orgid, userid, admin, editor, active, created, revised) VALUES (?, ?, ?, ?, ?, ?, ?, ?)")
|
||||
defer utility.Close(stmt)
|
||||
defer streamutil.Close(stmt)
|
||||
|
||||
if err != nil {
|
||||
errors.Wrap(err, "Unable to prepare insert for account")
|
||||
|
@ -48,7 +48,7 @@ func (p *Persister) AddAccount(account entity.Account) (err error) {
|
|||
// GetUserAccount returns the database account record corresponding to the given userID, using the client's current organizaion.
|
||||
func (p *Persister) GetUserAccount(userID string) (account entity.Account, err error) {
|
||||
stmt, err := Db.Preparex("SELECT a.*, b.company, b.title, b.message, b.domain FROM account a, organization b WHERE b.refid=a.orgid and a.orgid=? and a.userid=?")
|
||||
defer utility.Close(stmt)
|
||||
defer streamutil.Close(stmt)
|
||||
|
||||
if err != nil {
|
||||
log.Error(fmt.Sprintf("Unable to prepare select for account by user %s", userID), err)
|
||||
|
@ -109,7 +109,7 @@ func (p *Persister) UpdateAccount(account entity.Account) (err error) {
|
|||
account.Revised = time.Now().UTC()
|
||||
|
||||
stmt, err := p.Context.Transaction.PrepareNamed("UPDATE account SET userid=:userid, admin=:admin, editor=:editor, active=:active, revised=:revised WHERE orgid=:orgid AND refid=:refid")
|
||||
defer utility.Close(stmt)
|
||||
defer streamutil.Close(stmt)
|
||||
|
||||
if err != nil {
|
||||
log.Error(fmt.Sprintf("Unable to prepare update for account %s", account.RefID), err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue