POI GraphQL API

query { getUsers( opts: { curPage: 1, perPage: 30, q: "", sort: "-dateCreated", group: 2 } ) { users { id, email, fullName }, meta { curPage, perPage, totalPages, totalResults } } }

query { login( input: { userName: "admin@localhost.local", password: "12" } ) { user, token } }

mutation { createUser( input: { email: "alibaba@localhost.local", password: "1", fullName: "Alibaba", isSuperUser: 1, isStaff: 3, status: 3, isVerified: 3, verifyType: 1, isProfileUpdated: 3, groups: [1] } ) { id, fullName } }

Upload file with GraphQL example curl

` curl localhost:9000/graphql
-F operations='{ "query": "mutation ($file: Upload!) { singleUpload(file: $file) { id } }", "variables": { "file": null } }'
-F map='{ "0": ["variables.file"] }' \ -F 0=@prosody.txt

`

Mysql to Elasticsearch

  • Enable mysql binlog
  • Using golang to sync mysql to elasticsearch (automatic) - go-mysql-elasticsearch -config=river.toml

SQL migration

  • go get -v github.com/rubenv/sql-migrate/...
  • sql-migrate up --help

Format ts file using prettier config

  • prettier --config ./.prettierrc --write "src/*/.ts"

Fix node-gyp install fail centos 6

  • remove bcryptjs, node-python-hashser package

Pm2 (Fork mode)

  • pm2 start --name api npm -- start

Elasticsearch dead lock subsys

  • rm -rf /var/lock/subsys/elasticsearch
  • Stop -> Remove Subsys -> Start

pm2 start --name api-poi npm -- start --interpreter=~/.nvm/versions/node/v10.20.1/bin/npm