Dream Sports Users API

User management endpoints

OpenAPI Specification

dream-sports-users-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Checkmate Test Management Users API
  description: 'Comprehensive API documentation for Checkmate - a modern test case management system built with Remix, MySQL, and Drizzle ORM.


    ## Features

    - Project and Test Management

    - Test Run Execution

    - Role-Based Access Control (RBAC)

    - Google OAuth Authentication

    - Test Status Tracking and History


    ## Authentication

    All endpoints require authentication via session cookies. Users must be logged in through Google OAuth.


    ## Authorization

    Access to resources is controlled via Casbin RBAC with three role levels:

    - **Admin**: Full access to all resources

    - **User**: Can create, read, update resources

    - **Reader**: Read-only access

    '
  version: 1.0.0
  contact:
    name: Checkmate API Support
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
- url: http://localhost:3000
  description: Local development server (default port 3000, configurable via PORT env var)
- url: https://your-production-domain.com
  description: Production server (replace with your actual production URL)
security:
- cookieAuth: []
- bearerAuth: []
tags:
- name: Users
  description: User management endpoints
paths:
  /api/v1/user/details:
    get:
      tags:
      - Users
      summary: Get user details
      description: Get details of the currently authenticated user
      responses:
        '200':
          description: User details
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/User'
                  status:
                    type: integer
  /api/v1/all-users:
    get:
      tags:
      - Users
      summary: Get all users
      description: Get list of all users (Admin only)
      responses:
        '200':
          description: List of users
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/User'
                  status:
                    type: integer
        '403':
          description: Forbidden - Admin access required
  /api/v1/user/update-role:
    put:
      tags:
      - Users
      summary: Update user role
      description: Update a user's role (Admin only)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - userId
              - userType
              properties:
                userId:
                  type: integer
                userType:
                  type: string
                  enum:
                  - admin
                  - user
                  - reader
      responses:
        '200':
          description: User role updated successfully
        '403':
          description: Forbidden - Admin access required
  /api/v1/token/generate:
    post:
      tags:
      - Users
      summary: Generate API token
      description: Generate a new API token for the user
      responses:
        '200':
          description: Token generated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      token:
                        type: string
                  status:
                    type: integer
  /api/v1/token/delete:
    delete:
      tags:
      - Users
      summary: Delete API token
      description: Delete/revoke an API token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - tokenId
              properties:
                tokenId:
                  type: integer
      responses:
        '200':
          description: Token deleted successfully
components:
  schemas:
    User:
      type: object
      properties:
        userId:
          type: integer
        userName:
          type: string
        userEmail:
          type: string
          format: email
        userType:
          type: string
          enum:
          - admin
          - user
          - reader
  securitySchemes:
    cookieAuth:
      type: apiKey
      in: cookie
      name: user_session
      description: 'Session cookie from Google OAuth authentication.


        **How to get:**

        1. Navigate to /login

        2. Authenticate with Google

        3. Cookie is automatically set


        **Usage:**

        - Browsers automatically include this cookie

        - cURL: Use `-b cookies.txt` or `-H "Cookie: user_session=value"`

        '
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Token
      description: 'API token authentication for programmatic access.


        **How to get:**

        1. Login via web interface

        2. Call POST /api/v1/token/generate with your userId

        3. Copy the returned token


        **Usage:**

        - Include in Authorization header: `Bearer your_token_here`

        - Example: `Authorization: Bearer abc123xyz`

        '