MCPcopy Create free account
hub / github.com/QuantumNous/new-api / GetUserTask

Function GetUserTask

controller/task.go:428–438  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

426}
427
428func GetUserTask(c *gin.Context) {
429 pageInfo := common.GetPageQuery(c)
430 userID := c.GetInt("id")
431 startTimestamp, _ := strconv.ParseInt(c.Query("start_timestamp"), 10, 64)
432 endTimestamp, _ := strconv.ParseInt(c.Query("end_timestamp"), 10, 64)
433 queryParams := model.SyncTaskQueryParams{Platform: constant.TaskPlatform(c.Query("platform")), TaskID: c.Query("task_id"), Status: c.Query("status"), Action: c.Query("action"), StartTimestamp: startTimestamp, EndTimestamp: endTimestamp}
434 items := model.TaskGetAllUserTask(userID, pageInfo.GetStartIdx(), pageInfo.GetPageSize(), queryParams)
435 pageInfo.SetTotal(int(model.TaskCountAllUserTask(userID, queryParams)))
436 pageInfo.SetItems(tasksToDto(items, false, common.RoleCommonUser))
437 common.ApiSuccess(c, pageInfo)
438}
439
440func tasksToDto(tasks []*model.Task, fillUser bool, viewerRole int) []*dto.TaskDto {
441 var userIDMap map[int]*model.UserBase

Callers

nothing calls this directly

Calls 9

TaskPlatformTypeAlias · 0.92
TaskGetAllUserTaskFunction · 0.92
TaskCountAllUserTaskFunction · 0.92
tasksToDtoFunction · 0.85
QueryMethod · 0.80
GetStartIdxMethod · 0.80
GetPageSizeMethod · 0.80
SetTotalMethod · 0.80
SetItemsMethod · 0.80

Tested by

no test coverage detected