From f9e7631eee4551c3a8253f20838aad038cb68e6f Mon Sep 17 00:00:00 2001 From: siiky Date: Mon, 28 Nov 2022 18:09:57 +0000 Subject: [PATCH 1/2] fix: GraphQL types of `TriggersAutomation` --- lib/graphql/resolvers.js | 1 - lib/graphql/types.js | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/graphql/resolvers.js b/lib/graphql/resolvers.js index d574565b..0652046c 100644 --- a/lib/graphql/resolvers.js +++ b/lib/graphql/resolvers.js @@ -142,7 +142,6 @@ const staticConfig = ({ currentConfigVersion, deviceId, deviceName, pq, settings speedtestFiles, urlsToPing, }), - _.update('triggersAutomation', _.mapValues(_.eq('Automatic'))), addOperatorInfo(operatorInfo), addReceiptInfo(receiptInfo) )(staticConf)) diff --git a/lib/graphql/types.js b/lib/graphql/types.js index 49fb64bb..64e79490 100644 --- a/lib/graphql/types.js +++ b/lib/graphql/types.js @@ -51,12 +51,12 @@ type SpeedtestFile { # True if automatic, False otherwise type TriggersAutomation { - sanctions: Boolean! - idCardPhoto: Boolean! - idCardData: Boolean! - facephoto: Boolean! - usSsn: Boolean! - custom: [CustomTriggersAutomation] + sanctions: String! + idCardPhoto: String! + idCardData: String! + facephoto: String! + usSsn: String! + custom: [CustomTriggersAutomation]! } type CustomTriggersAutomation { From b9a6a55622e9f7cf6654aad407852c83130d06ca Mon Sep 17 00:00:00 2001 From: siiky Date: Mon, 28 Nov 2022 18:25:06 +0000 Subject: [PATCH 2/2] refactor: use an enum instead of strings --- lib/graphql/types.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/graphql/types.js b/lib/graphql/types.js index 64e79490..ef4ce904 100644 --- a/lib/graphql/types.js +++ b/lib/graphql/types.js @@ -49,19 +49,23 @@ type SpeedtestFile { size: Int! } -# True if automatic, False otherwise -type TriggersAutomation { - sanctions: String! - idCardPhoto: String! - idCardData: String! - facephoto: String! - usSsn: String! - custom: [CustomTriggersAutomation]! +enum TriggerAutomationType { + Automatic + Manual } type CustomTriggersAutomation { id: ID! - type: String! + type: TriggerAutomationType! +} + +type TriggersAutomation { + sanctions: TriggerAutomationType! + idCardPhoto: TriggerAutomationType! + idCardData: TriggerAutomationType! + facephoto: TriggerAutomationType! + usSsn: TriggerAutomationType! + custom: [CustomTriggersAutomation]! } type CustomScreen {