1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-21 22:29:41 +02:00
This commit is contained in:
Harvey Kandola 2017-01-28 20:38:56 -08:00
parent 33a66c87cf
commit 7c34053e3d
25 changed files with 4884 additions and 3729 deletions

View file

@ -62,19 +62,15 @@ func uploadDocument(w http.ResponseWriter, r *http.Request) (string, string, str
}
// generate job id
var job = "some-uuid"
newUUID, err := uuid.NewV4()
if err != nil {
writeServerError(w, method, err)
return "", "", ""
}
job = newUUID.String()
job := newUUID.String()
err = storageProvider.Upload(job, filename.Filename, b.Bytes())
if err != nil {
writeServerError(w, method, err)
return "", "", ""
@ -229,10 +225,7 @@ func processDocument(p request.Persister, filename, job, folderID string, fileRe
return
}
// New code from normal conversion code
tx, err = request.Db.Beginx()
if err != nil {
log.Error("Cannot begin a transatcion", err)
return
@ -248,9 +241,13 @@ func processDocument(p request.Persister, filename, job, folderID string, fileRe
return
}
log.IfErr(tx.Commit())
p.RecordUserActivity(entity.UserActivity{
LabelID: newDocument.LabelID,
SourceID: newDocument.RefID,
SourceType: entity.ActivitySourceTypeDocument,
ActivityType: entity.ActivityTypeCreated})
// End new code
log.IfErr(tx.Commit())
return
}