remove dead code lmao
This commit is contained in:
parent
9ef7760967
commit
c844ab063b
1 changed files with 0 additions and 51 deletions
|
@ -61,57 +61,6 @@ func RegisterFileRoutes(cfg *types.StereoConfig, api *gin.RouterGroup) {
|
|||
c.JSON(200, gin.H{"message": "file uploaded successfully", "name": fileMeta.Name})
|
||||
})
|
||||
|
||||
// api.DELETE("/delete", auth.JwtMiddleware(cfg.JWTSecret), func(c *gin.Context) {
|
||||
// claims := c.MustGet("claims").(jwt.MapClaims)
|
||||
// user := claims["user"].(auth.User)
|
||||
|
||||
// uid := user.ID
|
||||
// if uid == "" {
|
||||
// c.JSON(401, gin.H{"error": "unauthorized"})
|
||||
// return
|
||||
// }
|
||||
|
||||
// var response struct {
|
||||
// Name string `json:"name" binding:"required"`
|
||||
// ID string `json:"id" binding:"required"`
|
||||
// }
|
||||
|
||||
// if err := c.ShouldBindJSON(&response); err != nil {
|
||||
// c.JSON(400, gin.H{"error": "name is required"})
|
||||
// return
|
||||
// }
|
||||
|
||||
// name := response.Name
|
||||
// if name == "" {
|
||||
// c.JSON(400, gin.H{"error": "name cannot be empty"})
|
||||
// return
|
||||
// }
|
||||
|
||||
// resID := response.ID
|
||||
// if resID == "" {
|
||||
// c.JSON(400, gin.H{"error": "id cannot be empty"})
|
||||
// return
|
||||
// }
|
||||
|
||||
// if resID != uid {
|
||||
// c.JSON(403, gin.H{"error": "you can only delete your own files"})
|
||||
// return
|
||||
// }
|
||||
|
||||
// filePath := filepath.Join(cfg.ImagePath, uid, name)
|
||||
// if err := os.Remove(filePath); err != nil {
|
||||
// c.JSON(500, gin.H{"error": "failed to delete file"})
|
||||
// return
|
||||
// }
|
||||
|
||||
// if err := cfg.Database.Where("name = ?", name).Where("owner = ?", uid).Delete(&types.File{}).Error; err != nil {
|
||||
// c.JSON(500, gin.H{"error": "failed to delete file metadata"})
|
||||
// return
|
||||
// }
|
||||
|
||||
// c.JSON(200, gin.H{"message": "file deleted successfully"})
|
||||
// })
|
||||
|
||||
api.DELETE("/:uid/:name", auth.JwtMiddleware(cfg.JWTSecret), func(c *gin.Context) {
|
||||
claims := c.MustGet("claims").(jwt.MapClaims)
|
||||
user := claims["user"].(auth.User)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue