add name to file struct
This commit is contained in:
parent
3a6b24cb57
commit
09d8ffa82c
2 changed files with 3 additions and 2 deletions
|
@ -20,7 +20,6 @@ func intoReader(buf []byte) io.Reader {
|
|||
return io.NopCloser(bytes.NewBuffer(buf))
|
||||
}
|
||||
|
||||
|
||||
func RegisterFileRoutes(cfg *types.StereoConfig, api *gin.RouterGroup) {
|
||||
api.POST("/upload", auth.JwtMiddleware(cfg.JWTSecret), func(c *gin.Context) {
|
||||
claims := c.MustGet("claims").(jwt.MapClaims)
|
||||
|
@ -67,6 +66,7 @@ func RegisterFileRoutes(cfg *types.StereoConfig, api *gin.RouterGroup) {
|
|||
|
||||
fileMeta := types.File{
|
||||
Owner: uid,
|
||||
Name: file.Filename,
|
||||
CreatedAt: time.Now(),
|
||||
Size: int64(len(buf)),
|
||||
Mime: fileType.MIME.Value,
|
||||
|
@ -85,7 +85,7 @@ func RegisterFileRoutes(cfg *types.StereoConfig, api *gin.RouterGroup) {
|
|||
return
|
||||
}
|
||||
|
||||
c.JSON(200, gin.H{"message": "file uploaded successfully", "name": fileMeta.ID.String()})
|
||||
c.JSON(200, gin.H{"message": "file uploaded successfully", "id": fileMeta.ID.String()})
|
||||
})
|
||||
|
||||
api.DELETE("/:id", auth.JwtMiddleware(cfg.JWTSecret), func(c *gin.Context) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue