mirror of
https://github.com/documize/community.git
synced 2025-08-02 20:15:26 +02:00
PostgreSQL prep
Update of vendored SQL libs and refactoring of store provider layer.
This commit is contained in:
parent
d0e005f638
commit
b455e5eaf5
105 changed files with 10949 additions and 2376 deletions
|
@ -15,18 +15,19 @@ package audit
|
|||
import (
|
||||
"time"
|
||||
|
||||
"github.com/documize/community/core/env"
|
||||
"github.com/documize/community/domain"
|
||||
"github.com/documize/community/domain/store"
|
||||
"github.com/documize/community/model/audit"
|
||||
)
|
||||
|
||||
// Scope provides data access to MySQL.
|
||||
type Scope struct {
|
||||
Runtime *env.Runtime
|
||||
// Store provides data access to audit log information.
|
||||
type Store struct {
|
||||
store.Context
|
||||
domain.AuditStorer
|
||||
}
|
||||
|
||||
// Record adds event entry for specified user using own DB TX.
|
||||
func (s Scope) Record(ctx domain.RequestContext, t audit.EventType) {
|
||||
func (s Store) Record(ctx domain.RequestContext, t audit.EventType) {
|
||||
e := audit.AppEvent{}
|
||||
e.OrgID = ctx.OrgID
|
||||
e.UserID = ctx.UserID
|
||||
|
@ -40,7 +41,7 @@ func (s Scope) Record(ctx domain.RequestContext, t audit.EventType) {
|
|||
return
|
||||
}
|
||||
|
||||
_, err = tx.Exec("INSERT INTO dmz_audit_log (c_orgid, c_userid, c_eventtype, c_ip, c_created) VALUES (?, ?, ?, ?, ?)",
|
||||
_, err = tx.Exec(s.Bind("INSERT INTO dmz_audit_log (c_orgid, c_userid, c_eventtype, c_ip, c_created) VALUES (?, ?, ?, ?, ?)"),
|
||||
e.OrgID, e.UserID, e.Type, e.IP, e.Created)
|
||||
|
||||
if err != nil {
|
Loading…
Add table
Add a link
Reference in a new issue