Skip to content

Commit

Permalink
fix: add home type feature to backend and partners (#4484)
Browse files Browse the repository at this point in the history
* fix: add hometype to listing create/update

* fix: add home type to csv

* fix: update jwt to retrieve feature flags

* fix: partner changes

* fix: have partner be behind feature flag

* fix: backend test fix

* fix: remove comment

* fix: address comments

* fix: review comments
  • Loading branch information
ludtkemorgan authored Dec 4, 2024
1 parent cd106c1 commit 0e3d9c8
Show file tree
Hide file tree
Showing 16 changed files with 603 additions and 390 deletions.
7 changes: 7 additions & 0 deletions api/prisma/seed-staging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
import { ValidationMethod } from '../src/enums/multiselect-questions/validation-method-enum';
import { randomNoun } from './seed-helpers/word-generator';
import { householdMemberFactorySingle } from './seed-helpers/household-member-factory';
import { featureFlagFactory } from './seed-helpers/feature-flag-factory';

export const stagingSeed = async (
prismaClient: PrismaClient,
Expand All @@ -56,6 +57,12 @@ export const stagingSeed = async (
const additionalJurisdiction = await prismaClient.jurisdictions.create({
data: jurisdictionFactory(otherJusisName),
});
// Seed feature flags
await prismaClient.featureFlags.create({
data: featureFlagFactory('homeType', true, 'Home Type feature', [
jurisdiction.id,
]),
});
// create admin user
await prismaClient.userAccounts.create({
data: await userFactory({
Expand Down
11 changes: 11 additions & 0 deletions api/src/dtos/listings/listing.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { AbstractDTO } from '../shared/abstract.dto';
import {
ApplicationAddressTypeEnum,
ApplicationMethodsTypeEnum,
HomeTypeEnum,
ListingsStatusEnum,
LotteryStatusEnum,
ReviewOrderTypeEnum,
Expand Down Expand Up @@ -628,6 +629,16 @@ class Listing extends AbstractDTO {
@ApiPropertyOptional()
@IsString({ groups: [ValidationsGroupsEnum.default] })
communityDisclaimerDescription?: string;

@Expose()
@IsEnum(HomeTypeEnum, {
groups: [ValidationsGroupsEnum.default],
})
@ApiPropertyOptional({
enum: HomeTypeEnum,
enumName: 'HomeTypeEnum',
})
homeType?: HomeTypeEnum;
}

export { Listing as default, Listing };
11 changes: 10 additions & 1 deletion api/src/passports/jwt.strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,16 @@ export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') {
include: {
listings: true,
userRoles: true,
jurisdictions: true,
jurisdictions: {
include: {
featureFlags: {
select: {
name: true,
active: true,
},
},
},
},
},
where: {
id: userId,
Expand Down
Loading

0 comments on commit 0e3d9c8

Please sign in to comment.