func()

in cmd/controller/workflow.go [160:176]


func (c *WorkflowController) QueryInstances(ctx *gin.Context) {
	request := QueryWorkflowInstancesRequest{}
	if err := ctx.ShouldBind(&request); err != nil {
		ctx.JSON(http.StatusBadRequest, err.Error())
		return
	}
	res, total, err := c.workflowDAL.SelectInstances(ctx, &model.QueryParam{
		WorkflowID: request.WorkflowID,
		Page:       request.Page,
		Size:       request.Size,
	})
	if err != nil {
		ctx.JSON(http.StatusInternalServerError, err.Error())
		return
	}
	ctx.JSON(http.StatusOK, &QueryWorkflowInstancesResponse{Total: total, WorkflowInstances: res})
}