swagger: '2.0'
info:
  title: Audit Logs API
  description: Endpoints for audit logging across meetings and other modules.
  version: v1
host: eboard.devsgraphics.com
schemes:
- https
basePath: /api/audit
consumes:
- application/json
produces:
- application/json
securityDefinitions:
  Basic:
    type: basic
security:
- Basic: []
paths:
  /logs/:
    get:
      operationId: logs_list
      summary: List audit logs
      description: Admins see all logs. Non-admin authenticated users are automatically
        scoped to their own activity.
      parameters:
      - name: search
        in: query
        description: Search in action text
        type: string
      - name: ordering
        in: query
        description: Which field to use when ordering the results.
        required: false
        type: string
      - name: me
        in: query
        description: If true, return only the current user's logs
        type: boolean
      - name: user
        in: query
        description: Filter by user ID (admin only)
        type: integer
      - name: event_type
        in: query
        description: Filter by event type (create/update/delete/login/logout/workflow/access/export/other)
        type: string
      - name: app_label
        in: query
        description: Filter by app label (e.g. meetings, resolutions, documents)
        type: string
      - name: content_type
        in: query
        description: Filter by content type model name (e.g. resolution, meeting)
        type: string
      - name: object_id
        in: query
        description: Filter by linked object ID
        type: string
      - name: from
        in: query
        description: Start date YYYY-MM-DD
        type: string
      - name: to
        in: query
        description: End date YYYY-MM-DD
        type: string
      responses:
        '200':
          description: ''
          schema:
            type: array
            items:
              $ref: '#/definitions/AuditLog'
      tags:
      - Audit Logs
    parameters: []
  /logs/mine/:
    get:
      operationId: logs_mine
      summary: My audit trail
      description: Returns the current authenticated user's own audit log entries.
        Supports the same filters as the main list (except ?user=).
      parameters:
      - name: search
        in: query
        description: Search in action text
        type: string
      - name: ordering
        in: query
        description: Which field to use when ordering the results.
        required: false
        type: string
      - name: me
        in: query
        description: If true, return only the current user's logs
        type: boolean
      - name: event_type
        in: query
        description: Filter by event type (create/update/delete/login/logout/workflow/access/export/other)
        type: string
      - name: app_label
        in: query
        description: Filter by app label (e.g. meetings, resolutions, documents)
        type: string
      - name: content_type
        in: query
        description: Filter by content type model name (e.g. resolution, meeting)
        type: string
      - name: object_id
        in: query
        description: Filter by linked object ID
        type: string
      - name: from
        in: query
        description: Start date YYYY-MM-DD
        type: string
      - name: to
        in: query
        description: End date YYYY-MM-DD
        type: string
      responses:
        '200':
          description: ''
          schema:
            type: array
            items:
              $ref: '#/definitions/AuditLog'
      tags:
      - Audit Logs
    parameters: []
  /logs/summary/:
    get:
      operationId: logs_summary
      summary: Audit log summary stats
      description: Counts grouped by event_type and app_label for the visible scope.
      parameters:
      - name: search
        in: query
        description: Search in action text
        type: string
      - name: ordering
        in: query
        description: Which field to use when ordering the results.
        required: false
        type: string
      - name: me
        in: query
        description: If true, return only the current user's logs
        type: boolean
      - name: user
        in: query
        description: Filter by user ID (admin only)
        type: integer
      - name: event_type
        in: query
        description: Filter by event type (create/update/delete/login/logout/workflow/access/export/other)
        type: string
      - name: app_label
        in: query
        description: Filter by app label (e.g. meetings, resolutions, documents)
        type: string
      - name: content_type
        in: query
        description: Filter by content type model name (e.g. resolution, meeting)
        type: string
      - name: object_id
        in: query
        description: Filter by linked object ID
        type: string
      - name: from
        in: query
        description: Start date YYYY-MM-DD
        type: string
      - name: to
        in: query
        description: End date YYYY-MM-DD
        type: string
      responses:
        '200':
          description: ''
          schema:
            type: array
            items:
              $ref: '#/definitions/AuditLog'
      tags:
      - Audit Logs
    parameters: []
  /logs/{id}/:
    get:
      operationId: logs_read
      summary: Retrieve an audit log entry
      description: |-
        Audit log endpoints.

        - **Admins** can view all logs with any filter.
        - **Authenticated users** can only view their own logs (`?me=true` is
          implicit for non-admins). Use `GET /mine/` as a convenient shortcut.
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/AuditLog'
      tags:
      - Audit Logs
    parameters:
    - name: id
      in: path
      required: true
      type: string
definitions:
  AuditLog:
    type: object
    properties:
      id:
        title: Id
        type: string
        format: uuid
        readOnly: true
      user:
        title: User
        description: User who performed the action
        type: integer
        readOnly: true
        x-nullable: true
      user_display:
        title: User display
        type: string
        readOnly: true
      action:
        title: Action
        description: Short description of the action
        type: string
        readOnly: true
        minLength: 1
      event_type:
        title: Event type
        description: Broad category of the event
        type: string
        enum:
        - create
        - update
        - delete
        - login
        - logout
        - workflow
        - access
        - export
        - other
        readOnly: true
      app_label:
        title: App label
        description: App that generated the event (e.g. meetings, resolutions)
        type: string
        readOnly: true
        minLength: 1
      timestamp:
        title: Timestamp
        type: string
        format: date-time
        readOnly: true
      content_type:
        title: Content type
        type: integer
        readOnly: true
        x-nullable: true
      content_type_display:
        title: Content type display
        type: string
        readOnly: true
      object_id:
        title: Object id
        type: string
        readOnly: true
        minLength: 1
        x-nullable: true
      object_display:
        title: Object display
        type: string
        readOnly: true
      ip_address:
        title: Ip address
        type: string
        readOnly: true
        minLength: 1
        x-nullable: true
      metadata:
        title: Metadata
        description: Extra context (status before/after, IDs, etc.)
        type: object
        readOnly: true
