@things-factory/integration-pos 8.0.6 → 9.0.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -13
- package/server/controllers/index.ts +0 -3
- package/server/controllers/pos-api/decorators.ts +0 -44
- package/server/controllers/pos-api/index.ts +0 -40
- package/server/controllers/xilnex/apis/get-outlet.ts +0 -14
- package/server/controllers/xilnex/apis/get-outlets.ts +0 -20
- package/server/controllers/xilnex/apis/index.ts +0 -1
- package/server/controllers/xilnex/index.ts +0 -8
- package/server/controllers/xilnex/platform-action.ts +0 -42
- package/server/controllers/xilnex/xilnex.ts +0 -123
- package/server/engine/connector/index.ts +0 -1
- package/server/engine/connector/pos-connector.ts +0 -33
- package/server/engine/index.ts +0 -2
- package/server/engine/task/index.ts +0 -1
- package/server/engine/task/pos-api.ts +0 -64
- package/server/entities/index.ts +0 -5
- package/server/entities/pos-store.ts +0 -76
- package/server/graphql/index.ts +0 -7
- package/server/graphql/resolvers/index.ts +0 -6
- package/server/graphql/resolvers/pos/create-pos-store.ts +0 -16
- package/server/graphql/resolvers/pos/delete-pos-store.ts +0 -20
- package/server/graphql/resolvers/pos/delete-pos-stores.ts +0 -25
- package/server/graphql/resolvers/pos/index.ts +0 -25
- package/server/graphql/resolvers/pos/pos-store.ts +0 -14
- package/server/graphql/resolvers/pos/pos-stores.ts +0 -15
- package/server/graphql/resolvers/pos/update-multiple-pos-stores.ts +0 -44
- package/server/graphql/resolvers/pos/update-pos-store.ts +0 -18
- package/server/graphql/resolvers/pos/xilnex/deactivate-xilnex-store.ts +0 -28
- package/server/graphql/resolvers/pos/xilnex/generate-xilnex-access-token.ts +0 -30
- package/server/graphql/resolvers/pos/xilnex/index.ts +0 -9
- package/server/graphql/resolvers/pos-api/index.ts +0 -8
- package/server/graphql/resolvers/pos-api/pos-outlet.ts +0 -24
- package/server/graphql/types/index.ts +0 -19
- package/server/graphql/types/pos/index.ts +0 -44
- package/server/graphql/types/pos/new-pos-store.ts +0 -11
- package/server/graphql/types/pos/pos-store-list.ts +0 -8
- package/server/graphql/types/pos/pos-store-patch.ts +0 -13
- package/server/graphql/types/pos/pos-store.ts +0 -20
- package/server/graphql/types/pos-api/pos-outlet.ts +0 -43
- package/server/index.ts +0 -9
- package/server/migrations/index.ts +0 -9
- package/server/routes.ts +0 -7
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { getRepository } from '@things-factory/shell'
|
|
2
|
-
|
|
3
|
-
import { PosStore } from '../../../entities'
|
|
4
|
-
|
|
5
|
-
export const updateMultiplePosStore = {
|
|
6
|
-
async updateMultiplePosStore(_: any, { patches }, context: ResolverContext) {
|
|
7
|
-
let results = []
|
|
8
|
-
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
|
9
|
-
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
|
10
|
-
const posStoreRepo = getRepository(PosStore)
|
|
11
|
-
|
|
12
|
-
if (_createRecords.length > 0) {
|
|
13
|
-
for (let i = 0; i < _createRecords.length; i++) {
|
|
14
|
-
const newRecord = _createRecords[i]
|
|
15
|
-
|
|
16
|
-
const result = await posStoreRepo.save({
|
|
17
|
-
...newRecord,
|
|
18
|
-
domain: context.state.domain,
|
|
19
|
-
creator: context.state.user,
|
|
20
|
-
updater: context.state.user
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
results.push({ ...result, cuFlag: '+' })
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (_updateRecords.length > 0) {
|
|
28
|
-
for (let i = 0; i < _updateRecords.length; i++) {
|
|
29
|
-
const newRecord = _updateRecords[i]
|
|
30
|
-
const store: PosStore = await posStoreRepo.findOneBy({ id: newRecord.id })
|
|
31
|
-
|
|
32
|
-
const result = await posStoreRepo.save({
|
|
33
|
-
...store,
|
|
34
|
-
...newRecord,
|
|
35
|
-
updater: context.state.user
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
results.push({ ...result, cuFlag: 'M' })
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return results
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { getRepository } from '@things-factory/shell'
|
|
2
|
-
|
|
3
|
-
import { PosStore } from '../../../entities'
|
|
4
|
-
|
|
5
|
-
export const updatePosStore = {
|
|
6
|
-
async updatePosStore(_: any, { name, patch }, context: ResolverContext) {
|
|
7
|
-
const repository = getRepository(PosStore)
|
|
8
|
-
const store: any = await repository.findOne({
|
|
9
|
-
where: { domain: { id: context.state.domain.id }, name }
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
return await repository.save({
|
|
13
|
-
...store,
|
|
14
|
-
...patch,
|
|
15
|
-
updater: context.state.user
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { getRepository } from '@things-factory/shell'
|
|
2
|
-
|
|
3
|
-
import { POS_STORE_STATUS } from '../../../../controllers'
|
|
4
|
-
import { PosStore } from '../../../../entities'
|
|
5
|
-
|
|
6
|
-
export const deactivateXilnexPosStore = {
|
|
7
|
-
async deactivateXilnexPosStore(_: any, { id }, context: ResolverContext) {
|
|
8
|
-
const repository = getRepository(PosStore)
|
|
9
|
-
const store: any = await repository.findOne({
|
|
10
|
-
where: { domain: { id: context.state.domain.id }, id }
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
var patch = {
|
|
14
|
-
storeId: '',
|
|
15
|
-
accessToken: '',
|
|
16
|
-
refreshToken: '',
|
|
17
|
-
accessInfo: '',
|
|
18
|
-
countryCode: '',
|
|
19
|
-
status: POS_STORE_STATUS.INACTIVE
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return await repository.save({
|
|
23
|
-
...store,
|
|
24
|
-
...patch,
|
|
25
|
-
updater: context.state.user
|
|
26
|
-
})
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { config } from '@things-factory/env'
|
|
2
|
-
import { getRepository } from '@things-factory/shell'
|
|
3
|
-
|
|
4
|
-
import { POS_STORE_STATUS } from '../../../../controllers'
|
|
5
|
-
import { PosStore } from '../../../../entities'
|
|
6
|
-
|
|
7
|
-
const xilnexConfig = config.get('posIntegrationXilnex', {})
|
|
8
|
-
const { apiKey, apiSecret } = xilnexConfig
|
|
9
|
-
|
|
10
|
-
export const generateXilnexAccessToken = {
|
|
11
|
-
async generateXilnexAccessToken(_: any, { id, appid, token }, context: ResolverContext) {
|
|
12
|
-
const repository = getRepository(PosStore)
|
|
13
|
-
const store: any = await repository.findOne({
|
|
14
|
-
where: { domain: { id: context.state.domain.id }, id }
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
var patch = {
|
|
18
|
-
accessToken: token,
|
|
19
|
-
refreshToken: '',
|
|
20
|
-
storeId: appid,
|
|
21
|
-
status: POS_STORE_STATUS.ACTIVE
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return await repository.save({
|
|
25
|
-
...store,
|
|
26
|
-
...patch,
|
|
27
|
-
updater: context.state.user
|
|
28
|
-
})
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { deactivateXilnexPosStore } from './deactivate-xilnex-store'
|
|
2
|
-
import { generateXilnexAccessToken } from './generate-xilnex-access-token'
|
|
3
|
-
|
|
4
|
-
export const Query = {}
|
|
5
|
-
|
|
6
|
-
export const Mutation = {
|
|
7
|
-
...generateXilnexAccessToken,
|
|
8
|
-
...deactivateXilnexPosStore
|
|
9
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { POSAPI } from '../../../controllers/pos-api'
|
|
2
|
-
|
|
3
|
-
export const queryPosOutlet = {
|
|
4
|
-
async getPosOutlets(_: any, { posId, params: ListParam }, context: ResolverContext) {
|
|
5
|
-
var pos = await POSAPI.getPosStore(posId)
|
|
6
|
-
|
|
7
|
-
return await POSAPI.getOutlets(pos, {
|
|
8
|
-
pagination: {
|
|
9
|
-
page: 0,
|
|
10
|
-
limit: 100
|
|
11
|
-
}
|
|
12
|
-
})
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
async getPosOutlet(_: any, { posId, outletNo }, context: ResolverContext) {
|
|
16
|
-
var pos = await POSAPI.getPosStore(posId)
|
|
17
|
-
|
|
18
|
-
return await POSAPI.getOutlet(pos, {
|
|
19
|
-
outletNo
|
|
20
|
-
})
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const mutatePosOutlet = {}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as POS from './pos'
|
|
2
|
-
import * as Outlet from './pos-api/pos-outlet'
|
|
3
|
-
|
|
4
|
-
export const queries = [
|
|
5
|
-
POS.Query,
|
|
6
|
-
Outlet.Query
|
|
7
|
-
]
|
|
8
|
-
|
|
9
|
-
export const mutations = [
|
|
10
|
-
POS.Mutation,
|
|
11
|
-
Outlet.Mutation
|
|
12
|
-
]
|
|
13
|
-
|
|
14
|
-
export const subscriptions = []
|
|
15
|
-
|
|
16
|
-
export const types = [
|
|
17
|
-
...POS.Types,
|
|
18
|
-
...Outlet.Types
|
|
19
|
-
]
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { PosStore } from './pos-store'
|
|
2
|
-
import { NewPosStore } from './new-pos-store'
|
|
3
|
-
import { PosStorePatch } from './pos-store-patch'
|
|
4
|
-
import { PosStoreList } from './pos-store-list'
|
|
5
|
-
|
|
6
|
-
export const Mutation = `
|
|
7
|
-
createPosStore (
|
|
8
|
-
store: NewPosStore!
|
|
9
|
-
): PosStore
|
|
10
|
-
|
|
11
|
-
updatePosStore (
|
|
12
|
-
name: String!
|
|
13
|
-
patch: PosStorePatch!
|
|
14
|
-
): PosStore
|
|
15
|
-
|
|
16
|
-
updateMultiplePosStore (
|
|
17
|
-
patches: [PosStorePatch]!
|
|
18
|
-
): [PosStore]
|
|
19
|
-
|
|
20
|
-
deletePosStore (
|
|
21
|
-
name: String!
|
|
22
|
-
): Boolean
|
|
23
|
-
|
|
24
|
-
deletePosStores (
|
|
25
|
-
names: [String]!
|
|
26
|
-
): Boolean
|
|
27
|
-
|
|
28
|
-
generateXilnexAccessToken (
|
|
29
|
-
id: String!
|
|
30
|
-
appid: String!
|
|
31
|
-
token: String!
|
|
32
|
-
): PosStore
|
|
33
|
-
|
|
34
|
-
deactivateXilnexPosStore (
|
|
35
|
-
name: String!
|
|
36
|
-
): PosStore
|
|
37
|
-
`
|
|
38
|
-
|
|
39
|
-
export const Query = `
|
|
40
|
-
posStores(filters: [Filter], pagination: Pagination, sortings: [Sorting]): PosStoreList
|
|
41
|
-
posStore(id: String!): PosStore
|
|
42
|
-
`
|
|
43
|
-
|
|
44
|
-
export const Types = [PosStore, NewPosStore, PosStorePatch, PosStoreList]
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import gql from 'graphql-tag'
|
|
2
|
-
|
|
3
|
-
export const PosStore = gql`
|
|
4
|
-
type PosStore {
|
|
5
|
-
id: String
|
|
6
|
-
name: String
|
|
7
|
-
domain: Domain
|
|
8
|
-
description: String
|
|
9
|
-
platform: String
|
|
10
|
-
storeId: String
|
|
11
|
-
countryCode: String
|
|
12
|
-
status: String
|
|
13
|
-
accessToken: String
|
|
14
|
-
accessInfo: String
|
|
15
|
-
updater: User
|
|
16
|
-
creator: User
|
|
17
|
-
updatedAt: String
|
|
18
|
-
createdAt: String
|
|
19
|
-
}
|
|
20
|
-
`
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import gql from 'graphql-tag'
|
|
2
|
-
|
|
3
|
-
const PosOutletList = gql`
|
|
4
|
-
type PosOutletList {
|
|
5
|
-
items: [PosOutlet]
|
|
6
|
-
total: Int
|
|
7
|
-
}
|
|
8
|
-
`
|
|
9
|
-
|
|
10
|
-
const PosOutletPatch = gql`
|
|
11
|
-
input PosOutletPatch {
|
|
12
|
-
id: String!
|
|
13
|
-
name: String
|
|
14
|
-
description: String
|
|
15
|
-
cuFlag: String
|
|
16
|
-
}
|
|
17
|
-
`
|
|
18
|
-
|
|
19
|
-
const PosOutlet = gql`
|
|
20
|
-
type PosOutlet {
|
|
21
|
-
id: String
|
|
22
|
-
name: String
|
|
23
|
-
}
|
|
24
|
-
`
|
|
25
|
-
|
|
26
|
-
export const Mutation = `
|
|
27
|
-
`
|
|
28
|
-
|
|
29
|
-
export const Query = `
|
|
30
|
-
getPosOutlets(
|
|
31
|
-
posId: String!
|
|
32
|
-
filters: [Filter]
|
|
33
|
-
pagination: Pagination
|
|
34
|
-
sortings: [Sorting]
|
|
35
|
-
): PosOutletList
|
|
36
|
-
|
|
37
|
-
getPosOutlet(
|
|
38
|
-
posId: String!
|
|
39
|
-
outletNo: String!
|
|
40
|
-
): PosOutlet
|
|
41
|
-
`
|
|
42
|
-
|
|
43
|
-
export const Types = [PosOutlet, PosOutletPatch, PosOutletList]
|
package/server/index.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const glob = require('glob')
|
|
2
|
-
const path = require('path')
|
|
3
|
-
|
|
4
|
-
export var migrations = []
|
|
5
|
-
|
|
6
|
-
glob.sync(path.resolve(__dirname, '.', '**', '*.js')).forEach(function(file) {
|
|
7
|
-
if (file.indexOf('index.js') !== -1) return
|
|
8
|
-
migrations = migrations.concat(Object.values(require(path.resolve(file))) || [])
|
|
9
|
-
})
|