Skip to content

Commit 1bca479

Browse files
Merge pull request #33 from bloom-housing/release/3-12-26
feat: release 3-12-26
2 parents 624c079 + 59970d0 commit 1bca479

File tree

57 files changed

+904
-493
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+904
-493
lines changed

api/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ COPY --from=build /build/prisma/schema.prisma ./prisma/schema.prisma
4545
COPY --from=build /build/prisma/migrations ./prisma/migrations
4646
COPY --from=build /build/node_modules/.prisma ./node_modules/.prisma
4747

48+
# Make sure directory for csv exports exists.
49+
WORKDIR /bloom_api/src/temp
50+
4851
# Create a non-root user to run (principle of least privilege).
4952
WORKDIR /bloom_api
5053
RUN groupadd --gid 2002 bloom_api && useradd --gid 2002 --uid 2002 --home /bloom_api bloom_api

api/dbinit/rds.init.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ BEGIN
1919
IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'bloom_api') THEN
2020
CREATE USER bloom_api;
2121
GRANT rds_iam TO bloom_api;
22-
GRANT CONNECT ON DATABASE bloom_prisma TO bloom_api;
23-
GRANT ALL PRIVILEGES ON DATABASE bloom_prisma TO bloom_api;
24-
GRANT ALL PRIVILEGES ON SCHEMA public TO bloom_api;
2522
END IF;
23+
GRANT CONNECT ON DATABASE bloom_prisma TO bloom_api;
24+
GRANT ALL PRIVILEGES ON DATABASE bloom_prisma TO bloom_api;
25+
GRANT ALL PRIVILEGES ON SCHEMA public TO bloom_api;
2626
END
2727
$$;
2828

@@ -33,10 +33,10 @@ BEGIN
3333
IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'bloom_readonly') THEN
3434
CREATE USER bloom_readonly;
3535
GRANT rds_iam TO bloom_readonly;
36-
GRANT CONNECT ON DATABASE bloom_prisma TO bloom_readonly;
37-
GRANT USAGE ON SCHEMA public TO bloom_readonly;
38-
GRANT USAGE ON ALL SEQUENCES IN SCHEMA public TO bloom_readonly;
3936
END IF;
37+
GRANT CONNECT ON DATABASE bloom_prisma TO bloom_readonly;
38+
GRANT USAGE ON SCHEMA public TO bloom_readonly;
39+
GRANT USAGE ON ALL SEQUENCES IN SCHEMA public TO bloom_readonly;
4040
END
4141
$$;
4242

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Returns the appropriate fileId for a Cloudinary asset based on the
3+
* DBSEED_USE_FULL_CLOUDINARY_URL_AS_FILE_ID environment variable.
4+
*
5+
* When the env var is set, returns the full Cloudinary URL:
6+
* https://res.cloudinary.com/exygy/image/upload/w_400,c_limit,q_65/<IMAGE_ID>.jpg
7+
*
8+
* Otherwise, returns the image ID as-is.
9+
*/
10+
export function assetFileId(imageId: string): string {
11+
if (process.env.DBSEED_USE_FULL_CLOUDINARY_URL_AS_FILE_ID) {
12+
const size = process.env.LISTING_PHOTO_SIZE || '1302';
13+
return `https://res.cloudinary.com/exygy/image/upload/w_${size},c_limit,q_65/${imageId}.jpg`;
14+
}
15+
return imageId;
16+
}

api/prisma/seed-helpers/listing-data/blue-sky-apartments.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
yellowstoneAddress,
1313
yosemiteAddress,
1414
} from '../address-factory';
15+
import { assetFileId } from '../asset-file-id-helper';
1516

1617
export const blueSkyApartments: Prisma.ListingsCreateInput = {
1718
additionalApplicationSubmissionNotes: null,
@@ -106,7 +107,7 @@ export const blueSkyApartments: Prisma.ListingsCreateInput = {
106107
assets: {
107108
create: {
108109
label: 'cloudinaryBuilding',
109-
fileId: 'dev/trayan-xIOYJSVEZ8c-unsplash_f1axsg',
110+
fileId: assetFileId('dev/trayan-xIOYJSVEZ8c-unsplash_f1axsg'),
110111
},
111112
},
112113
},

api/prisma/seed-helpers/listing-data/elm-village.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
} from '@prisma/client';
88
import dayjs from 'dayjs';
99
import { featuresAndUtilites } from '../listing-factory';
10+
import { assetFileId } from '../asset-file-id-helper';
1011

1112
export const elmVillage: Prisma.ListingsCreateInput = {
1213
additionalApplicationSubmissionNotes: null,
@@ -103,7 +104,9 @@ export const elmVillage: Prisma.ListingsCreateInput = {
103104
assets: {
104105
create: {
105106
label: 'cloudinaryBuilding',
106-
fileId: 'dev/krzysztof-hepner-V7Q0Oh3Az-c-unsplash_xoj7sr',
107+
fileId: assetFileId(
108+
'dev/krzysztof-hepner-V7Q0Oh3Az-c-unsplash_xoj7sr',
109+
),
107110
},
108111
},
109112
},
@@ -112,7 +115,9 @@ export const elmVillage: Prisma.ListingsCreateInput = {
112115
assets: {
113116
create: {
114117
label: 'cloudinaryBuilding',
115-
fileId: 'dev/blake-wheeler-zBHU08hdzhY-unsplash_swqash',
118+
fileId: assetFileId(
119+
'dev/blake-wheeler-zBHU08hdzhY-unsplash_swqash',
120+
),
116121
},
117122
},
118123
},

api/prisma/seed-helpers/listing-data/hollywood-hills-heights.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
} from '@prisma/client';
77
import { yellowstoneAddress } from '../address-factory';
88
import dayjs from 'dayjs';
9+
import { assetFileId } from '../asset-file-id-helper';
910

1011
export const hollywoodHillsHeights: Prisma.ListingsCreateInput = {
1112
additionalApplicationSubmissionNotes: null,
@@ -96,7 +97,7 @@ export const hollywoodHillsHeights: Prisma.ListingsCreateInput = {
9697
assets: {
9798
create: {
9899
label: 'cloudinaryBuilding',
99-
fileId: 'dev/apartment_building_2_b7ujdd',
100+
fileId: assetFileId('dev/apartment_building_2_b7ujdd'),
100101
},
101102
},
102103
},
@@ -106,7 +107,9 @@ export const hollywoodHillsHeights: Prisma.ListingsCreateInput = {
106107
assets: {
107108
create: {
108109
label: 'cloudinaryBuilding',
109-
fileId: 'dev/krzysztof-hepner-V7Q0Oh3Az-c-unsplash_xoj7sr',
110+
fileId: assetFileId(
111+
'dev/krzysztof-hepner-V7Q0Oh3Az-c-unsplash_xoj7sr',
112+
),
110113
},
111114
},
112115
},
@@ -116,7 +119,9 @@ export const hollywoodHillsHeights: Prisma.ListingsCreateInput = {
116119
assets: {
117120
create: {
118121
label: 'cloudinaryBuilding',
119-
fileId: 'dev/blake-wheeler-zBHU08hdzhY-unsplash_swqash',
122+
fileId: assetFileId(
123+
'dev/blake-wheeler-zBHU08hdzhY-unsplash_swqash',
124+
),
120125
},
121126
},
122127
},

api/prisma/seed-helpers/listing-data/lakeview-villa.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
} from '@prisma/client';
88
import dayjs from 'dayjs';
99
import { yellowstoneAddress } from '../address-factory';
10+
import { assetFileId } from '../asset-file-id-helper';
1011

1112
export const lakeviewVilla: Prisma.ListingsCreateInput = {
1213
additionalApplicationSubmissionNotes: null,
@@ -92,7 +93,7 @@ export const lakeviewVilla: Prisma.ListingsCreateInput = {
9293
assets: {
9394
create: {
9495
label: 'cloudinaryBuilding',
95-
fileId: 'dev/unnamed_fkxrj2',
96+
fileId: assetFileId('dev/unnamed_fkxrj2'),
9697
},
9798
},
9899
},

api/prisma/seed-helpers/listing-data/little-village-apartments.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
ReviewOrderTypeEnum,
66
} from '@prisma/client';
77
import dayjs from 'dayjs';
8+
import { assetFileId } from '../asset-file-id-helper';
89

910
export const littleVillageApartments: Prisma.ListingsCreateInput = {
1011
additionalApplicationSubmissionNotes: null,
@@ -84,7 +85,7 @@ export const littleVillageApartments: Prisma.ListingsCreateInput = {
8485
assets: {
8586
create: {
8687
label: 'cloudinaryBuilding',
87-
fileId: 'dev/dillon-kydd-2keCPb73aQY-unsplash_lm7krp',
88+
fileId: assetFileId('dev/dillon-kydd-2keCPb73aQY-unsplash_lm7krp'),
8889
},
8990
},
9091
},

api/prisma/seed-helpers/listing-data/sunshine-flats.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
} from '@prisma/client';
77
import dayjs from 'dayjs';
88
import { glacierAddress } from '../address-factory';
9+
import { assetFileId } from '../asset-file-id-helper';
910

1011
export const sunshineFlats: Prisma.ListingsCreateInput = {
1112
additionalApplicationSubmissionNotes: null,
@@ -90,7 +91,7 @@ export const sunshineFlats: Prisma.ListingsCreateInput = {
9091
assets: {
9192
create: {
9293
label: 'cloudinaryBuilding',
93-
fileId: 'dev/sunshine-flats_naated',
94+
fileId: assetFileId('dev/sunshine-flats_naated'),
9495
},
9596
},
9697
},

api/prisma/seed-helpers/listing-data/valley-heights-senior-community.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
ReviewOrderTypeEnum,
66
} from '@prisma/client';
77
import dayjs from 'dayjs';
8+
import { assetFileId } from '../asset-file-id-helper';
89

910
export const valleyHeightsSeniorCommunity: Prisma.ListingsCreateInput = {
1011
additionalApplicationSubmissionNotes: null,
@@ -87,7 +88,7 @@ export const valleyHeightsSeniorCommunity: Prisma.ListingsCreateInput = {
8788
assets: {
8889
create: {
8990
label: 'cloudinaryBuilding',
90-
fileId: 'dev/apartment_ez3yyz',
91+
fileId: assetFileId('dev/apartment_ez3yyz'),
9192
},
9293
},
9394
},
@@ -96,7 +97,7 @@ export const valleyHeightsSeniorCommunity: Prisma.ListingsCreateInput = {
9697
assets: {
9798
create: {
9899
label: 'cloudinaryBuilding',
99-
fileId: 'dev/interior_mc9erd',
100+
fileId: assetFileId('dev/interior_mc9erd'),
100101
},
101102
},
102103
},
@@ -105,7 +106,7 @@ export const valleyHeightsSeniorCommunity: Prisma.ListingsCreateInput = {
105106
assets: {
106107
create: {
107108
label: 'cloudinaryBuilding',
108-
fileId: 'dev/inside_qo9wre',
109+
fileId: assetFileId('dev/inside_qo9wre'),
109110
},
110111
},
111112
},

0 commit comments

Comments
 (0)