diff --git a/api.md b/api.md index a2a865e..73114d7 100644 --- a/api.md +++ b/api.md @@ -9,5 +9,4 @@ | POST | /api/upload | Upload file | Upload key | | DELETE | /api/:id | Delete file | Upload key | | GET | /api/:id | Get file | Upload key | -| GET | /api/:id/meta | Get file metadata | None | | GET | /api/list | Get a list of uploaded files | Session key | diff --git a/internal/api/routes/files.go b/internal/api/routes/files.go index 2930bdc..3007193 100644 --- a/internal/api/routes/files.go +++ b/internal/api/routes/files.go @@ -176,30 +176,6 @@ func RegisterFileRoutes(cfg *types.StereoConfig, api *gin.RouterGroup) { c.DataFromReader(200, file.Size, file.Mime, object, nil) }) - api.GET("/:id/meta", func(c *gin.Context) { - fileID := c.Param("id") - fileID = strings.TrimSpace(fileID) - - var file *types.File - id, err := uuid.FromString(fileID) - if err != nil { - types.ErrorInvalidFile.Throw(c, err) - return - } - - if err := cfg.Database.First(&file, id).Error; err != nil { - types.ErrorFileNotFound.Throw(c, err) - return - } - - if file == nil { - types.ErrorFileNotFound.Throw(c, nil) - return - } - - c.JSON(200, file) - }) - api.GET("/list", session.SessionMiddleware(cfg.JWTSecret), func(c *gin.Context) { claims := c.MustGet("claims").(jwt.MapClaims) user := claims["user"].(auth.User) diff --git a/internal/auth/types.go b/internal/auth/types.go index a36ac90..ce06067 100644 --- a/internal/auth/types.go +++ b/internal/auth/types.go @@ -32,12 +32,14 @@ type TokenResponse struct { } type User struct { - ID string `json:"id" gorm:"primaryKey"` - Username string `json:"username"` - Blacklisted bool `json:"blacklisted"` - Email string `json:"email"` - CreatedAt time.Time `json:"created_at"` - HashedApiKey string `json:"hashed_api_key"` + ID string `json:"id" gorm:"primaryKey"` + Username string `json:"username"` + Blacklisted bool `json:"blacklisted"` + Email string `json:"email"` + CreatedAt time.Time `json:"created_at"` + HashedApiKey string `json:"hashed_api_key"` + Role string `json:"role" gorm:"default:'free'"` // free, pro, pro+, admin + SubscriptionExpiresAt time.Time `json:"subscription_expires_at"` } type AvatarDecorationData struct {