1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 07:39:43 +02:00

event logging

This commit is contained in:
Harvey Kandola 2017-05-04 12:31:52 +01:00
parent b6c676149a
commit 93ed361705
48 changed files with 861 additions and 853 deletions

View file

@ -64,6 +64,8 @@ func AttachmentDownload(w http.ResponseWriter, r *http.Request) {
_, err = w.Write(attachment.Data)
log.IfErr(err)
p.RecordEvent(entity.EventTypeAttachmentDownload)
}
// GetAttachments is an end-point that returns all of the attachments of a particular documentID.
@ -125,7 +127,6 @@ func DeleteAttachment(w http.ResponseWriter, r *http.Request) {
}
tx, err := request.Db.Beginx()
if err != nil {
writeTransactionError(w, method, err)
return
@ -141,6 +142,8 @@ func DeleteAttachment(w http.ResponseWriter, r *http.Request) {
return
}
p.RecordEvent(entity.EventTypeAttachmentDelete)
log.IfErr(tx.Commit())
writeSuccessEmptyJSON(w)
@ -217,6 +220,8 @@ func AddAttachments(w http.ResponseWriter, r *http.Request) {
return
}
p.RecordEvent(entity.EventTypeAttachmentAdd)
log.IfErr(tx.Commit())
writeSuccessEmptyJSON(w)