From 5486937f041980448624d4c7938e46542f25cace Mon Sep 17 00:00:00 2001 From: Christopher Li Date: Thu, 13 Jun 2024 17:51:50 -0400 Subject: [PATCH 1/2] Add GB_GEO to compliance reasons --- ...0613174832_add_gb_to_compliance_reasons.ts | 19 +++++++++++++++++++ .../src/types/compliance-status-types.ts | 1 + .../helpers/compliance/compliance-utils.ts | 2 ++ 3 files changed, 22 insertions(+) create mode 100644 indexer/packages/postgres/src/db/migrations/migration_files/20240613174832_add_gb_to_compliance_reasons.ts diff --git a/indexer/packages/postgres/src/db/migrations/migration_files/20240613174832_add_gb_to_compliance_reasons.ts b/indexer/packages/postgres/src/db/migrations/migration_files/20240613174832_add_gb_to_compliance_reasons.ts new file mode 100644 index 0000000000..c83af715f3 --- /dev/null +++ b/indexer/packages/postgres/src/db/migrations/migration_files/20240613174832_add_gb_to_compliance_reasons.ts @@ -0,0 +1,19 @@ +import * as Knex from 'knex'; + +import { formatAlterTableEnumSql } from '../helpers'; + +export async function up(knex: Knex): Promise { + return knex.raw(formatAlterTableEnumSql( + 'compliance_status', + 'reason', + ['MANUAL', 'US_GEO', 'CA_GEO', 'GB_GEO', 'SANCTIONED_GEO', 'COMPLIANCE_PROVIDER'], + )); +} + +export async function down(knex: Knex): Promise { + return knex.raw(formatAlterTableEnumSql( + 'compliance_status', + 'reason', + ['MANUAL', 'US_GEO', 'CA_GEO', 'SANCTIONED_GEO', 'COMPLIANCE_PROVIDER'], + )); +} diff --git a/indexer/packages/postgres/src/types/compliance-status-types.ts b/indexer/packages/postgres/src/types/compliance-status-types.ts index 2c2927da2f..e5099ff073 100644 --- a/indexer/packages/postgres/src/types/compliance-status-types.ts +++ b/indexer/packages/postgres/src/types/compliance-status-types.ts @@ -6,6 +6,7 @@ export enum ComplianceReason { MANUAL = 'MANUAL', US_GEO = 'US_GEO', CA_GEO = 'CA_GEO', + GB_GEO = 'GB_GEO', SANCTIONED_GEO = 'SANCTIONED_GEO', COMPLIANCE_PROVIDER = 'COMPLIANCE_PROVIDER', } diff --git a/indexer/services/comlink/src/helpers/compliance/compliance-utils.ts b/indexer/services/comlink/src/helpers/compliance/compliance-utils.ts index 7aead50b20..09d25949e0 100644 --- a/indexer/services/comlink/src/helpers/compliance/compliance-utils.ts +++ b/indexer/services/comlink/src/helpers/compliance/compliance-utils.ts @@ -10,6 +10,8 @@ export function getGeoComplianceReason( return ComplianceReason.US_GEO; } else if (country === 'CA') { return ComplianceReason.CA_GEO; + } else if (country === 'GB') { + return ComplianceReason.GB_GEO; } else { return ComplianceReason.SANCTIONED_GEO; } From 917f87827da8fe2740bd19fc1538aecad720d02f Mon Sep 17 00:00:00 2001 From: Christopher Li Date: Tue, 18 Jun 2024 13:53:33 -0400 Subject: [PATCH 2/2] tests --- indexer/services/comlink/public/api-documentation.md | 1 + indexer/services/comlink/public/swagger.json | 1 + 2 files changed, 2 insertions(+) diff --git a/indexer/services/comlink/public/api-documentation.md b/indexer/services/comlink/public/api-documentation.md index 5ba0f86b23..6341cfa62b 100644 --- a/indexer/services/comlink/public/api-documentation.md +++ b/indexer/services/comlink/public/api-documentation.md @@ -3575,6 +3575,7 @@ This operation does not require authentication |*anonymous*|MANUAL| |*anonymous*|US_GEO| |*anonymous*|CA_GEO| +|*anonymous*|GB_GEO| |*anonymous*|SANCTIONED_GEO| |*anonymous*|COMPLIANCE_PROVIDER| diff --git a/indexer/services/comlink/public/swagger.json b/indexer/services/comlink/public/swagger.json index e3109df206..a4016b7206 100644 --- a/indexer/services/comlink/public/swagger.json +++ b/indexer/services/comlink/public/swagger.json @@ -350,6 +350,7 @@ "MANUAL", "US_GEO", "CA_GEO", + "GB_GEO", "SANCTIONED_GEO", "COMPLIANCE_PROVIDER" ],