basePath: / definitions: models.Category: properties: children: items: $ref: '#/definitions/models.Category' type: array created_at: type: string description: type: string id: type: integer image: type: string is_active: type: boolean keywords: type: string order: type: integer parent: $ref: '#/definitions/models.Category' parent_id: type: integer slug: type: string title: type: string updated_at: type: string type: object models.Comment: properties: body: type: string children: items: $ref: '#/definitions/models.Comment' type: array created_at: type: string id: type: integer is_active: type: boolean parent: $ref: '#/definitions/models.Comment' parent_id: type: integer product: $ref: '#/definitions/models.Post' product_id: type: integer slug: type: string title: type: string updated_at: type: string user_id: type: integer type: object models.CorsBlacklist: properties: created_at: type: string created_by: type: string id: type: integer is_active: type: boolean origin: type: string reason: type: string updated_at: type: string type: object models.CorsWhitelist: properties: created_at: type: string created_by: type: string description: type: string id: type: integer is_active: type: boolean origin: type: string updated_at: type: string type: object models.Permission: properties: description: type: string id: type: integer name: description: user:read, user:write type: string type: object models.Post: properties: categories: items: $ref: '#/definitions/models.Category' type: array children: items: $ref: '#/definitions/models.Post' type: array content: type: string created_at: type: string id: type: integer image: type: string is_active: type: boolean is_front: type: boolean keywords: type: string parent: $ref: '#/definitions/models.Post' parent_id: type: integer slug: type: string tags: items: $ref: '#/definitions/models.Tag' type: array thumb: type: string title: type: string updated_at: type: string user: $ref: '#/definitions/models.User' user_id: type: integer video: type: string type: object models.RateLimitSetting: properties: created_at: type: string description: type: string id: type: integer is_active: type: boolean max_requests: description: Max istek sayısı type: integer name: description: e.g., "login", "register", "api" type: string updated_at: type: string updated_by: type: string window_seconds: description: Zaman penceresi (saniye) type: integer type: object models.Role: properties: description: type: string id: type: integer name: description: admin, user type: string permissions: items: $ref: '#/definitions/models.Permission' type: array type: object models.SocialAccount: properties: avatar_url: description: Avatar URL from provider type: string created_at: type: string email: type: string id: type: integer name: description: Full name from provider type: string provider: description: google, github type: string provider_id: type: string updated_at: type: string user_id: type: integer type: object models.Tag: properties: created_at: type: string id: type: integer is_active: type: boolean slug: type: string tag: type: string updated_at: type: string type: object models.User: properties: avatar: description: Avatar URL from OAuth or uploaded type: string created_at: type: string email: type: string email_verified: description: |- Email verification: only required for email/password registration; OAuth users are treated as verified Changed to *bool to handle false values correctly with GORM defaults type: boolean email_verified_at: type: string id: type: integer roles: items: $ref: '#/definitions/models.Role' type: array social_accounts: items: $ref: '#/definitions/models.SocialAccount' type: array updated_at: type: string username: type: string type: object host: localhost:8080 info: contact: email: support@beyhan.com name: API Support description: Modular REST API with Blog, Account, and Settings apps license: name: MIT url: https://opensource.org/licenses/MIT termsOfService: http://swagger.io/terms/ title: Beyhan Backend API version: "2.0" paths: /api/v1/admin/categories: get: consumes: - application/json description: Get list of all categories including inactive ones produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/models.Category' type: array security: - BearerAuth: [] summary: Get all categories (Admin) tags: - admin - categories post: consumes: - application/json description: Create a new category parameters: - description: Category object in: body name: category required: true schema: $ref: '#/definitions/models.Category' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/models.Category' security: - BearerAuth: [] summary: Create a new category (Admin) tags: - admin - categories /api/v1/admin/categories/{id}: delete: consumes: - application/json description: Delete a category by ID parameters: - description: Category ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Delete a category (Admin) tags: - admin - categories get: consumes: - application/json description: Get a single category by ID parameters: - description: Category ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/models.Category' security: - BearerAuth: [] summary: Get category by ID (Admin) tags: - admin - categories put: consumes: - application/json description: Update an existing category parameters: - description: Category ID in: path name: id required: true type: integer - description: Category object in: body name: category required: true schema: $ref: '#/definitions/models.Category' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/models.Category' security: - BearerAuth: [] summary: Update a category (Admin) tags: - admin - categories /api/v1/admin/categories/{id}/views: get: consumes: - application/json description: Get view count and details for a specific category parameters: - description: Category ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: additionalProperties: true type: object security: - BearerAuth: [] summary: Get view stats for a category (Admin) tags: - admin - category-views /api/v1/admin/category-views: get: consumes: - application/json description: Get paginated list of all category views parameters: - default: 1 description: Page number in: query name: page type: integer - default: 10 description: Items per page in: query name: limit type: integer produces: - application/json responses: "200": description: OK schema: additionalProperties: true type: object security: - BearerAuth: [] summary: Get all category views (Admin) tags: - admin - category-views /api/v1/admin/comments: get: consumes: - application/json description: Get paginated list of all comments parameters: - default: 1 description: Page number in: query name: page type: integer - default: 10 description: Items per page in: query name: limit type: integer produces: - application/json responses: "200": description: OK schema: additionalProperties: true type: object security: - BearerAuth: [] summary: Get all comments (Admin) tags: - admin - comments /api/v1/admin/comments/{id}: delete: consumes: - application/json description: Delete a comment by ID parameters: - description: Comment ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Delete a comment (Admin) tags: - admin - comments get: consumes: - application/json description: Get a single comment by ID parameters: - description: Comment ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/models.Comment' security: - BearerAuth: [] summary: Get comment by ID (Admin) tags: - admin - comments put: consumes: - application/json description: Update an existing comment parameters: - description: Comment ID in: path name: id required: true type: integer - description: Comment object in: body name: comment required: true schema: $ref: '#/definitions/models.Comment' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/models.Comment' security: - BearerAuth: [] summary: Update a comment (Admin) tags: - admin - comments /api/v1/admin/cors/blacklist: get: consumes: - application/json description: Get all CORS blacklist origins produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/models.CorsBlacklist' type: array security: - BearerAuth: [] summary: Get all CORS blacklist entries (Admin) tags: - admin - settings post: consumes: - application/json description: Add a new origin to CORS blacklist parameters: - description: Blacklist object in: body name: blacklist required: true schema: $ref: '#/definitions/models.CorsBlacklist' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/models.CorsBlacklist' security: - BearerAuth: [] summary: Create CORS blacklist entry (Admin) tags: - admin - settings /api/v1/admin/cors/blacklist/{id}: delete: consumes: - application/json description: Delete a CORS blacklist entry parameters: - description: Blacklist ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Delete CORS blacklist entry (Admin) tags: - admin - settings put: consumes: - application/json description: Update an existing CORS blacklist entry parameters: - description: Blacklist ID in: path name: id required: true type: integer - description: Blacklist object in: body name: blacklist required: true schema: $ref: '#/definitions/models.CorsBlacklist' produces: - application/json responses: "200": description: OK schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Update CORS blacklist entry (Admin) tags: - admin - settings /api/v1/admin/cors/cache/invalidate: post: consumes: - application/json description: Clear the CORS cache to force reload from database produces: - application/json responses: "200": description: OK schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Invalidate CORS cache (Admin) tags: - admin - settings /api/v1/admin/cors/whitelist: get: consumes: - application/json description: Get all CORS whitelist origins produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/models.CorsWhitelist' type: array security: - BearerAuth: [] summary: Get all CORS whitelist entries (Admin) tags: - admin - settings post: consumes: - application/json description: Add a new origin to CORS whitelist parameters: - description: Whitelist object in: body name: whitelist required: true schema: $ref: '#/definitions/models.CorsWhitelist' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/models.CorsWhitelist' security: - BearerAuth: [] summary: Create CORS whitelist entry (Admin) tags: - admin - settings /api/v1/admin/cors/whitelist/{id}: delete: consumes: - application/json description: Delete a CORS whitelist entry parameters: - description: Whitelist ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Delete CORS whitelist entry (Admin) tags: - admin - settings put: consumes: - application/json description: Update an existing CORS whitelist entry parameters: - description: Whitelist ID in: path name: id required: true type: integer - description: Whitelist object in: body name: whitelist required: true schema: $ref: '#/definitions/models.CorsWhitelist' produces: - application/json responses: "200": description: OK schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Update CORS whitelist entry (Admin) tags: - admin - settings /api/v1/admin/permissions: get: consumes: - application/json description: Get list of all permissions produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/models.Permission' type: array security: - BearerAuth: [] summary: Get all permissions (Admin) tags: - admin - permissions post: consumes: - application/json description: Create a new permission parameters: - description: Permission object in: body name: permission required: true schema: $ref: '#/definitions/models.Permission' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/models.Permission' security: - BearerAuth: [] summary: Create a new permission (Admin) tags: - admin - permissions /api/v1/admin/posts: get: consumes: - application/json description: Get paginated list of all posts including inactive parameters: - default: 1 description: Page number in: query name: page type: integer - default: 10 description: Items per page in: query name: limit type: integer produces: - application/json responses: "200": description: OK schema: additionalProperties: true type: object security: - BearerAuth: [] summary: Get all posts (Admin) tags: - admin - posts post: consumes: - application/json description: Create a new post parameters: - description: Post object in: body name: post required: true schema: $ref: '#/definitions/models.Post' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/models.Post' security: - BearerAuth: [] summary: Create a new post (Admin) tags: - admin - posts /api/v1/admin/posts/{id}: delete: consumes: - application/json description: Delete a post by ID parameters: - description: Post ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Delete a post (Admin) tags: - admin - posts get: consumes: - application/json description: Get a single post by ID parameters: - description: Post ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/models.Post' security: - BearerAuth: [] summary: Get post by ID (Admin) tags: - admin - posts put: consumes: - application/json description: Update an existing post parameters: - description: Post ID in: path name: id required: true type: integer - description: Post object in: body name: post required: true schema: $ref: '#/definitions/models.Post' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/models.Post' security: - BearerAuth: [] summary: Update a post (Admin) tags: - admin - posts /api/v1/admin/rate-limits: get: consumes: - application/json description: Get all rate limit configurations produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/models.RateLimitSetting' type: array security: - BearerAuth: [] summary: Get all rate limit settings (Admin) tags: - admin - settings /api/v1/admin/rate-limits/{id}: put: consumes: - application/json description: Update an existing rate limit configuration parameters: - description: Rate Limit ID in: path name: id required: true type: integer - description: Rate limit object in: body name: setting required: true schema: $ref: '#/definitions/models.RateLimitSetting' produces: - application/json responses: "200": description: OK schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Update rate limit setting (Admin) tags: - admin - settings /api/v1/admin/roles: get: consumes: - application/json description: Get list of all roles with permissions produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/models.Role' type: array security: - BearerAuth: [] summary: Get all roles (Admin) tags: - admin - roles post: consumes: - application/json description: Create a new role parameters: - description: Role object in: body name: role required: true schema: $ref: '#/definitions/models.Role' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/models.Role' security: - BearerAuth: [] summary: Create a new role (Admin) tags: - admin - roles /api/v1/admin/roles/{id}: delete: consumes: - application/json description: Delete a role by ID parameters: - description: Role ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Delete a role (Admin) tags: - admin - roles get: consumes: - application/json description: Get a single role by ID parameters: - description: Role ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/models.Role' security: - BearerAuth: [] summary: Get role by ID (Admin) tags: - admin - roles put: consumes: - application/json description: Update an existing role parameters: - description: Role ID in: path name: id required: true type: integer - description: Role object in: body name: role required: true schema: $ref: '#/definitions/models.Role' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/models.Role' security: - BearerAuth: [] summary: Update a role (Admin) tags: - admin - roles /api/v1/admin/tags: get: consumes: - application/json description: Get list of all tags including inactive ones produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/models.Tag' type: array security: - BearerAuth: [] summary: Get all tags (Admin) tags: - admin - tags post: consumes: - application/json description: Create a new tag parameters: - description: Tag object in: body name: tag required: true schema: $ref: '#/definitions/models.Tag' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/models.Tag' security: - BearerAuth: [] summary: Create a new tag (Admin) tags: - admin - tags /api/v1/admin/tags/{id}: delete: consumes: - application/json description: Delete a tag by ID parameters: - description: Tag ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Delete a tag (Admin) tags: - admin - tags get: consumes: - application/json description: Get a single tag by ID parameters: - description: Tag ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/models.Tag' security: - BearerAuth: [] summary: Get tag by ID (Admin) tags: - admin - tags put: consumes: - application/json description: Update an existing tag parameters: - description: Tag ID in: path name: id required: true type: integer - description: Tag object in: body name: tag required: true schema: $ref: '#/definitions/models.Tag' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/models.Tag' security: - BearerAuth: [] summary: Update a tag (Admin) tags: - admin - tags /api/v1/admin/users: get: consumes: - application/json description: Get paginated list of all users parameters: - default: 1 description: Page number in: query name: page type: integer - default: 10 description: Items per page in: query name: limit type: integer - description: Include soft-deleted users in: query name: include_deleted type: boolean produces: - application/json responses: "200": description: OK schema: additionalProperties: true type: object security: - BearerAuth: [] summary: Get all users (Admin) tags: - admin - users post: consumes: - application/json description: Create a new user parameters: - description: User object in: body name: user required: true schema: $ref: '#/definitions/models.User' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/models.User' security: - BearerAuth: [] summary: Create a new user (Admin) tags: - admin - users /api/v1/admin/users/{id}: delete: consumes: - application/json description: Soft delete a user by ID parameters: - description: User ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Delete a user (Admin) tags: - admin - users get: consumes: - application/json description: Get a single user by ID parameters: - description: User ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/models.User' security: - BearerAuth: [] summary: Get user by ID (Admin) tags: - admin - users put: consumes: - application/json description: Update an existing user parameters: - description: User ID in: path name: id required: true type: integer - description: User object in: body name: user required: true schema: $ref: '#/definitions/models.User' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/models.User' security: - BearerAuth: [] summary: Update a user (Admin) tags: - admin - users /api/v1/admin/users/{id}/restore: post: consumes: - application/json description: Restore a soft-deleted user parameters: - description: User ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Restore a deleted user (Admin) tags: - admin - users /api/v1/admin/users/{id}/roles: post: consumes: - application/json description: Assign a role to a user parameters: - description: User ID in: path name: id required: true type: integer - description: Role ID in: body name: role_id required: true schema: type: integer produces: - application/json responses: "200": description: OK schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Assign role to user (Admin) tags: - admin - users /api/v1/admin/users/{id}/roles/{role_id}: delete: consumes: - application/json description: Remove a role from a user parameters: - description: User ID in: path name: id required: true type: integer - description: Role ID in: path name: role_id required: true type: integer produces: - application/json responses: "200": description: OK schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Remove role from user (Admin) tags: - admin - users /api/v1/auth/github: get: description: Redirect to GitHub OAuth produces: - application/json responses: {} summary: GitHub OAuth login tags: - auth - oauth /api/v1/auth/github/callback: get: description: Handle GitHub OAuth callback parameters: - description: Authorization code in: query name: code required: true type: string produces: - application/json responses: "200": description: OK schema: properties: token: type: string user: $ref: '#/definitions/models.User' type: object "400": description: Bad Request schema: properties: error: type: string type: object summary: GitHub OAuth callback tags: - auth - oauth /api/v1/auth/google: get: description: Redirect to Google OAuth produces: - application/json responses: {} summary: Google OAuth login tags: - auth - oauth /api/v1/auth/google/callback: get: description: Handle Google OAuth callback parameters: - description: Authorization code in: query name: code required: true type: string produces: - application/json responses: "200": description: OK schema: properties: token: type: string user: $ref: '#/definitions/models.User' type: object "400": description: Bad Request schema: properties: error: type: string type: object summary: Google OAuth callback tags: - auth - oauth /api/v1/auth/login: post: consumes: - application/json description: Login with email and password parameters: - description: Login credentials in: body name: request required: true schema: properties: email: type: string password: type: string type: object produces: - application/json responses: "200": description: OK schema: properties: token: type: string user: $ref: '#/definitions/models.User' type: object "400": description: Bad Request schema: properties: error: type: string type: object "401": description: Unauthorized schema: properties: error: type: string type: object summary: Login user tags: - auth /api/v1/auth/logout: post: consumes: - application/json description: Logout (client-side token removal) produces: - application/json responses: "200": description: OK schema: properties: message: type: string type: object summary: Logout user tags: - auth /api/v1/auth/me: get: consumes: - application/json description: Get current authenticated user information produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/models.User' "401": description: Unauthorized schema: properties: error: type: string type: object security: - BearerAuth: [] summary: Get current user tags: - auth /api/v1/auth/register: post: consumes: - application/json description: Create a new user account with email and password parameters: - description: Registration data in: body name: request required: true schema: properties: email: type: string password: type: string username: type: string type: object produces: - application/json responses: "201": description: Created schema: properties: token: type: string user: $ref: '#/definitions/models.User' type: object "400": description: Bad Request schema: properties: error: type: string type: object summary: Register a new user tags: - auth /api/v1/categories: get: consumes: - application/json description: Get list of all active categories (public endpoint) produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/models.Category' type: array summary: Get all active categories tags: - categories /api/v1/categories/{id}/view: post: consumes: - application/json description: Record a view event for a category (public endpoint) parameters: - description: Category ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: additionalProperties: type: string type: object summary: Track a category view tags: - category-views /api/v1/categories/{slug}: get: consumes: - application/json description: Get a single category by its slug (public endpoint) parameters: - description: Category Slug in: path name: slug required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/models.Category' summary: Get category by slug tags: - categories /api/v1/posts: get: consumes: - application/json description: Get paginated list of active posts (public endpoint) parameters: - default: 1 description: Page number in: query name: page type: integer - default: 10 description: Items per page in: query name: limit type: integer produces: - application/json responses: "200": description: OK schema: additionalProperties: true type: object summary: Get all active posts tags: - posts /api/v1/posts/{id}/comments: get: consumes: - application/json description: Get all active comments for a specific post (public endpoint) parameters: - description: Post ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/models.Comment' type: array summary: Get comments for a post tags: - comments post: consumes: - application/json description: Create a new comment (requires authentication) parameters: - description: Post ID in: path name: id required: true type: integer - description: Comment object in: body name: comment required: true schema: $ref: '#/definitions/models.Comment' produces: - application/json responses: "201": description: Created schema: $ref: '#/definitions/models.Comment' security: - BearerAuth: [] summary: Create a comment on a post tags: - comments /api/v1/posts/{slug}: get: consumes: - application/json description: Get a single post by its slug (public endpoint) parameters: - description: Post Slug in: path name: slug required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/models.Post' summary: Get post by slug tags: - posts /api/v1/tags: get: consumes: - application/json description: Get list of all active tags (public endpoint) produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/models.Tag' type: array summary: Get all active tags tags: - tags /api/v1/tags/{slug}: get: consumes: - application/json description: Get a single tag by its slug (public endpoint) parameters: - description: Tag Slug in: path name: slug required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/models.Tag' summary: Get tag by slug tags: - tags /api/v1/user/social-accounts: get: consumes: - application/json description: Get all social accounts for the authenticated user produces: - application/json responses: "200": description: OK schema: items: $ref: '#/definitions/models.SocialAccount' type: array security: - BearerAuth: [] summary: Get user's social accounts tags: - social-accounts /api/v1/user/social-accounts/{id}: delete: consumes: - application/json description: Delete a social account for the authenticated user parameters: - description: Social Account ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: OK schema: additionalProperties: type: string type: object security: - BearerAuth: [] summary: Delete a social account tags: - social-accounts securityDefinitions: BearerAuth: description: Type "Bearer" followed by a space and JWT token. in: header name: Authorization type: apiKey swagger: "2.0"