Task Attachments #104

Merged
konrad merged 63 commits from feature/attachments into master 2019-10-16 20:52:31 +00:00
2 changed files with 8 additions and 2 deletions
Showing only changes of commit 8ebb2de0c6 - Show all commits

View File

@ -94,7 +94,8 @@ func (ta *TaskAttachment) ReadAll(s string, a web.Auth, page int) (interface{},
err := x.
Limit(getLimitFromPageIndex(page)).
Find(attachments)
Where("task_id = ?", ta.TaskID).
Find(&attachments)
if err != nil {
return nil, err
}

View File

@ -110,7 +110,12 @@ func TestTaskAttachment_NewAttachment(t *testing.T) {
}
func TestTaskAttachment_ReadAll(t *testing.T) {
// Assert all files are loaded correctly with their actual files
ta := &TaskAttachment{TaskID: 1}
as, err := ta.ReadAll("", &User{ID: 1}, 0)
attachments, _ := as.([]*TaskAttachment)
assert.NoError(t, err)
assert.Len(t, attachments, 3)
assert.Equal(t, "test", attachments[0].File.Name)
}
func TestTaskAttachment_Delete(t *testing.T) {