mirror of
https://github.com/documize/community.git
synced 2025-07-31 02:59:44 +02:00
Make API work with new schema
This commit is contained in:
parent
28342fcf5e
commit
4f0cc2f616
48 changed files with 1218 additions and 1097 deletions
|
@ -34,7 +34,7 @@ func (s Scope) RecordUserActivity(ctx domain.RequestContext, activity activity.U
|
|||
activity.UserID = ctx.UserID
|
||||
activity.Created = time.Now().UTC()
|
||||
|
||||
_, err = ctx.Transaction.Exec("INSERT INTO dmz_user_activity (c_orgid, c_userid, c_spaceid, c_docid, c_pageid, c_sourcetype, c_activitytype, c_metadata, c_created) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
_, err = ctx.Transaction.Exec("INSERT INTO dmz_user_activity (c_orgid, c_userid, c_spaceid, c_docid, c_sectionid, c_sourcetype, c_activitytype, c_metadata, c_created) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
activity.OrgID, activity.UserID, activity.SpaceID, activity.DocumentID, activity.SectionID, activity.SourceType, activity.ActivityType, activity.Metadata, activity.Created)
|
||||
|
||||
if err != nil {
|
||||
|
@ -46,15 +46,15 @@ func (s Scope) RecordUserActivity(ctx domain.RequestContext, activity activity.U
|
|||
|
||||
// GetDocumentActivity returns the metadata for a specified document.
|
||||
func (s Scope) GetDocumentActivity(ctx domain.RequestContext, id string) (a []activity.DocumentActivity, err error) {
|
||||
qry := `SELECT a.id, DATE(a.c_created) as created, a.c_orgid as orgid,
|
||||
qry := `SELECT a.id, DATE(a.c_created) AS created, a.c_orgid AS orgid,
|
||||
IFNULL(a.c_userid, '') AS userid, a.c_spaceid AS spaceid,
|
||||
a.docid AS documentid, a.sectionid AS sectionid, a.c_activitytype AS activitytype,
|
||||
a.c_metadata AS metadata,
|
||||
IFNULL(u.c_firstname, 'Anonymous') AS firstname, IFNULL(u.c_lastname, 'Viewer') AS lastname,
|
||||
IFNULL(p.c_name, '') as sectionname
|
||||
IFNULL(p.c_name, '') AS sectionname
|
||||
FROM dmz_user_activity a
|
||||
LEFT JOIN user u ON a.c_userid=u.c_refid
|
||||
LEFT JOIN page p ON a.c_pageid=p.c_refid
|
||||
LEFT JOIN dmz_user u ON a.c_userid=u.c_refid
|
||||
LEFT JOIN dmz_section p ON a.c_sectionid=p.c_refid
|
||||
WHERE a.c_orgid=? AND a.c_docid=?
|
||||
AND a.c_userid != '0' AND a.c_userid != ''
|
||||
ORDER BY a.c_created DESC`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue