fix: add CustomTriggersAutomation poller type
This commit is contained in:
parent
493f4232df
commit
2788962ac7
3 changed files with 26 additions and 8 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
const { GraphQLJSONObject } = require('graphql-type-json')
|
|
||||||
const _ = require('lodash/fp')
|
const _ = require('lodash/fp')
|
||||||
const nmd = require('nano-markdown')
|
const nmd = require('nano-markdown')
|
||||||
|
|
||||||
|
|
@ -296,7 +295,6 @@ const terms = (parent, { currentConfigVersion, currentHash }, { deviceId, settin
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
JSONObject: GraphQLJSONObject,
|
|
||||||
Query: {
|
Query: {
|
||||||
configs,
|
configs,
|
||||||
terms,
|
terms,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
const { gql } = require('apollo-server-express')
|
const { gql } = require('apollo-server-express')
|
||||||
module.exports = gql`
|
module.exports = gql`
|
||||||
scalar JSONObject
|
|
||||||
|
|
||||||
type Coin {
|
type Coin {
|
||||||
cryptoCode: String!
|
cryptoCode: String!
|
||||||
display: String!
|
display: String!
|
||||||
|
|
@ -51,6 +49,21 @@ type SpeedtestFile {
|
||||||
size: Int!
|
size: Int!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# True if automatic, False otherwise
|
||||||
|
type TriggersAutomation {
|
||||||
|
sanctions: Boolean!
|
||||||
|
idCardPhoto: Boolean!
|
||||||
|
idCardData: Boolean!
|
||||||
|
facephoto: Boolean!
|
||||||
|
usSsn: Boolean!
|
||||||
|
custom: [CustomTriggersAutomation]
|
||||||
|
}
|
||||||
|
|
||||||
|
type CustomTriggersAutomation {
|
||||||
|
id: ID!
|
||||||
|
type: String!
|
||||||
|
}
|
||||||
|
|
||||||
type CustomScreen {
|
type CustomScreen {
|
||||||
text: String!
|
text: String!
|
||||||
title: String!
|
title: String!
|
||||||
|
|
@ -122,7 +135,7 @@ type StaticConfig {
|
||||||
speedtestFiles: [SpeedtestFile!]!
|
speedtestFiles: [SpeedtestFile!]!
|
||||||
urlsToPing: [String!]!
|
urlsToPing: [String!]!
|
||||||
|
|
||||||
triggersAutomation: JSONObject!
|
triggersAutomation: TriggersAutomation!
|
||||||
triggers: [Trigger!]!
|
triggers: [Trigger!]!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
const _ = require('lodash/fp')
|
const _ = require('lodash/fp')
|
||||||
|
const { validate } = require('uuid')
|
||||||
|
|
||||||
const namespaces = {
|
const namespaces = {
|
||||||
ADVANCED: 'advanced',
|
ADVANCED: 'advanced',
|
||||||
|
|
@ -126,17 +127,23 @@ const getTriggersAutomation = (customInfoRequests, config) => {
|
||||||
idCardPhoto: defaultAutomation,
|
idCardPhoto: defaultAutomation,
|
||||||
idCardData: defaultAutomation,
|
idCardData: defaultAutomation,
|
||||||
facephoto: defaultAutomation,
|
facephoto: defaultAutomation,
|
||||||
usSsn: defaultAutomation
|
usSsn: defaultAutomation,
|
||||||
|
custom: []
|
||||||
}
|
}
|
||||||
|
|
||||||
_.forEach(it => {
|
_.forEach(it => {
|
||||||
requirements[it.id] = defaultAutomation
|
requirements.custom.push({ id: it.id, type: defaultAutomation })
|
||||||
}, infoRequests)
|
}, infoRequests)
|
||||||
|
|
||||||
const overrides = _.get('triggersConfig_overrides')(config)
|
const overrides = _.get('triggersConfig_overrides')(config)
|
||||||
|
|
||||||
const requirementsOverrides = _.reduce((acc, override) => {
|
const requirementsOverrides = _.reduce((acc, override) => {
|
||||||
return _.assign(acc, { [override.requirement]: override.automation })
|
return _.assign(
|
||||||
|
acc,
|
||||||
|
!validate(override.requirement)
|
||||||
|
? { [override.requirement]: override.automation }
|
||||||
|
: { custom: [...acc.custom ?? [], { id: override.requirement, type: override.automation }] }
|
||||||
|
)
|
||||||
}, {}, overrides)
|
}, {}, overrides)
|
||||||
|
|
||||||
return _.assign(requirements, requirementsOverrides)
|
return _.assign(requirements, requirementsOverrides)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue