Açıklama Yok

Stephen Wong 44c768af50 check url is not null 1 yıl önce
environment df4f249e24 updated distributed query module - part2 2 yıl önce
public f4f8b695e3 added graphql and jade 2 yıl önce
scratch ba8350f0ea login and logout 2 yıl önce
src 44c768af50 check url is not null 1 yıl önce
test 0b033f972a first commit 3 yıl önce
views 04f498fe8f support large response 1 yıl önce
.env c30caa5fa8 added header jade 1 yıl önce
.eslintrc.js 0b033f972a first commit 3 yıl önce
.gitignore 0b033f972a first commit 3 yıl önce
.gitmodules 07010f098d Domain proxy integration + login fix 1 yıl önce
.prettierrc 0b033f972a first commit 3 yıl önce
README.md d682919acf Domain proxy integration + login fix 1 yıl önce
codegen.yml 29a9a37f66 add graphql codegen 2 yıl önce
nest-cli.json 0b033f972a first commit 3 yıl önce
package-lock.json 2f2d9004ad Updated package and fix setting for start. 1 yıl önce
package.json ba9233453d Updated package setting. 1 yıl önce
schema.gql 29a9a37f66 add graphql codegen 2 yıl önce
tsconfig.build.json 0b033f972a first commit 3 yıl önce
tsconfig.json a3cca0b121 added graphql and jade 2 yıl önce

README.md

Microservice - CQRS with GraphQL and SubscriberProxy

OVERVIEW

The role for microservice - CQRS is responsible to handle the request and response in between client and graphQL server. It's also manipulate the standard fisApp request/response.

FisApp API is the main way to request and response the data. The data can be consist of Account Profile, Invoice,

REQUEST

NOTE: PAYLOAD will be graphQL QUERY

Method 1 - DataService Request (HTTP API)

Request without fisApp header(simplified request)

HTTP API POST Request

 POST   http://swopt.com:3011/api/request

POST Request DATA - RAW JSON(application/json)

Header

{
  "header": {
    "messageType": "Query",
    "messageID": "942ecfe2-8734-4cff-998e-6a2a5a39c464",
    "messageName": "Query",
    "dateCreated": "2022-03-11T02:19:50.923Z",
    "isAggregate": false,
    "messageProducerInformation": {
      "origin": {
        "userApplication": {
          "userAppId": "getQueryMessage",
          "userAppName": "Client"
        }
      },
      "components": "Presentation"
    },
    "security": {
      "ucpId": "ABC"
    },
    "messageDataLocation": {
      "isEmbaded": true
    },
    "messageDataFormat": {
      "dataFormat": "Json"
    },
    "requestExecutionMode": 0,
    "resquestTimeOut": 0,
    "query": "General"
  }
}
Payload

query demo{
        APAccountProfileQuery{
          SummaryResponse{
            __typename
            returnFormatType
          }
          StatusResponse{
            __typename
            status
          }
          APAccountProfileMessage{
            __typename
            data{
              acct_id
              acct_no
            }
          }
        }
      }
SAMPLE - Header with Payload

{
    header: '{  "header": {    "messageType": "Query",    "messageID": "942ecfe2-8734-4cff-998e-6a2a5a39c464",    "messageName": "Query",    "dateCreated": "2022-03-11T02:19:50.923Z",    "isAggregate": false,    "messageProducerInformation": {      "origin": {        "userApplication": {
      "userAppId": "getQueryMessage",          "userAppName": "Client"        }      },      "components": "Presentation"    },    "security": {
    "ucpId": "ABC"    },    "messageDataLocation": {      "isEmbaded": true    },    "messageDataFormat": {      "dataFormat": "Json"    },    "requestExecutionMode": 0,    "resquestTimeOut": 0,    "query": "General"  }}',
    payload: 'query APAccountProfile {            APAccountProfile {              className              filter              returnFormatType
         returnSequenceTotal              returnSequenceNumber              data {                acct_id                acct_no                acct_name                acct_type              }            }          }'
  }


Method 2 - fisApp Dataservice request (HTTP API)

Request without login

 POST   http://swopt.com:3011/api/default

Request with login

 POST   http://swopt.com:3011/request

Request with fisApp header

{
  "header": {
    "messageType": "Query",
    "messageID": "942ecfe2-8734-4cff-998e-6a2a5a39c464",
    "messageName": "Query",
    "dateCreated": "2022-03-11T02:19:50.923Z",
    "isAggregate": false,
    "messageProducerInformation": {
      "origin": {
        "userApplication": {
          "userAppId": "getQueryMessage",
          "userAppName": "Client"
        }
      },
      "components": "Presentation"
    },
    "security": {
      "ucpId": "ABC"
    },
    "messageDataLocation": {
      "isEmbaded": true
    },
    "messageDataFormat": {
      "dataFormat": "Json"
    },
    "requestExecutionMode": 0,
    "resquestTimeOut": 0,
    "query": "General"
  },
  "data":{
      "payload": "query demo { APAccountProfileQuery {    SummaryResponse{  __typename  returnFormatType }    StatusResponse {  __typename  status }     APAccountProfileMessage{  data { acct_id acct_no acct_name acct_type   } } } } "
  }
}

Method 3 - HTTP Playground with graphQL API request

Access to below url is to play around the request and response. left textarea is to paste in the fisApp with header(example as below), the response will be shown in the right textarea column.

 GET   http://swopt.com:3011/graphqlapi

Default dataservice REQUEST:

{
  "header": {
    "messageType": "Query",
    "messageID": "942ecfe2-8734-4cff-998e-6a2a5a39c464",
    "messageName": "Query",
    "dateCreated": "2022-03-11T02:19:50.923Z",
    "isAggregate": false,
    "messageProducerInformation": {
      "origin": {
        "userApplication": {
          "userAppId": "getQueryMessage",
          "userAppName": "Client"
        }
      },
      "components": "Presentation"
    },
    "security": {
      "ucpId": "ABC"
    },
    "messageDataLocation": {
      "isEmbaded": true
    },
    "messageDataFormat": {
      "dataFormat": "Json"
    },
    "requestExecutionMode": 0,
    "resquestTimeOut": 0,
    "query": "General"
  },
  "data":{
      "payload": "query demo { APAccountProfileQuery {    SummaryResponse{  __typename  returnFormatType }    StatusResponse {  __typename  status }     APAccountProfileMessage{  data { acct_id acct_no acct_name acct_type   } } } } "
  }
}

DEFINITION - DATASERVICE

Property Type Description
className String REQUIRED: define which dataservice data want to retrieve
filter String OPTIONAL : The filter for the getData function will be in key=value; key=value; pair format where key refers to column name.
returnFormatType String OPTIONAL: byRow , byBatchOf5, byBatchOf10 or full

SAMPLE GRAPHQL SCHEMA

query
    dataservice($className: String!,
                $filter: String!,
                $returnFormatType: String!)
    {
        dataservice(className: $className,
                    filter: $filter,
                    returnFormatType: $returnFormatType)
                    {
                        filter,
                        className,
                        returnFormatType,
                        returnSequenceTotal,
                        returnSequenceNumber,
                        data

                    }
    }

SAMPLE REQUEST

    "data": {
        "type": "dataservice",
        "className": "APAccountProfileDataService",
        "returnFormatType": "byRow"
    }

========================================================

RESPONSE

type DataService {
    className: String!
    data: String!
    filter: String!
    returnFormatType: String!
    returnSequenceNumber: Float!
    returnSequenceTotal: Float!
}
Property Description
classname same as request className
data responsed data
filter same as request
returnFormatType same as requested returnFormatType
returnSequenceTotal refer to the total number of responses
returnSequenceNumber refer to the response number start from 1 to total number of response.

SETUP GUIDE

GraphQL Codegen

GraphQL codegen is to generate the code from Graphql schema to typescript code.

# to run the graphql codegen
npm run generate

# typescript code will be generated/updated at:
.../src/generated/graphql.ts

========================================================

Installation

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod


Tips

Fix : Filename too long

git config --system core.longpaths true
git submodule sync --recursive
git submodule deinit --all -f
git submodule update --init --recursive