|
|
@@ -14,10 +14,19 @@ type TopicsController struct {
|
|
|
BaseApiController
|
|
|
}
|
|
|
|
|
|
-// func (ctrl *TopicsController) Index(c *gin.Context) {
|
|
|
-// topics := topic.All()
|
|
|
-// response.Data(c, topics)
|
|
|
-// }
|
|
|
+func (ctrl *TopicsController) Index(c *gin.Context) {
|
|
|
+ request := requests.PaginationRequest{}
|
|
|
+ if ok := requests.Validate(c, &request, requests.Pagination); !ok {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ data, pager := topic.Paginate(c, 10)
|
|
|
+
|
|
|
+ response.JSON(c, gin.H{
|
|
|
+ "data": data,
|
|
|
+ "pager": pager,
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
func (ctrl *TopicsController) Store(c *gin.Context) {
|
|
|
|