Skip to content

Commit

Permalink
Release: 2023-08-16 (#638)
Browse files Browse the repository at this point in the history
* feat: listings approval feature flag (bloom-housing#3581)

* feat: new listings status enum (bloom-housing#3582)

* feat: refactor listing actions file (bloom-housing#3585)

* fix: add image fallback (bloom-housing#3551)

* fix: add image fallback

* fix: use refs to handle fallbacks before hydration

* chore: upgrade uic

* chore: regenerate yarn.lock

* fix: add fallback image when no images present

* fix: remove redundant fallback string for imageUrl

* fix: only email language if user has set language (bloom-housing#3592)

* feat: toggle actions - listings approval (bloom-housing#3586)

* feat: new requested changes field (bloom-housing#3583)

* chore(deps): bump protobufjs from 6.11.3 to 6.11.4 (bloom-housing#3599)

---------

Co-authored-by: Emily Jablonski <65367387+emilyjablonski@users.noreply.github.com>
Co-authored-by: Krzysztof Zięcina <kziecina@airnauts.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored Aug 18, 2023
1 parent 409e569 commit f6271e2
Show file tree
Hide file tree
Showing 31 changed files with 1,090 additions and 316 deletions.
2 changes: 1 addition & 1 deletion backend/core/src/email/email.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export class EmailService {
genericTranslations: Translation | null,
jurisdictionalDefaultTranslations: Translation | null

if (language != Language.en) {
if (language && language !== Language.en) {
if (jurisdiction) {
jurisdictionalTranslations = await this.translationService.getTranslationByLanguageAndJurisdictionOrDefaultEn(
language,
Expand Down
8 changes: 8 additions & 0 deletions backend/core/src/listings/dto/listing.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ import { ListingFeaturesDto } from "./listing-features.dto"
import { ListingMultiselectQuestionDto } from "../../multiselect-question/dto/listing-multiselect-question.dto"
import { ListingImageDto } from "./listing-image.dto"
import { ListingUtilitiesDto } from "./listing-utilities.dto"
import { UserDto } from "../../auth/dto/user.dto"

export class ListingDto extends OmitType(Listing, [
"applicationPickUpAddress",
"applicationDropOffAddress",
"applicationMailingAddress",
"applications",
"applicationMethods",
"requestedChangesUser",
"buildingSelectionCriteriaFile",
"events",
"images",
Expand Down Expand Up @@ -237,4 +239,10 @@ export class ListingDto extends OmitType(Listing, [
@Type(() => ListingUtilitiesDto)
@IsOptional({ groups: [ValidationsGroupsEnum.default] })
utilities?: ListingUtilitiesDto

@Expose()
@IsOptional({ groups: [ValidationsGroupsEnum.default] })
@ValidateNested({ groups: [ValidationsGroupsEnum.default] })
@Type(() => UserDto)
requestedChangesUser?: UserDto | null
}
21 changes: 21 additions & 0 deletions backend/core/src/listings/entities/listing.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,27 @@ class Listing extends BaseEntity {
@IsDate({ groups: [ValidationsGroupsEnum.default] })
@Type(() => Date)
lastApplicationUpdateAt?: Date | null

@Column({ type: "text", nullable: true })
@Expose()
@IsOptional({ groups: [ValidationsGroupsEnum.default] })
@IsString({ groups: [ValidationsGroupsEnum.default] })
requestedChanges?: string | null

@Column({ type: "timestamptz", nullable: true })
@Expose()
@IsOptional({ groups: [ValidationsGroupsEnum.default] })
@IsDate({ groups: [ValidationsGroupsEnum.default] })
@Type(() => Date)
requestedChangesDate?: Date | null

@ManyToOne(() => User)
@JoinColumn()
@Expose()
@IsOptional({ groups: [ValidationsGroupsEnum.default] })
@ValidateNested({ groups: [ValidationsGroupsEnum.default] })
@Type(() => User)
requestedChangesUser?: User | null
}

export { Listing as default, Listing }
4 changes: 3 additions & 1 deletion backend/core/src/listings/types/listing-status-enum.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export enum ListingStatus {
active = "active",
pending = "pending",
changesRequested = "changesRequested",
closed = "closed",
pending = "pending",
pendingReview = "pendingReview",
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export class ListingCreateValidationPipe extends ValidationPipe {
[ListingStatus.closed]: ListingCreateDto,
[ListingStatus.pending]: ListingCreateDto,
[ListingStatus.active]: ListingPublishedCreateDto,
[ListingStatus.changesRequested]: ListingPublishedCreateDto,
[ListingStatus.pendingReview]: ListingPublishedCreateDto,
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export class ListingUpdateValidationPipe extends ValidationPipe {
[ListingStatus.closed]: ListingUpdateDto,
[ListingStatus.pending]: ListingUpdateDto,
[ListingStatus.active]: ListingPublishedUpdateDto,
[ListingStatus.changesRequested]: ListingPublishedUpdateDto,
[ListingStatus.pendingReview]: ListingPublishedUpdateDto,
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
27 changes: 27 additions & 0 deletions backend/core/src/migration/1691377869351-new-status-fields.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { MigrationInterface, QueryRunner } from "typeorm"

export class newStatusFields1691377869351 implements MigrationInterface {
name = "newStatusFields1691377869351"

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TYPE "public"."listings_status_enum" ADD VALUE 'changesRequested'`
)
await queryRunner.query(`ALTER TYPE "public"."listings_status_enum" ADD VALUE 'pendingReview'`)
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TYPE "public"."listings_status_enum_old" AS ENUM('active', 'pending', 'closed')`
)
await queryRunner.query(`ALTER TABLE "listings" ALTER COLUMN "status" DROP DEFAULT`)
await queryRunner.query(
`ALTER TABLE "listings" ALTER COLUMN "status" TYPE "public"."listings_status_enum_old" USING "status"::"text"::"public"."listings_status_enum_old"`
)
await queryRunner.query(`ALTER TABLE "listings" ALTER COLUMN "status" SET DEFAULT 'pending'`)
await queryRunner.query(`DROP TYPE "public"."listings_status_enum"`)
await queryRunner.query(
`ALTER TYPE "public"."listings_status_enum_old" RENAME TO "listings_status_enum"`
)
}
}
19 changes: 19 additions & 0 deletions backend/core/src/migration/1691438164033-user-req-changes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { MigrationInterface, QueryRunner } from "typeorm"

export class userReqChanges1691438164033 implements MigrationInterface {
name = "userReqChanges1691438164033"

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "listings" ADD "requested_changes" text`)
await queryRunner.query(
`ALTER TABLE "listings" ADD "requested_changes_date" TIMESTAMP WITH TIME ZONE`
)
await queryRunner.query(`ALTER TABLE "listings" ADD "requested_changes_user_id" uuid`)
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "listings" DROP COLUMN "requested_changes_user_id"`)
await queryRunner.query(`ALTER TABLE "listings" DROP COLUMN "requested_changes_date"`)
await queryRunner.query(`ALTER TABLE "listings" DROP COLUMN "requested_changes"`)
}
}
36 changes: 34 additions & 2 deletions backend/core/types/src/backend-swagger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4961,6 +4961,9 @@ export interface Listing {
/** */
utilities?: ListingUtilities

/** */
requestedChangesUser?: CombinedRequestedChangesUserTypes

/** */
id: string

Expand Down Expand Up @@ -5110,6 +5113,12 @@ export interface Listing {

/** */
lastApplicationUpdateAt?: Date

/** */
requestedChanges?: string

/** */
requestedChangesDate?: Date
}

export interface PaginatedListing {
Expand Down Expand Up @@ -5523,6 +5532,12 @@ export interface ListingCreate {
/** */
lastApplicationUpdateAt?: Date

/** */
requestedChanges?: string

/** */
requestedChangesDate?: Date

/** */
countyCode?: string

Expand All @@ -5531,6 +5546,9 @@ export interface ListingCreate {

/** */
utilities?: ListingUtilities

/** */
requestedChangesUser?: CombinedRequestedChangesUserTypes
}

export interface ListingEventUpdate {
Expand Down Expand Up @@ -5926,6 +5944,12 @@ export interface ListingUpdate {
/** */
lastApplicationUpdateAt?: Date

/** */
requestedChanges?: string

/** */
requestedChangesDate?: Date

/** */
countyCode?: string

Expand All @@ -5934,6 +5958,9 @@ export interface ListingUpdate {

/** */
utilities?: ListingUtilities

/** */
requestedChangesUser?: CombinedRequestedChangesUserTypes
}

export interface MultiselectQuestionsFilterParams {
Expand Down Expand Up @@ -6262,8 +6289,10 @@ export enum EnumListingFilterParamsComparison {
}
export enum EnumListingFilterParamsStatus {
"active" = "active",
"pending" = "pending",
"changesRequested" = "changesRequested",
"closed" = "closed",
"pending" = "pending",
"pendingReview" = "pendingReview",
}
export enum OrderByFieldsEnum {
"mostRecentlyUpdated" = "mostRecentlyUpdated",
Expand All @@ -6288,8 +6317,10 @@ export enum ListingApplicationAddressType {

export enum ListingStatus {
"active" = "active",
"pending" = "pending",
"changesRequested" = "changesRequested",
"closed" = "closed",
"pending" = "pending",
"pendingReview" = "pendingReview",
}

export enum ListingReviewOrder {
Expand All @@ -6315,6 +6346,7 @@ export type CombinedApplicationMailingAddressTypes = AddressUpdate
export type CombinedBuildingSelectionCriteriaFileTypes = AssetUpdate
export type CombinedLeasingAgentAddressTypes = AddressUpdate
export type CombinedResultTypes = AssetCreate
export type CombinedRequestedChangesUserTypes = User
export type CombinedBuildingAddressTypes = AddressUpdate
export enum EnumMultiselectQuestionsFilterParamsComparison {
"=" = "=",
Expand Down
4 changes: 2 additions & 2 deletions shared-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
},
"dependencies": {
"@bloom-housing/backend-core": "^7.13.0",
"@bloom-housing/ui-components": "12.0.15",
"@bloom-housing/ui-components": "12.0.16",
"axios-cookiejar-support": "4.0.6",
"tough-cookie": "4.1.3"
},
"devDependencies": {
"@testing-library/jest-dom": "5.16.4",
"@testing-library/jest-dom": "5.17.0",
"@testing-library/react": "14.0.0",
"@types/jest": "^26.0.14",
"@types/node-polyglot": "^2.4.1",
Expand Down
3 changes: 2 additions & 1 deletion shared-helpers/src/utilities/photos.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Asset, Listing } from "@bloom-housing/backend-core/types"

export const CLOUDINARY_BUILDING_LABEL = "cloudinaryBuilding"
export const IMAGE_FALLBACK_URL = "/images/listing-fallback.png"

export const cloudinaryUrlFromId = (publicId: string, size = 400) => {
const cloudName = process.env.cloudinaryCloudName || process.env.CLOUDINARY_CLOUD_NAME
Expand Down Expand Up @@ -35,5 +36,5 @@ export const imageUrlFromListing = (listing: Listing, size = 400): string[] => {
: asset.fileId
})

return imageUrls?.length > 0 ? imageUrls : [""]
return imageUrls?.length > 0 ? imageUrls : ["/images/fallback-listing.png"]
}
1 change: 1 addition & 0 deletions sites/partners/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ CLOUDINARY_KEY='abcxyz'
CLOUDINARY_SIGNED_PRESET='test123'
MAPBOX_TOKEN=
SHOW_SMS_MFA=TRUE
FEATURE_LISTINGS_APPROVAL=FALSE
Loading

0 comments on commit f6271e2

Please sign in to comment.