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

Function GetCurrentSystemTask

controller/system_task.go:37–66  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

35}
36
37func GetCurrentSystemTask(c *gin.Context) {
38 taskType := c.Query("type")
39 if taskType == "" {
40 c.JSON(http.StatusOK, gin.H{
41 "success": false,
42 "message": "type is required",
43 })
44 return
45 }
46
47 task, err := model.GetActiveSystemTask(taskType)
48 if err != nil {
49 common.ApiError(c, err)
50 return
51 }
52 if task == nil {
53 c.JSON(http.StatusOK, gin.H{
54 "success": true,
55 "message": "",
56 "data": nil,
57 })
58 return
59 }
60
61 c.JSON(http.StatusOK, gin.H{
62 "success": true,
63 "message": "",
64 "data": task.ToResponse(),
65 })
66}
67
68func ListSystemTasks(c *gin.Context) {
69 limit, _ := strconv.Atoi(c.Query("limit"))

Callers

nothing calls this directly

Calls 4

GetActiveSystemTaskFunction · 0.92
ApiErrorFunction · 0.92
QueryMethod · 0.80
ToResponseMethod · 0.45

Tested by

no test coverage detected