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

foundational layer for inserting content and attachment links into content

This commit is contained in:
Harvey Kandola 2016-10-23 18:33:07 -07:00
parent 5ca53ecb04
commit 7db618dea0
20 changed files with 1397 additions and 721 deletions

View file

@ -47,23 +47,23 @@ func (p *Persister) AddAttachment(a entity.Attachment) (err error) {
return
}
// GetAttachmentByJobAndFileID returns the database attachment record specified by the parameters.
func (p *Persister) GetAttachmentByJobAndFileID(orgID, job, fileID string) (attachment entity.Attachment, err error) {
// GetAttachment returns the database attachment record specified by the parameters.
func (p *Persister) GetAttachment(orgID, attachmentID string) (attachment entity.Attachment, err error) {
err = nil
stmt, err := Db.Preparex("SELECT id, refid, orgid, documentid, job, fileid, filename, data, extension, created, revised FROM attachment WHERE orgid=? and job=? and fileid=?")
stmt, err := Db.Preparex("SELECT id, refid, orgid, documentid, job, fileid, filename, data, extension, created, revised FROM attachment WHERE orgid=? and refid=?")
defer utility.Close(stmt)
if err != nil {
log.Error(fmt.Sprintf("Unable to prepare select for attachment %s/%s", job, fileID), err)
log.Error(fmt.Sprintf("Unable to prepare select for attachment %s", attachmentID), err)
return
}
err = stmt.Get(&attachment, orgID, job, fileID)
err = stmt.Get(&attachment, orgID, attachmentID)
if err != nil {
log.Error(fmt.Sprintf("Unable to execute select for attachment %s/%s", job, fileID), err)
log.Error(fmt.Sprintf("Unable to execute select for attachment %s", attachmentID), err)
return
}