Task Attachments #104
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue