aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/lists/lists.go19
1 files changed, 14 insertions, 5 deletions
diff --git a/modules/lists/lists.go b/modules/lists/lists.go
index dcc7046..94d4030 100644
--- a/modules/lists/lists.go
+++ b/modules/lists/lists.go
@@ -34,8 +34,9 @@ type List struct {
34 34
35// ListGril ist ein geranktes Gril 35// ListGril ist ein geranktes Gril
36type ListGril struct { 36type ListGril struct {
37 Gril *grils.Gril 37 Gril *grils.Gril
38 Order int 38 Order int
39 ImagePath string
39} 40}
40 41
41// Name gibt den Namen des Moduls zurück 42// Name gibt den Namen des Moduls zurück
@@ -91,7 +92,7 @@ func (m *Module) getListGrils(list *List) error {
91func (m *Module) getLists(whereClause string, params ...interface{}) ([]*List, error) { 92func (m *Module) getLists(whereClause string, params ...interface{}) ([]*List, error) {
92 var lists []*List 93 var lists []*List
93 94
94 rows, err := m.g.DB.Query(fmt.Sprintf(`SELECT id, name, description, fork_of, updated_at FROM grilist.lists WHERE %s`, whereClause), params...) 95 rows, err := m.g.DB.Query(fmt.Sprintf(`SELECT id, name, description, fork_of, updated_at, user_id FROM grilist.lists WHERE %s`, whereClause), params...)
95 if err != nil { 96 if err != nil {
96 return nil, err 97 return nil, err
97 } 98 }
@@ -99,8 +100,8 @@ func (m *Module) getLists(whereClause string, params ...interface{}) ([]*List, e
99 defer rows.Close() 100 defer rows.Close()
100 for rows.Next() { 101 for rows.Next() {
101 list := &List{} 102 list := &List{}
102 103 var ownerID int
103 if err := rows.Scan(&list.ID, &list.Name, &list.Description, &list.ForkOf, &list.UpdatedAt); err != nil { 104 if err := rows.Scan(&list.ID, &list.Name, &list.Description, &list.ForkOf, &list.UpdatedAt, &ownerID); err != nil {
104 log.Println("error scanning row in getLists:", err) 105 log.Println("error scanning row in getLists:", err)
105 continue 106 continue
106 } 107 }
@@ -110,6 +111,14 @@ func (m *Module) getLists(whereClause string, params ...interface{}) ([]*List, e
110 continue 111 continue
111 } 112 }
112 113
114 // Owner kriegn
115 owner, err := m.g.Charakterin.GetUserByID(ownerID)
116 if err != nil {
117 log.Println("error retreiving owner of list", err)
118 continue
119 }
120 list.Owner = owner
121
113 lists = append(lists, list) 122 lists = append(lists, list)
114 } 123 }
115 124