We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parentb3aea59 commit6a39b31Copy full SHA for 6a39b31
pkg/api/files.go
@@ -55,12 +55,31 @@ func (i FilesResource) WebService() *restful.WebService {
55
ws.Route(ws.POST("/unmatch").To(i.unmatchFile).
56
Metadata(restfulspec.KeyOpenAPITags,tags))
57
58
+ws.Route(ws.GET("/file/{file-id}").To(i.getFile).
59
+Param(ws.PathParameter("file-id","File ID").DataType("int")).
60
+Metadata(restfulspec.KeyOpenAPITags,tags).
61
+Writes(models.File{}))
62
+
63
ws.Route(ws.DELETE("/file/{file-id}").To(i.removeFile).
64
65
66
returnws
67
}
68
69
+func (iFilesResource)getFile(req*restful.Request,resp*restful.Response) {
70
+varfile models.File
71
72
+id,err:=strconv.Atoi(req.PathParameter("file-id"))
73
+iferr!=nil {
74
+log.Error(err)
75
+return
76
+}
77
78
+_=file.GetIfExistByPK(uint(id))
79
80
+resp.WriteHeaderAndEntity(http.StatusOK,file)
81
82
83
func (iFilesResource)listFiles(req*restful.Request,resp*restful.Response) {
84
db,_:=models.GetDB()
85
deferdb.Close()