@Tags File @Summary Read file by Line @Param type path string true "type" @Param request body request.FileReadByLineReq true "request" @Success 200 {object} response.FileLineContent @Security ApiKeyAuth @Security Timestamp @Router /files/read/{type} [post]
(c *gin.Context)
| 986 | // @Security Timestamp |
| 987 | // @Router /files/read/{type} [post] |
| 988 | func (b *BaseApi) ReadFileByLine(c *gin.Context) { |
| 989 | var req request.FileReadByLineReq |
| 990 | if err := helper.CheckBindAndValidate(&req, c); err != nil { |
| 991 | return |
| 992 | } |
| 993 | if readType := strings.TrimSpace(c.Param("type")); readType != "" { |
| 994 | req.Type = readType |
| 995 | } |
| 996 | res, err := fileService.ReadLogByLine(req) |
| 997 | if err != nil { |
| 998 | helper.InternalServer(c, err) |
| 999 | return |
| 1000 | } |
| 1001 | if res.TotalLines > 100 { |
| 1002 | helper.SuccessWithDataGzipped(c, res) |
| 1003 | } else { |
| 1004 | helper.SuccessWithData(c, res) |
| 1005 | } |
| 1006 | } |
| 1007 | |
| 1008 | // @Tags File |
| 1009 | // @Summary Batch change file mode and owner |
no test coverage detected