File tree 1 file changed +19
-1
lines changed
1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 7
7
8
8
"github.com/julienschmidt/httprouter"
9
9
10
+ "github.com/admin-golang/admin/dataloader"
10
11
"github.com/chris-ramon/golang-scaffolding/domain/users/mappers"
11
12
userTypes "github.com/chris-ramon/golang-scaffolding/domain/users/types"
12
13
)
@@ -26,7 +27,24 @@ func (h *handlers) GetUsers() httprouter.Handle {
26
27
27
28
usersAPI := mappers .UsersFromTypeToAPI (users )
28
29
29
- resp , err := json .Marshal (usersAPI )
30
+ response := dataloader.Response {
31
+ Data : usersAPI ,
32
+ Meta : dataloader.Meta {
33
+ Headers : []string {"ID" , "Username" },
34
+ Components : map [string ]string {
35
+ "id" : "text" ,
36
+ "username" : "text" ,
37
+ },
38
+ Pagination : dataloader.Pagination {
39
+ TotalCount : len (usersAPI ),
40
+ PerPage : 10 ,
41
+ CurrentPage : 0 ,
42
+ RowsPerPage : []int {10 , 25 , 50 },
43
+ },
44
+ },
45
+ }
46
+
47
+ resp , err := json .Marshal (response )
30
48
if err != nil {
31
49
http .Error (w , "failed to marshal response" , http .StatusInternalServerError )
32
50
return
You can’t perform that action at this time.
0 commit comments