mirror of
https://github.com/documize/community.git
synced 2025-07-22 06:39:43 +02:00
wip
This commit is contained in:
parent
33a66c87cf
commit
7c34053e3d
25 changed files with 4884 additions and 3729 deletions
44
core/api/request/activity.go
Normal file
44
core/api/request/activity.go
Normal file
|
@ -0,0 +1,44 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
package request
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/documize/community/core/api/entity"
|
||||
"github.com/documize/community/core/log"
|
||||
"github.com/documize/community/core/utility"
|
||||
)
|
||||
|
||||
// RecordUserActivity logs user initiated data changes.
|
||||
func (p *Persister) RecordUserActivity(activity entity.UserActivity) (err error) {
|
||||
activity.OrgID = p.Context.OrgID
|
||||
activity.UserID = p.Context.UserID
|
||||
activity.Created = time.Now().UTC()
|
||||
|
||||
stmt, err := p.Context.Transaction.Preparex("INSERT INTO useractivity (orgid, userid, labelid, sourceid, sourcetype, activitytype, created) VALUES (?, ?, ?, ?, ?, ?, ?)")
|
||||
defer utility.Close(stmt)
|
||||
|
||||
if err != nil {
|
||||
log.Error("Unable to prepare insert RecordUserActivity", err)
|
||||
return
|
||||
}
|
||||
|
||||
_, err = stmt.Exec(activity.OrgID, activity.UserID, activity.LabelID, activity.SourceID, activity.SourceType, activity.ActivityType, activity.Created)
|
||||
|
||||
if err != nil {
|
||||
log.Error("Unable to execute insert RecordUserActivity", err)
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue