---
common:
    alias: reports_alias_python3
    namespace: reports_namespace_python
    name: Шаблон отчётов - Python3
    description: Шаблон отчётов - Python3
parameters:
    - name: from
      description: Дата начала отчётного периода
      type: date
      default: 2021-08-17T00:00:00.0000000Z
    - name: to
      description: Дата окончания отчётного периода
      type: date
      default: 2025-08-23T00:00:00.0000000Z
    - name: category2
      description: Наименование события журнала аудита2
      type: string
      default: Текстовое поле
    - name: num1
      description: num1-description
      type: number
      default: 1
datasources:
    platform:
        - name: templatesPage
          service: reporting_module
          method: api/reports/templates/get/page
          authentication:
            clientID: demo-test
            grantType: delegation
    graphql:
        - name: auditCount
          endpoint: https://proxy.pmd.local/services/auditservice/graphql/
          query: |
            query($category: String, $from: DateTime, $to: DateTime) {
                get(journalName: "BPMS",
                    where: {
                        eventType: { eq: $category }
                        eventDateTime: { gte: $from }
                        and: {
                            eventDateTime: { lte: $to }
                        }
                    }) {
                        totalCount
                }
            }
        - name: audit
          endpoint: https://proxy.pmd.local/services/auditservice/graphql/
          query: |
            query($category: String, $from: DateTime, $to: DateTime) {
                get(journalName: "BPMS",
                    where: {
                        eventType: { eq: $category }
                        eventDateTime: { gte: $from }
                        and: {
                            eventDateTime: { lte: $to }
                        }
                    },
                    order: { eventDateTime: ASC }) {
                        nodes {
                            result
                            eventDateTime
                            source
                            login
                            description
                        }
                }
            }

script: __result__ = str(__data__)

