(c *gin.Context)
| 37 | } |
| 38 | |
| 39 | func GetUserTask(c *gin.Context) { |
| 40 | pageInfo := common.GetPageQuery(c) |
| 41 | |
| 42 | userId := c.GetInt("id") |
| 43 | |
| 44 | startTimestamp, _ := strconv.ParseInt(c.Query("start_timestamp"), 10, 64) |
| 45 | endTimestamp, _ := strconv.ParseInt(c.Query("end_timestamp"), 10, 64) |
| 46 | |
| 47 | queryParams := model.SyncTaskQueryParams{ |
| 48 | Platform: constant.TaskPlatform(c.Query("platform")), |
| 49 | TaskID: c.Query("task_id"), |
| 50 | Status: c.Query("status"), |
| 51 | Action: c.Query("action"), |
| 52 | StartTimestamp: startTimestamp, |
| 53 | EndTimestamp: endTimestamp, |
| 54 | } |
| 55 | |
| 56 | items := model.TaskGetAllUserTask(userId, pageInfo.GetStartIdx(), pageInfo.GetPageSize(), queryParams) |
| 57 | total := model.TaskCountAllUserTask(userId, queryParams) |
| 58 | pageInfo.SetTotal(int(total)) |
| 59 | pageInfo.SetItems(tasksToDto(items, false)) |
| 60 | common.ApiSuccess(c, pageInfo) |
| 61 | } |
| 62 | |
| 63 | func tasksToDto(tasks []*model.Task, fillUser bool) []*dto.TaskDto { |
| 64 | var userIdMap map[int]*model.UserBase |
nothing calls this directly
no test coverage detected