From 959cbb3e81955bde5838a6dbf13cf83d6f617c92 Mon Sep 17 00:00:00 2001 From: Eric McGarry <46828798+mcgarrye@users.noreply.github.com> Date: Tue, 10 Dec 2024 16:12:54 -0500 Subject: [PATCH] feat: feature flag migration script (#4499) * feat: adjust update functionality * feat: create feature flag script 4460 * feat: remove deprecated flags * feat: remove soon to be deprecated flag * feat: add description * feat: include enablePartnerSettings 4460 --- .../controllers/script-runner.controller.ts | 11 + .../feature-flags/feature-flag-create.dto.ts | 9 +- .../feature-flags/feature-flag-update.dto.ts | 1 + api/src/modules/script-runner.module.ts | 15 +- api/src/services/script-runner.service.ts | 134 +++++++- api/test/integration/feature-flag.e2e-spec.ts | 3 +- .../permission-as-admin.e2e-spec.ts | 1 - .../services/feature-flag.service.spec.ts | 13 +- .../services/script-runner.service.spec.ts | 50 ++- shared-helpers/src/types/backend-swagger.ts | 311 +++++++++--------- sites/partners/.env.template | 2 - sites/partners/next.config.js | 2 - 12 files changed, 375 insertions(+), 177 deletions(-) diff --git a/api/src/controllers/script-runner.controller.ts b/api/src/controllers/script-runner.controller.ts index 8abd3ef37c..09d823e3ba 100644 --- a/api/src/controllers/script-runner.controller.ts +++ b/api/src/controllers/script-runner.controller.ts @@ -184,4 +184,15 @@ export class ScirptRunnerController { ): Promise { return await this.scriptRunnerService.hideProgramsFromListings(req); } + + @Put('addFeatureFlags') + @ApiOperation({ + summary: + 'A script that adds existing feature flags into the feature flag table', + operationId: 'addFeatureFlags', + }) + @ApiOkResponse({ type: SuccessDTO }) + async addFeatureFlags(@Request() req: ExpressRequest): Promise { + return await this.scriptRunnerService.addFeatureFlags(req); + } } diff --git a/api/src/dtos/feature-flags/feature-flag-create.dto.ts b/api/src/dtos/feature-flags/feature-flag-create.dto.ts index 077b86328f..bd0d6efba1 100644 --- a/api/src/dtos/feature-flags/feature-flag-create.dto.ts +++ b/api/src/dtos/feature-flags/feature-flag-create.dto.ts @@ -1,4 +1,9 @@ import { OmitType } from '@nestjs/swagger'; -import { FeatureFlagUpdate } from './feature-flag-update.dto'; +import { FeatureFlag } from './feature-flag.dto'; -export class FeatureFlagCreate extends OmitType(FeatureFlagUpdate, ['id']) {} +export class FeatureFlagCreate extends OmitType(FeatureFlag, [ + 'id', + 'createdAt', + 'updatedAt', + 'jurisdictions', +]) {} diff --git a/api/src/dtos/feature-flags/feature-flag-update.dto.ts b/api/src/dtos/feature-flags/feature-flag-update.dto.ts index b8cffb41c3..d47e4c96d1 100644 --- a/api/src/dtos/feature-flags/feature-flag-update.dto.ts +++ b/api/src/dtos/feature-flags/feature-flag-update.dto.ts @@ -4,5 +4,6 @@ import { FeatureFlag } from './feature-flag.dto'; export class FeatureFlagUpdate extends OmitType(FeatureFlag, [ 'createdAt', 'updatedAt', + 'name', 'jurisdictions', ]) {} diff --git a/api/src/modules/script-runner.module.ts b/api/src/modules/script-runner.module.ts index 26fb5fafe3..a482fd778b 100644 --- a/api/src/modules/script-runner.module.ts +++ b/api/src/modules/script-runner.module.ts @@ -1,13 +1,20 @@ import { Module } from '@nestjs/common'; import { ScirptRunnerController } from '../controllers/script-runner.controller'; import { ScriptRunnerService } from '../services/script-runner.service'; -import { PrismaModule } from './prisma.module'; -import { PermissionModule } from './permission.module'; -import { EmailModule } from './email.module'; import { AmiChartModule } from './ami-chart.module'; +import { FeatureFlagModule } from './feature-flag.module'; +import { EmailModule } from './email.module'; +import { PermissionModule } from './permission.module'; +import { PrismaModule } from './prisma.module'; @Module({ - imports: [PrismaModule, PermissionModule, EmailModule, AmiChartModule], + imports: [ + AmiChartModule, + EmailModule, + FeatureFlagModule, + PermissionModule, + PrismaModule, + ], controllers: [ScirptRunnerController], providers: [ScriptRunnerService], exports: [ScriptRunnerService], diff --git a/api/src/services/script-runner.service.ts b/api/src/services/script-runner.service.ts index 3a4d1aa2e6..e5168ef1f1 100644 --- a/api/src/services/script-runner.service.ts +++ b/api/src/services/script-runner.service.ts @@ -7,17 +7,18 @@ import { ReviewOrderTypeEnum, } from '@prisma/client'; import { Request as ExpressRequest } from 'express'; +import { AmiChartService } from './ami-chart.service'; +import { EmailService } from './email.service'; +import { FeatureFlagService } from './feature-flag.service'; import { PrismaService } from './prisma.service'; import { SuccessDTO } from '../dtos/shared/success.dto'; import { User } from '../dtos/users/user.dto'; import { mapTo } from '../utilities/mapTo'; import { DataTransferDTO } from '../dtos/script-runner/data-transfer.dto'; import { BulkApplicationResendDTO } from '../dtos/script-runner/bulk-application-resend.dto'; -import { EmailService } from './email.service'; import { Application } from '../dtos/applications/application.dto'; import { AmiChartImportDTO } from '../dtos/script-runner/ami-chart-import.dto'; import { AmiChartCreate } from '../dtos/ami-charts/ami-chart-create.dto'; -import { AmiChartService } from './ami-chart.service'; import { AmiChartUpdate } from '../dtos/ami-charts/ami-chart-update.dto'; import { AmiChartUpdateImportDTO } from '../dtos/script-runner/ami-chart-update-import.dto'; @@ -28,9 +29,10 @@ import { AmiChartUpdateImportDTO } from '../dtos/script-runner/ami-chart-update- @Injectable() export class ScriptRunnerService { constructor( - private prisma: PrismaService, - private emailService: EmailService, private amiChartService: AmiChartService, + private emailService: EmailService, + private featureFlagService: FeatureFlagService, + private prisma: PrismaService, ) {} /** @@ -432,6 +434,31 @@ export class ScriptRunnerService { return { success: true }; } + /** + Adds all existing feature flags across Bloom to the database + */ + async addFeatureFlags(req: ExpressRequest): Promise { + const requestingUser = mapTo(User, req['user']); + await this.markScriptAsRunStart('add feature flags', requestingUser); + + const results = await Promise.all( + this.featureFlags.map(async (flag) => { + try { + await this.featureFlagService.create(flag); + } catch (e) { + console.log( + `feature flag ${flag.name} failed to be created. Error: ${e}`, + ); + } + }), + ); + + console.log(`Number of feature flags created: ${results.length}`); + + await this.markScriptAsComplete('add feature flags', requestingUser); + return { success: true }; + } + /** this is simply an example */ @@ -644,4 +671,103 @@ export class ScriptRunnerService { await updateForLanguage(LanguagesEnum.vi, viKeys); await updateForLanguage(LanguagesEnum.zh, zhKeys); } + + featureFlags = [ + { + name: 'enableSingleUseCode', + description: + 'When true, the backend allows for logging into this jurisdiction using the single use code flow', + active: false, + }, + { + name: 'enableAccessibiliyFeatures', + description: + "When true, the 'accessibility features' section is displayed in listing creation/edit and the public listing view", + active: false, + }, + { + name: 'enableGeocodingPreferences', + description: + 'When true, preferences can be created with geocoding functionality and when an application is created/updated on a listing that is geocoding then the application gets geocoded', + active: false, + }, + { + name: 'enableGeocodingRadiusMethod', + description: + 'When true, preferences can be created with geocoding functionality that verifies via a mile radius', + active: false, + }, + { + name: 'enableListingOpportunity', + description: + "When true, any newly published listing will send a gov delivery email to everyone that has signed up for the 'listing alerts'", + active: false, + }, + { + name: 'enablePartnerDemographics', + description: + 'When true, demographics data is included in application or lottery exports for partners', + active: false, + }, + { + name: 'enablePartnerSettings', + description: + "When true, the 'settings' tab in the partner site is visible", + active: false, + }, + { + name: 'enableUtilitiesIncluded', + description: + "When true, the 'utilities included' section is displayed in listing creation/edit and the public listing view", + active: false, + }, + { + name: 'exportApplicationAsSpreadsheet', + description: + 'When true, the application export is done as an Excel spreadsheet', + active: false, + }, + { + name: 'limitClosedListingActions', + description: + 'When true, availability of edit, republish, and reopen functionality is limited for closed listings', + active: false, + }, + { + name: 'showLottery', + description: + 'When true, show lottery tab on lottery listings on the partners site', + active: false, + }, + { + name: 'showMandatedAccounts', + description: + 'When true, require users to be logged in to submit an application on the public site', + active: false, + }, + { + name: 'showProfessionalPartners', + description: + 'When true, show a navigation bar link to professional partners', + active: false, + }, + { + name: 'showPublicLottery', + description: + 'When true, show lottery section on the user applications page', + active: false, + }, + { + name: 'showPwdless', + description: + "When true, show the 'get code to sign in' button on public sign in page for the pwdless flow", + active: false, + }, + { + name: 'showSmsMfa', + description: + "When true, show the 'sms' button option when a user goes through multi factor authentication", + active: false, + }, + ]; } diff --git a/api/test/integration/feature-flag.e2e-spec.ts b/api/test/integration/feature-flag.e2e-spec.ts index 2e8e22bf63..a005ab9418 100644 --- a/api/test/integration/feature-flag.e2e-spec.ts +++ b/api/test/integration/feature-flag.e2e-spec.ts @@ -106,7 +106,6 @@ describe('Feature Flag Controller Tests', () => { const body = { id: featureFlag.id, - name: `updated ${randomName()}`, description: 'updated description', active: !featureFlag.active, }; @@ -120,6 +119,7 @@ describe('Feature Flag Controller Tests', () => { expect(res.body).toEqual({ ...body, + name: featureFlag.name, jurisdictions: [], createdAt: expect.anything(), updatedAt: expect.anything(), @@ -129,7 +129,6 @@ describe('Feature Flag Controller Tests', () => { it('should error when trying to update a feature flag that does not exist', async () => { const body = { id: randomUUID(), - name: 'updated name', description: 'updated description', active: true, }; diff --git a/api/test/integration/permission-tests/permission-as-admin.e2e-spec.ts b/api/test/integration/permission-tests/permission-as-admin.e2e-spec.ts index a33a569706..3eb8f67518 100644 --- a/api/test/integration/permission-tests/permission-as-admin.e2e-spec.ts +++ b/api/test/integration/permission-tests/permission-as-admin.e2e-spec.ts @@ -1452,7 +1452,6 @@ describe('Testing Permissioning of endpoints as Admin User', () => { const body = { id: featureFlag.id, - name: 'updated name', description: 'updated description', active: !featureFlag.active, }; diff --git a/api/test/unit/services/feature-flag.service.spec.ts b/api/test/unit/services/feature-flag.service.spec.ts index 185b99f7a2..942bf906a0 100644 --- a/api/test/unit/services/feature-flag.service.spec.ts +++ b/api/test/unit/services/feature-flag.service.spec.ts @@ -149,20 +149,19 @@ describe('Testing feature flag service', () => { prisma.featureFlags.findFirst = jest.fn().mockResolvedValue(mockedValue); prisma.featureFlags.update = jest.fn().mockResolvedValue({ ...mockedValue, - name: 'updated feature flag 1', + description: 'updated feature flag 1', }); const params: FeatureFlagUpdate = { - name: 'updated feature flag 1', id: mockedValue.id, - description: mockedValue.description, + description: 'updated feature flag 1', active: mockedValue.active, }; expect(await service.update(params)).toEqual({ id: mockedValue.id, - name: 'updated feature flag 1', - description: mockedValue.description, + name: mockedValue.name, + description: 'updated feature flag 1', active: mockedValue.active, createdAt: date, updatedAt: date, @@ -177,8 +176,7 @@ describe('Testing feature flag service', () => { expect(prisma.featureFlags.update).toHaveBeenCalledWith({ data: { - name: 'updated feature flag 1', - description: mockedValue.description, + description: 'updated feature flag 1', active: mockedValue.active, }, include: { @@ -201,7 +199,6 @@ describe('Testing feature flag service', () => { const params: FeatureFlagUpdate = { id: 'example id', - name: 'example feature flag', description: 'example description', active: true, }; diff --git a/api/test/unit/services/script-runner.service.spec.ts b/api/test/unit/services/script-runner.service.spec.ts index 3365ce569a..6577a84cf1 100644 --- a/api/test/unit/services/script-runner.service.spec.ts +++ b/api/test/unit/services/script-runner.service.spec.ts @@ -8,11 +8,13 @@ import { import { randomUUID } from 'crypto'; import { Request as ExpressRequest } from 'express'; import { mockDeep } from 'jest-mock-extended'; -import { ScriptRunnerService } from '../../../src/services/script-runner.service'; -import { PrismaService } from '../../../src/services/prisma.service'; import { User } from '../../../src/dtos/users/user.dto'; -import { EmailService } from '../../../src/services/email.service'; import { AmiChartService } from '../../../src/services/ami-chart.service'; +import { EmailService } from '../../../src/services/email.service'; +import { FeatureFlagService } from '../../../src/services/feature-flag.service'; +import { JurisdictionService } from '../../../src/services/jurisdiction.service'; +import { PrismaService } from '../../../src/services/prisma.service'; +import { ScriptRunnerService } from '../../../src/services/script-runner.service'; const externalPrismaClient = mockDeep(); @@ -33,6 +35,8 @@ describe('Testing script runner service', () => { }, }, AmiChartService, + FeatureFlagService, + JurisdictionService, ], }).compile(); @@ -727,6 +731,46 @@ describe('Testing script runner service', () => { }); }); + it('should create 16 feature flags', async () => { + const id = randomUUID(); + const scriptName = 'add feature flags'; + + prisma.scriptRuns.findUnique = jest.fn().mockResolvedValue(null); + prisma.scriptRuns.create = jest.fn().mockResolvedValue(null); + prisma.scriptRuns.update = jest.fn().mockResolvedValue(null); + prisma.featureFlags.create = jest.fn().mockResolvedValue({ id: 'new id' }); + + const res = await service.addFeatureFlags({ + user: { + id, + } as unknown as User, + } as unknown as ExpressRequest); + + expect(res.success).toBe(true); + + expect(prisma.scriptRuns.findUnique).toHaveBeenCalledWith({ + where: { + scriptName, + }, + }); + expect(prisma.scriptRuns.create).toHaveBeenCalledWith({ + data: { + scriptName, + triggeringUser: id, + }, + }); + expect(prisma.scriptRuns.update).toHaveBeenCalledWith({ + data: { + didScriptRun: true, + triggeringUser: id, + }, + where: { + scriptName, + }, + }); + expect(prisma.featureFlags.create).toHaveBeenCalledTimes(16); + }); + // | ---------- HELPER TESTS BELOW ---------- | // it('should mark script run as started if no script run present in db', async () => { prisma.scriptRuns.findUnique = jest.fn().mockResolvedValue(null); diff --git a/shared-helpers/src/types/backend-swagger.ts b/shared-helpers/src/types/backend-swagger.ts index 81dd7fa5ec..4457ba98bd 100644 --- a/shared-helpers/src/types/backend-swagger.ts +++ b/shared-helpers/src/types/backend-swagger.ts @@ -2327,54 +2327,33 @@ export class ScriptRunnerService { axios(configs, resolve, reject) }) } -} - -export class LotteryService { /** - * Generate the lottery results for a listing + * A script that adds existing feature flags into the feature flag table */ - lotteryGenerate( - params: { - /** requestBody */ - body?: ApplicationCsvQueryParams - } = {} as any, - options: IRequestOptions = {} - ): Promise { + addFeatureFlags(options: IRequestOptions = {}): Promise { return new Promise((resolve, reject) => { - let url = basePath + "/lottery/generateLotteryResults" + let url = basePath + "/scriptRunner/addFeatureFlags" const configs: IRequestConfig = getConfigs("put", "application/json", url, options) - let data = params.body + let data = null configs.data = data axios(configs, resolve, reject) }) } +} + +export class FeatureFlagsService { /** - * Get applications lottery results + * List of feature flags */ - lotteryResults( - params: { - /** */ - id: string - /** */ - includeDemographics?: boolean - /** */ - timeZone?: string - } = {} as any, - options: IRequestOptions = {} - ): Promise { + list(options: IRequestOptions = {}): Promise { return new Promise((resolve, reject) => { - let url = basePath + "/lottery/getLotteryResults" + let url = basePath + "/featureFlags" const configs: IRequestConfig = getConfigs("get", "application/json", url, options) - configs.params = { - id: params["id"], - includeDemographics: params["includeDemographics"], - timeZone: params["timeZone"], - } /** 适配ios13,get请求不允许带body */ @@ -2382,19 +2361,19 @@ export class LotteryService { }) } /** - * Change the listing lottery status + * Create a feature flag */ - lotteryStatus( + create( params: { /** requestBody */ - body?: ListingLotteryStatus + body?: FeatureFlagCreate } = {} as any, options: IRequestOptions = {} - ): Promise { + ): Promise { return new Promise((resolve, reject) => { - let url = basePath + "/lottery/lotteryStatus" + let url = basePath + "/featureFlags" - const configs: IRequestConfig = getConfigs("put", "application/json", url, options) + const configs: IRequestConfig = getConfigs("post", "application/json", url, options) let data = params.body @@ -2404,36 +2383,43 @@ export class LotteryService { }) } /** - * Get a lottery activity log + * Update a feature flag */ - lotteryActivityLog( + update( params: { - /** */ - id: string + /** requestBody */ + body?: FeatureFlagUpdate } = {} as any, options: IRequestOptions = {} - ): Promise { + ): Promise { return new Promise((resolve, reject) => { - let url = basePath + "/lottery/lotteryActivityLog/{id}" - url = url.replace("{id}", params["id"] + "") + let url = basePath + "/featureFlags" - const configs: IRequestConfig = getConfigs("get", "application/json", url, options) + const configs: IRequestConfig = getConfigs("put", "application/json", url, options) - /** 适配ios13,get请求不允许带body */ + let data = params.body + + configs.data = data axios(configs, resolve, reject) }) } /** - * Trigger the lottery auto publish process job + * Delete a feature flag by id */ - autoPublishResults(options: IRequestOptions = {}): Promise { + delete( + params: { + /** requestBody */ + body?: IdDTO + } = {} as any, + options: IRequestOptions = {} + ): Promise { return new Promise((resolve, reject) => { - let url = basePath + "/lottery/autoPublishResults" + let url = basePath + "/featureFlags" - const configs: IRequestConfig = getConfigs("put", "application/json", url, options) + const configs: IRequestConfig = getConfigs("delete", "application/json", url, options) - let data = null + let data = params.body configs.data = data @@ -2441,15 +2427,21 @@ export class LotteryService { }) } /** - * Trigger the lottery expiration process job + * Associate and disassociate jurisdictions with a feature flag */ - expireLotteries(options: IRequestOptions = {}): Promise { + associateJurisdictions( + params: { + /** requestBody */ + body?: FeatureFlagAssociate + } = {} as any, + options: IRequestOptions = {} + ): Promise { return new Promise((resolve, reject) => { - let url = basePath + "/lottery/expireLotteries" + let url = basePath + "/featureFlags/associateJurisdictions" const configs: IRequestConfig = getConfigs("put", "application/json", url, options) - let data = null + let data = params.body configs.data = data @@ -2457,18 +2449,18 @@ export class LotteryService { }) } /** - * Get lottery results by application id + * Get a feature flag by id */ - publicLotteryResults( + retrieve( params: { /** */ - id: string + featureFlagId: string } = {} as any, options: IRequestOptions = {} - ): Promise { + ): Promise { return new Promise((resolve, reject) => { - let url = basePath + "/lottery/publicLotteryResults/{id}" - url = url.replace("{id}", params["id"] + "") + let url = basePath + "/featureFlags/{featureFlagId}" + url = url.replace("{featureFlagId}", params["featureFlagId"] + "") const configs: IRequestConfig = getConfigs("get", "application/json", url, options) @@ -2477,38 +2469,54 @@ export class LotteryService { axios(configs, resolve, reject) }) } +} + +export class LotteryService { /** - * Get lottery totals by listing id + * Generate the lottery results for a listing */ - lotteryTotals( + lotteryGenerate( params: { - /** */ - id: string + /** requestBody */ + body?: ApplicationCsvQueryParams } = {} as any, options: IRequestOptions = {} - ): Promise { + ): Promise { return new Promise((resolve, reject) => { - let url = basePath + "/lottery/lotteryTotals/{id}" - url = url.replace("{id}", params["id"] + "") + let url = basePath + "/lottery/generateLotteryResults" - const configs: IRequestConfig = getConfigs("get", "application/json", url, options) + const configs: IRequestConfig = getConfigs("put", "application/json", url, options) - /** 适配ios13,get请求不允许带body */ + let data = params.body + + configs.data = data axios(configs, resolve, reject) }) } -} - -export class FeatureFlagsService { /** - * List of feature flags + * Get applications lottery results */ - list(options: IRequestOptions = {}): Promise { + lotteryResults( + params: { + /** */ + id: string + /** */ + includeDemographics?: boolean + /** */ + timeZone?: string + } = {} as any, + options: IRequestOptions = {} + ): Promise { return new Promise((resolve, reject) => { - let url = basePath + "/featureFlags" + let url = basePath + "/lottery/getLotteryResults" const configs: IRequestConfig = getConfigs("get", "application/json", url, options) + configs.params = { + id: params["id"], + includeDemographics: params["includeDemographics"], + timeZone: params["timeZone"], + } /** 适配ios13,get请求不允许带body */ @@ -2516,19 +2524,19 @@ export class FeatureFlagsService { }) } /** - * Create a feature flag + * Change the listing lottery status */ - create( + lotteryStatus( params: { /** requestBody */ - body?: FeatureFlagCreate + body?: ListingLotteryStatus } = {} as any, options: IRequestOptions = {} - ): Promise { + ): Promise { return new Promise((resolve, reject) => { - let url = basePath + "/featureFlags" + let url = basePath + "/lottery/lotteryStatus" - const configs: IRequestConfig = getConfigs("post", "application/json", url, options) + const configs: IRequestConfig = getConfigs("put", "application/json", url, options) let data = params.body @@ -2538,21 +2546,36 @@ export class FeatureFlagsService { }) } /** - * Update a feature flag + * Get a lottery activity log */ - update( + lotteryActivityLog( params: { - /** requestBody */ - body?: FeatureFlagUpdate + /** */ + id: string } = {} as any, options: IRequestOptions = {} - ): Promise { + ): Promise { return new Promise((resolve, reject) => { - let url = basePath + "/featureFlags" + let url = basePath + "/lottery/lotteryActivityLog/{id}" + url = url.replace("{id}", params["id"] + "") + + const configs: IRequestConfig = getConfigs("get", "application/json", url, options) + + /** 适配ios13,get请求不允许带body */ + + axios(configs, resolve, reject) + }) + } + /** + * Trigger the lottery auto publish process job + */ + autoPublishResults(options: IRequestOptions = {}): Promise { + return new Promise((resolve, reject) => { + let url = basePath + "/lottery/autoPublishResults" const configs: IRequestConfig = getConfigs("put", "application/json", url, options) - let data = params.body + let data = null configs.data = data @@ -2560,21 +2583,15 @@ export class FeatureFlagsService { }) } /** - * Delete a feature flag by id + * Trigger the lottery expiration process job */ - delete( - params: { - /** requestBody */ - body?: IdDTO - } = {} as any, - options: IRequestOptions = {} - ): Promise { + expireLotteries(options: IRequestOptions = {}): Promise { return new Promise((resolve, reject) => { - let url = basePath + "/featureFlags" + let url = basePath + "/lottery/expireLotteries" - const configs: IRequestConfig = getConfigs("delete", "application/json", url, options) + const configs: IRequestConfig = getConfigs("put", "application/json", url, options) - let data = params.body + let data = null configs.data = data @@ -2582,40 +2599,39 @@ export class FeatureFlagsService { }) } /** - * Associate and disassociate jurisdictions with a feature flag + * Get lottery results by application id */ - associateJurisdictions( + publicLotteryResults( params: { - /** requestBody */ - body?: FeatureFlagAssociate + /** */ + id: string } = {} as any, options: IRequestOptions = {} - ): Promise { + ): Promise { return new Promise((resolve, reject) => { - let url = basePath + "/featureFlags/associateJurisdictions" - - const configs: IRequestConfig = getConfigs("put", "application/json", url, options) + let url = basePath + "/lottery/publicLotteryResults/{id}" + url = url.replace("{id}", params["id"] + "") - let data = params.body + const configs: IRequestConfig = getConfigs("get", "application/json", url, options) - configs.data = data + /** 适配ios13,get请求不允许带body */ axios(configs, resolve, reject) }) } /** - * Get a feature flag by id + * Get lottery totals by listing id */ - retrieve( + lotteryTotals( params: { /** */ - featureFlagId: string + id: string } = {} as any, options: IRequestOptions = {} - ): Promise { + ): Promise { return new Promise((resolve, reject) => { - let url = basePath + "/featureFlags/{featureFlagId}" - url = url.replace("{featureFlagId}", params["featureFlagId"] + "") + let url = basePath + "/lottery/lotteryTotals/{id}" + url = url.replace("{id}", params["id"] + "") const configs: IRequestConfig = getConfigs("get", "application/json", url, options) @@ -6155,86 +6171,83 @@ export interface CommunityTypeDTO { description?: string } -export interface ApplicationCsvQueryParams { +export interface FeatureFlagAssociate { /** */ id: string /** */ - includeDemographics?: boolean + associate: string[] /** */ - timeZone?: string + remove: string[] } -export interface ListingLotteryStatus { +export interface FeatureFlagCreate { /** */ - id: string + name: string /** */ - lotteryStatus: LotteryStatusEnum -} + description: string -export interface LotteryActivityLogItem { /** */ - status: string + active: boolean +} +export interface FeatureFlagUpdate { /** */ - name: string + id: string /** */ - logDate: Date -} + description: string -export interface PublicLotteryResult { /** */ - ordinal: number + active: boolean +} +export interface ApplicationCsvQueryParams { /** */ - multiselectQuestionId?: string -} + id: string -export interface PublicLotteryTotal { /** */ - total: number + includeDemographics?: boolean /** */ - multiselectQuestionId?: string + timeZone?: string } -export interface FeatureFlagAssociate { +export interface ListingLotteryStatus { /** */ id: string /** */ - associate: string[] - - /** */ - remove: string[] + lotteryStatus: LotteryStatusEnum } -export interface FeatureFlagCreate { +export interface LotteryActivityLogItem { /** */ - name: string + status: string /** */ - description: string + name: string /** */ - active: boolean + logDate: Date } -export interface FeatureFlagUpdate { +export interface PublicLotteryResult { /** */ - id: string + ordinal: number /** */ - name: string + multiselectQuestionId?: string +} +export interface PublicLotteryTotal { /** */ - description: string + total: number /** */ - active: boolean + multiselectQuestionId?: string } export enum ListingViews { diff --git a/sites/partners/.env.template b/sites/partners/.env.template index b1009a76b5..d66c19b61c 100644 --- a/sites/partners/.env.template +++ b/sites/partners/.env.template @@ -3,8 +3,6 @@ BACKEND_API_BASE=http://localhost:3100 BACKEND_PROXY_BASE= LISTINGS_QUERY=/listings NEXTJS_PORT=3001 -SHOW_DUPLICATES=FALSE -SHOW_LM_LINKS=TRUE CLOUDINARY_CLOUD_NAME=exygy CLOUDINARY_KEY='abcxyz' CLOUDINARY_SIGNED_PRESET='test123' diff --git a/sites/partners/next.config.js b/sites/partners/next.config.js index 507653e897..bc7a2f06b8 100644 --- a/sites/partners/next.config.js +++ b/sites/partners/next.config.js @@ -41,13 +41,11 @@ module.exports = withBundleAnalyzer( backendProxyBase: BACKEND_PROXY_BASE, listingServiceUrl: BACKEND_API_BASE + LISTINGS_QUERY, idleTimeout: process.env.IDLE_TIMEOUT, - showDuplicates: process.env.SHOW_DUPLICATES === "TRUE", showSmsMfa: (process.env.SHOW_SMS_MFA || "TRUE") === "TRUE", // SMS on by default cloudinaryCloudName: process.env.CLOUDINARY_CLOUD_NAME, cloudinaryKey: process.env.CLOUDINARY_KEY, cloudinarySignedPreset: process.env.CLOUDINARY_SIGNED_PRESET, mapBoxToken: MAPBOX_TOKEN, - featureListingsApproval: process.env.FEATURE_LISTINGS_APPROVAL, reCaptchaKey: process.env.RECAPTCHA_KEY, showLottery: process.env.SHOW_LOTTERY === "TRUE", lotteryDaysTillExpiry: process.env.LOTTERY_DAYS_TILL_EXPIRY,