Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
222 commits
Select commit Hold shift + click to select a range
c754137
feat: adding entrypoint
gbbayareametro Aug 4, 2025
3e43ae2
fix: fixing copy command
gbbayareametro Aug 4, 2025
9f15ba4
feat: modifying for cdk build
gbbayareametro Aug 4, 2025
7216f9d
fix: static database name
gbbayareametro Aug 5, 2025
ab30418
fix: fixing database url
gbbayareametro Aug 5, 2025
1421c43
fix: adding dbname
gbbayareametro Aug 6, 2025
c404207
fix: pgdatabase
gbbayareametro Aug 6, 2025
2fb2d2b
fix: chowning
gbbayareametro Aug 7, 2025
1c66351
fix: chown
gbbayareametro Aug 7, 2025
48fcbf5
fix: fixing entrypoints
gbbayareametro Aug 7, 2025
f21478f
fix: changing migration command
gbbayareametro Aug 8, 2025
d7e43a1
feat: cdk pipeline
gbbayareametro Aug 15, 2025
a825e3b
Merge branch 'main' into feat/tf_to_cdk
gbbayareametro Aug 15, 2025
6066639
feat: adding migration
gbbayareametro Aug 15, 2025
2e016db
fix: trying with migrate.yml temporarily
gbbayareametro Aug 15, 2025
38702cb
fix: fixing migrate.yml
gbbayareametro Aug 15, 2025
ff1cfe8
fix: moving build role to the stack
gbbayareametro Aug 18, 2025
d67cb1f
fix: another buildrole move
gbbayareametro Aug 18, 2025
4f4054f
feat: api service build
gbbayareametro Aug 19, 2025
b798544
fix: adding to pipeline
gbbayareametro Aug 19, 2025
e7eaa95
fix: fixing some env variable issues.
gbbayareametro Aug 19, 2025
3e14186
fix: modifying migration commands
gbbayareametro Aug 19, 2025
e6e755f
fix: switching to stop backend
gbbayareametro Aug 19, 2025
893fa79
fix: putting ECS Restart back in
gbbayareametro Aug 19, 2025
9094671
fix: different db entrypoint
gbbayareametro Aug 19, 2025
a361871
fix: another entrypoint change
gbbayareametro Aug 19, 2025
9af7e42
fix: api service
gbbayareametro Aug 20, 2025
d68d18a
fix: removing config source
gbbayareametro Aug 20, 2025
f33a500
feat adding serviceconnect
gbbayareametro Aug 20, 2025
0d73659
fix: dupe log group name
gbbayareametro Aug 20, 2025
ddd9fb6
fix: port mapping name
gbbayareametro Aug 20, 2025
e1a9dcc
fix: removing role
gbbayareametro Aug 20, 2025
ce0bb0b
fix: creating role for serviceconnect
gbbayareametro Aug 20, 2025
cd26082
fix: changing role name
gbbayareametro Aug 20, 2025
9fbf27d
fix: formatting
gbbayareametro Aug 20, 2025
f9015d1
fix: adding dependency on namespace
gbbayareametro Aug 20, 2025
9bef54a
fix: granting access to private ca
gbbayareametro Aug 20, 2025
09079ab
fix: fixing policy document
gbbayareametro Aug 20, 2025
ba34962
fix: adding api key back
gbbayareametro Aug 20, 2025
ad783a0
adding public site
gbbayareametro Aug 20, 2025
d5d1ac2
fix: fixing compile errors
gbbayareametro Aug 20, 2025
c95e9a5
feat: reconfiguring services
gbbayareametro Aug 21, 2025
4ec4453
fix: using git commit hash for container name
gbbayareametro Aug 22, 2025
a147913
feat: load balancer setup
gbbayareametro Aug 22, 2025
2b2550c
feat: more load balancer enhancements
gbbayareametro Aug 23, 2025
c607fd1
changing api to backend
gbbayareametro Aug 25, 2025
e0f08fd
fix: adding arecord
gbbayareametro Aug 25, 2025
2b938fd
fix: duplicate zones
gbbayareametro Aug 25, 2025
cc8ee5e
fix: local synth issues
gbbayareametro Aug 25, 2025
4843935
Merge branch 'main' into feat/tf_to_cdk
gbbayareametro Aug 25, 2025
a287e09
fix: changing serviceconnect protocol
gbbayareametro Aug 25, 2025
d899fbc
fix: changing port in backend definition
gbbayareametro Aug 25, 2025
12c705c
fix: fixing secrets
gbbayareametro Aug 25, 2025
11a35d5
fix: govdelivery url
gbbayareametro Aug 26, 2025
baea7bc
fix: granting proper sg access
gbbayareametro Aug 26, 2025
d4b63f6
fix: renaming secrets location
gbbayareametro Aug 26, 2025
ca69dde
feat: adding restart lambdas
gbbayareametro Aug 27, 2025
9e84c18
fix: SecretStringChanged
gbbayareametro Aug 27, 2025
64d3633
fix: event pattern detail
gbbayareametro Aug 27, 2025
67a396a
fix: don't need to put a list in a list!
gbbayareametro Aug 27, 2025
9aaff39
fix: Pipeline takes public and partners sites based on environments
gbbayareametro Aug 27, 2025
bcddf1d
fix: common lambda creation for all services
gbbayareametro Aug 27, 2025
355cd23
fix: trying with secret name
gbbayareametro Aug 27, 2025
ca374d2
fix: fixing docker tags
gbbayareametro Aug 27, 2025
0321391
fix: pipeline and dockertag fixes
gbbayareametro Aug 27, 2025
053eb99
fix: sigh more docker fixes
gbbayareametro Aug 27, 2025
063bd3a
fix: trying to trick codebuild into thinking something changed
gbbayareametro Aug 27, 2025
27b61cc
fix: lost quote
gbbayareametro Aug 27, 2025
331a3c5
fix: another attempt to fire it
gbbayareametro Aug 27, 2025
73d32a4
feat: adding partners site
gbbayareametro Aug 28, 2025
e796750
fix: adding parners portal to lb
gbbayareametro Aug 28, 2025
088f268
fix: duplicate name
gbbayareametro Aug 28, 2025
0c3b53a
fix: dev2 url
gbbayareametro Aug 28, 2025
e0bc5ba
fix: new event format
gbbayareametro Aug 28, 2025
863539b
fix: serviceprincipal addition of events
gbbayareametro Aug 28, 2025
34459a2
fix: cert validation
gbbayareametro Aug 28, 2025
ce42e13
fix: role setup mixup
gbbayareametro Aug 28, 2025
148121a
fix: cert issues
gbbayareametro Aug 29, 2025
8aec176
fix: reverting back to original arn pattern
gbbayareametro Aug 29, 2025
98101ee
fix: duplicate target groups
gbbayareametro Aug 29, 2025
ce304e9
fix: trying with secret prefix
gbbayareametro Aug 29, 2025
7ef8a91
fix: sigh...another missed public-partners
gbbayareametro Aug 29, 2025
0fa037a
fix: dealing with empty secrets set
gbbayareametro Aug 29, 2025
5bb3b4c
fix: no cors origins in env file
gbbayareametro Aug 29, 2025
f28c074
fix: debugging origin
gbbayareametro Aug 29, 2025
90ddd80
fix: trying with logger
gbbayareametro Aug 29, 2025
a3026e1
fix: using nestjs logger
gbbayareametro Aug 29, 2025
90a8004
fix: another debugging attempt
gbbayareametro Aug 29, 2025
a08e708
fix: origins and docker versioning changes
gbbayareametro Aug 30, 2025
6106b48
fix: moving serviceconnect logs out of main log group
gbbayareametro Aug 30, 2025
ff3788e
fix: yet more debugging
gbbayareametro Aug 30, 2025
0e02968
fix: more time in debugging hell
gbbayareametro Aug 30, 2025
7c4a7ef
fix trying with DISABLE_CORS again
gbbayareametro Aug 30, 2025
6663ce2
fix: ok lets try this the ham handed way
gbbayareametro Aug 30, 2025
dff3cf6
fix: changing db migration to reseed
gbbayareametro Aug 30, 2025
89aea6e
fix: turning off cors disable
gbbayareametro Aug 30, 2025
edaed26
fix: renaming services for dbmigrat
gbbayareametro Aug 31, 2025
7aa581d
fix: applying migration cmd
gbbayareametro Aug 31, 2025
8d390e8
fix: trying with entrypoint
gbbayareametro Aug 31, 2025
1658883
fix: reverting to old format
gbbayareametro Aug 31, 2025
3567b3a
fixing docker cmd
gbbayareametro Aug 31, 2025
ec37db2
trying to get back to initial docker build for migration
gbbayareametro Aug 31, 2025
df1e51c
fix: changing db url
gbbayareametro Sep 1, 2025
2122d6b
fix: hard coding port
gbbayareametro Sep 1, 2025
10c64c8
fix: temporary image change
gbbayareametro Sep 1, 2025
2b46779
fix: moving secrets stuff to main
gbbayareametro Sep 1, 2025
49fe109
fix: missing bracket
gbbayareametro Sep 1, 2025
541a98f
fix: update migrate.yml
gbbayareametro Sep 1, 2025
66e61e7
fix: debugging
gbbayareametro Sep 1, 2025
e849636
fix: more debugging
gbbayareametro Sep 1, 2025
6277b13
fix: trying without DATABASE_URL
gbbayareametro Sep 1, 2025
ec85867
yet another attempt
gbbayareametro Sep 1, 2025
525926c
fix: once more
gbbayareametro Sep 1, 2025
5bb4144
fix: lets do this bad boy
gbbayareametro Sep 1, 2025
53fdf8c
fix: adding the entrypoint run
gbbayareametro Sep 1, 2025
cefec6a
fix: missed one
gbbayareametro Sep 1, 2025
8d258d8
fix: moving commands around
gbbayareametro Sep 1, 2025
d036911
fix: more moving
gbbayareametro Sep 1, 2025
6129a24
moving prisma generate
gbbayareametro Sep 1, 2025
fb3e9a2
fix: debugging docker
gbbayareametro Sep 2, 2025
a2f803f
fix: encoding password
gbbayareametro Sep 2, 2025
a078402
getting rid of API key
gbbayareametro Sep 2, 2025
5caeda1
fix: moving things around and fixing PGPORT
gbbayareametro Sep 2, 2025
c73ce2c
fix: fixing cruft from moving things around
gbbayareametro Sep 2, 2025
14937ac
fix: fixing migrate dockerfile
gbbayareametro Sep 2, 2025
fd5ac03
fix: more debugging
gbbayareametro Sep 2, 2025
feda3a2
fix: tweeking CORS settings
gbbayareametro Sep 2, 2025
78202b5
fix: samesite lax
gbbayareametro Sep 2, 2025
aaf52e3
fix: more more debugging
gbbayareametro Sep 2, 2025
e1903e2
fix: changing cookiedomain to localhost
gbbayareametro Sep 2, 2025
6582c9a
fix: bad env variable
gbbayareametro Sep 2, 2025
6aefb6d
changing -c to entrypoint
gbbayareametro Sep 2, 2025
959fee7
fix: more debugging
gbbayareametro Sep 2, 2025
33ee012
fix: changing entrypoint
gbbayareametro Sep 2, 2025
e643be8
fix: trying without the command line parm
gbbayareametro Sep 2, 2025
5dff329
fix: fixing entrypoint
gbbayareametro Sep 3, 2025
b1b1901
fix: trying another edit of the script
gbbayareametro Sep 3, 2025
7afff4d
fix: more futzing with the entrypoint
gbbayareametro Sep 3, 2025
3ab60b8
fix: adding debug logging
gbbayareametro Sep 3, 2025
f4b4f16
fix: more debugging!
gbbayareametro Sep 3, 2025
438ce6d
fix: running a test
gbbayareametro Sep 3, 2025
61d05e4
fix: another test
gbbayareametro Sep 3, 2025
8692717
fix: caching pipeline
gbbayareametro Sep 3, 2025
9a96489
fix: removing line
gbbayareametro Sep 3, 2025
f0abcb6
fix: removing more code
gbbayareametro Sep 3, 2025
6c80363
fix: adding dbmigrate back
gbbayareametro Sep 3, 2025
f2cfad7
fix: fixing buildspec
gbbayareametro Sep 3, 2025
fd5cbf9
fix: adding migration cmd
gbbayareametro Sep 3, 2025
dbbc7c1
fix: missed quote
gbbayareametro Sep 3, 2025
646945f
fix: hard coding entrypoint
gbbayareametro Sep 3, 2025
e5f7429
fix: trying with script
gbbayareametro Sep 3, 2025
209a182
fix: fixing migrate entrypoint and some echoing in the run script
gbbayareametro Sep 3, 2025
4061a4a
fix: setting db url in entrypoint
gbbayareametro Sep 3, 2025
e8ddef1
fix: accidental newline
gbbayareametro Sep 3, 2025
d8651e6
fix: adding backend api base
gbbayareametro Sep 4, 2025
768c532
fix: removing ecs interdependencies
gbbayareametro Sep 4, 2025
ee6ca59
fix: style change
gbbayareametro Sep 4, 2025
1b8305a
fix: adding more environment variables
gbbayareametro Sep 4, 2025
9e48bce
fix: dbmigrate role fixes and backend api variable change
gbbayareametro Sep 4, 2025
1fb55ab
feat: adding cloudfront
gbbayareametro Sep 4, 2025
e0bb907
feat: moving s3 stack
gbbayareametro Sep 4, 2025
c0b9fb7
fix: adding access
gbbayareametro Sep 4, 2025
b310885
fix: adding cert and georestriction
gbbayareametro Sep 4, 2025
5df953b
fix: pipeline fixes
gbbayareametro Sep 5, 2025
8544173
fix: make api dependent on s3 stack
gbbayareametro Sep 5, 2025
6d6628b
fix: Yay!
gbbayareametro Sep 5, 2025
3671bf9
fix: pointing dns at cloudfront
gbbayareametro Sep 5, 2025
2c03674
fix: re-adding migrate
gbbayareametro Sep 5, 2025
a6a0d38
Merge branch 'main' into feat/tf_to_cdk
gbbayareametro Sep 5, 2025
b1624b3
fix: removing secret field names
gbbayareametro Sep 5, 2025
ed2b929
fix: change namespace name to something more generic
gbbayareametro Sep 8, 2025
818e253
fix: fixing log group and cloudfront origin
gbbayareametro Sep 8, 2025
0f5aa01
fix: changing origin request policy
gbbayareametro Sep 8, 2025
ab93521
fix: fixing namespace
gbbayareametro Sep 8, 2025
687a0fa
fix: cache policy
gbbayareametro Sep 8, 2025
76b7a35
fix: autoscaling
gbbayareametro Sep 8, 2025
54231f9
feat: private lb
gbbayareametro Sep 9, 2025
290a2cd
removing serviceconnect
gbbayareametro Sep 9, 2025
55547f7
moving lb to app subnets
gbbayareametro Sep 9, 2025
c8a4e25
fix: cdk issues
gbbayareametro Sep 9, 2025
0e14a64
feat: going to https
gbbayareametro Sep 9, 2025
ef47682
fix: sigh....can't use https
gbbayareametro Sep 9, 2025
1dc286f
fix: adding dbmigrate back
gbbayareametro Sep 9, 2025
6e5ca7e
Merge branch 'main' into feat/tf_to_cdk
gbbayareametro Sep 10, 2025
504e68c
feat: adding secrets to env deploy
gbbayareametro Sep 10, 2025
ad43ccf
fix: dependency fix
gbbayareametro Sep 10, 2025
d0431cc
fix. renaming application stack
gbbayareametro Sep 11, 2025
edfb3c6
fix: changing cloudfront definition
gbbayareametro Sep 12, 2025
09769b2
feat: import listings task
gbbayareametro Sep 15, 2025
5e77134
fix: reduce cpu size for listings import
gbbayareametro Sep 15, 2025
e37a0a6
fix: cpu definition and name
gbbayareametro Sep 15, 2025
02395eb
feat: adding jsdoc comments
gbbayareametro Sep 15, 2025
e3c634a
fix: role for scheduler with run task grants
gbbayareametro Sep 16, 2025
8c22182
fix: going with autogenerated schedule name
gbbayareametro Sep 16, 2025
d2af01a
feat: adding staging
gbbayareametro Sep 16, 2025
7edd079
fix: fixing duplicate names
gbbayareametro Sep 16, 2025
273696d
fix: CPU-> CPUS
gbbayareametro Sep 16, 2025
b03a40c
fix: fixing roles
gbbayareametro Sep 17, 2025
924910f
fix: grants
gbbayareametro Sep 17, 2025
2950826
fix: env variable fix
gbbayareametro Sep 17, 2025
eb516c4
fix: import listings s/b run candidate
gbbayareametro Sep 17, 2025
0c451da
fix: import listings
gbbayareametro Sep 17, 2025
3a7bd6f
fix: dotenv madness
gbbayareametro Sep 17, 2025
2f9ba3c
fix: wrong api url
gbbayareametro Sep 17, 2025
17455e9
fix: switching to ssm parameters for lb dns name
gbbayareametro Sep 17, 2025
f49b502
Merge branch 'main' into feat/tf_to_cdk
gbbayareametro Sep 18, 2025
4d66146
fix: going with dev for env name but keeping dev2 urls. Plus fixing c…
gbbayareametro Sep 18, 2025
f271f1c
fix: back to dev2
gbbayareametro Sep 18, 2025
52e5135
fix: adding cloudfront
gbbayareametro Sep 18, 2025
da97604
fix: bad env variable in build
gbbayareametro Sep 18, 2025
eba1b85
fix: prod!
gbbayareametro Sep 19, 2025
92f44d6
fix: dev2->dev
gbbayareametro Sep 19, 2025
4a54f54
fix: temporarily remove db migrate
gbbayareametro Sep 19, 2025
bc35592
fix: adding dev dbmigrate back
gbbayareametro Sep 19, 2025
e4a9e27
fix: correcting url issues
gbbayareametro Sep 19, 2025
b617e14
feat: make ses region configurable
gbbayareametro Sep 23, 2025
1b50ff9
add additional logging (#1429)
ludtkemorgan Sep 26, 2025
0c559a3
fix: switch log from console to logger (#1430)
ludtkemorgan Sep 26, 2025
f700a88
fix: try some more logging
ludtkemorgan Oct 29, 2025
672189e
fix: switch to serversideprops
ludtkemorgan Oct 29, 2025
1f19d49
fix: accidental s removed
ludtkemorgan Oct 29, 2025
382e0fc
Merge branch 'main' into feat/tf_to_cdk
gbbayareametro Nov 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
docs

# Next.js cache and compiled artifacts
.next/
Expand Down
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: we usually use ESLint as our linter, do we need both prettier and eslimnt?

"singleQuote": false,
"trailingComma": "es5",
"semi": false,
"printWidth": 100
}
9 changes: 9 additions & 0 deletions .trunk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*out
*logs
*actions
*notifications
*tools
plugins
user_trunk.yaml
user.yaml
tmp
4 changes: 4 additions & 0 deletions .trunk/configs/.hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Following source doesn't work in most setups
ignored:
- SC1090
- SC1091
2 changes: 2 additions & 0 deletions .trunk/configs/.markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Prettier friendly markdownlint config (all formatting rules disabled)
extends: markdownlint/style/prettier
7 changes: 7 additions & 0 deletions .trunk/configs/.shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
enable=all
source-path=SCRIPTDIR
disable=SC2154

# If you're having issues with shellcheck following source, disable the errors via:
# disable=SC1090
# disable=SC1091
7 changes: 7 additions & 0 deletions .trunk/configs/.yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
rules:
quoted-strings:
required: only-when-needed
extra-allowed: ["{|}"]
key-duplicates: {}
octal-values:
forbid-implicit-octal: true
14 changes: 14 additions & 0 deletions .trunk/configs/svgo.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default {
plugins: [
{
name: "preset-default",
params: {
overrides: {
removeViewBox: false, // https://github.com/svg/svgo/issues/1128
sortAttrs: true,
removeOffCanvasPaths: true,
},
},
},
],
}
42 changes: 42 additions & 0 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This file controls the behavior of Trunk: https://docs.trunk.io/cli
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
version: 0.1
cli:
version: 1.24.0
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
plugins:
sources:
- id: trunk
ref: v1.7.1
uri: https://github.com/trunk-io/plugins
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
runtimes:
enabled:
- go@1.21.0
- node@22.16.0
- python@3.10.8
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
lint:
enabled:
- actionlint@1.7.7
- checkov@3.2.457
- eslint@8.57.0
- git-diff-check
- hadolint@2.12.1-beta
- markdownlint@0.45.0
- osv-scanner@2.0.3
- oxipng@9.1.5
- prettier@3.6.2
- shellcheck@0.10.0
- shfmt@3.6.0
- svgo@4.0.0
- taplo@0.9.3
- trufflehog@3.90.2
- yamllint@1.37.1
actions:
disabled:
- trunk-announce
- trunk-check-pre-push
- trunk-fmt-pre-commit
enabled:
- trunk-upgrade-available
60 changes: 27 additions & 33 deletions api/src/services/email.service.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
import * as aws from '@aws-sdk/client-sesv2';
import { HttpService } from '@nestjs/axios';
import { Inject, Injectable, Logger } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { HttpService } from '@nestjs/axios';
import {
LanguagesEnum,
ListingEventsTypeEnum,
ReviewOrderTypeEnum,
} from '@prisma/client';
import dayjs from 'dayjs';
import advanced from 'dayjs/plugin/advancedFormat';
import tz from 'dayjs/plugin/timezone';
import utc from 'dayjs/plugin/utc';
import fs from 'fs';
import Handlebars from 'handlebars';
import juice from 'juice';
import Polyglot from 'node-polyglot';
import { firstValueFrom } from 'rxjs';
import path from 'path';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import tz from 'dayjs/plugin/timezone';
import advanced from 'dayjs/plugin/advancedFormat';
import * as aws from '@aws-sdk/client-sesv2';
import { TranslationService } from './translation.service';
import { JurisdictionService } from './jurisdiction.service';
import { firstValueFrom } from 'rxjs';
import { ApplicationCreate } from '../dtos/applications/application-create.dto';
import { Jurisdiction } from '../dtos/jurisdictions/jurisdiction.dto';
import {
LanguagesEnum,
ListingEventsTypeEnum,
ReviewOrderTypeEnum,
} from '@prisma/client';
import { IdDTO } from '../dtos/shared/id.dto';
import { Listing } from '../dtos/listings/listing.dto';
import { ApplicationCreate } from '../dtos/applications/application-create.dto';
import { User } from '../dtos/users/user.dto';
import { IdDTO } from '../dtos/shared/id.dto';
import Unit from '../dtos/units/unit.dto';
import { User } from '../dtos/users/user.dto';
import { getPublicEmailURL } from '../utilities/get-public-email-url';

dayjs.extend(utc);
dayjs.extend(tz);
Comment on lines -30 to -31

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: is there a reason these lines were deleted? We added these to add additional options for dayjs

import { JurisdictionService } from './jurisdiction.service';
import { TranslationService } from './translation.service';
dayjs.extend(advanced);

type listingInfo = {
Expand All @@ -53,7 +50,7 @@ export class EmailService {
private logger = new Logger(EmailService.name),
) {
const sesClient = new aws.SESv2Client({
region: process.env.AWS_REGION,
region: process.env.SES_REGION || process.env.AWS_REGION,
});

this.client = sesClient;
Expand Down Expand Up @@ -138,7 +135,7 @@ export class EmailService {

// juice inlines css to allow for email styling
const inlineHtml = juice(rawHtml);
const govEmailXml = `<bulletin>\n <subject>${subject}</subject>\n <body><![CDATA[\n
const govEmailXml = `<bulletin>\n <subject>${subject}</subject>\n <body><![CDATA[\n
${inlineHtml}\n ]]></body>\n <sms_body nil='true'></sms_body>\n <from_address_id>${fromEmailAddress}</from_address_id>\n <publish_rss type='boolean'>false</publish_rss>\n <open_tracking type='boolean'>true</open_tracking>\n <click_tracking type='boolean'>true</click_tracking>\n <share_content_enabled type='boolean'>true</share_content_enabled>\n <topics type='array'>\n <topic>\n <code>${GOVDELIVERY_TOPIC}</code>\n </topic>\n </topics>\n <categories type='array' />\n </bulletin>`;

await firstValueFrom(
Expand Down Expand Up @@ -177,8 +174,8 @@ export class EmailService {
},
Text: mailOptions.text
? {
Data: mailOptions.text,
}
Data: mailOptions.text,
}
: undefined,
},
},
Expand Down Expand Up @@ -659,9 +656,8 @@ export class EmailService {
);
tableRows.push({
label: this.polyglot.t(`rentalOpportunity.${key}`),
value: `${bedroom?.length} unit${
bedroom.length > 1 ? 's' : ''
}${bathroomstring}${sqFtString}`,
value: `${bedroom?.length} unit${bedroom.length > 1 ? 's' : ''
}${bathroomstring}${sqFtString}`,
});
});
if (units?.rent?.length) {
Expand Down Expand Up @@ -854,9 +850,8 @@ export class EmailService {
formatPricing = (values: number[]): string => {
const minPrice = Math.min(...values);
const maxPrice = Math.max(...values);
return `$${minPrice.toLocaleString()}${
minPrice !== maxPrice ? ' - $' + maxPrice.toLocaleString() : ''
} per month`;
return `$${minPrice.toLocaleString()}${minPrice !== maxPrice ? ' - $' + maxPrice.toLocaleString() : ''
} per month`;
};

formatUnitDetails = (
Expand All @@ -874,9 +869,8 @@ export class EmailService {
if (mappedField?.length) {
const minValue = Math.min(...mappedField);
const maxValue = Math.max(...mappedField);
return `, ${minValue.toLocaleString()}${
minValue !== maxValue ? ' - ' + maxValue.toLocaleString() : ''
} ${pluralLabel && maxValue === 1 ? pluralLabel : label}`;
return `, ${minValue.toLocaleString()}${minValue !== maxValue ? ' - ' + maxValue.toLocaleString() : ''
} ${pluralLabel && maxValue === 1 ? pluralLabel : label}`;
}
return '';
};
Expand Down
19 changes: 13 additions & 6 deletions build/docker/Dockerfile.backend
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ COPY --from=source --chown=node:node \
/app/api/yarn*.lock \
/app/api/prisma ./


# Add only dependencies required to run the application
COPY --from=optimize --chown=node:node /app/node_modules ./node_modules
RUN yarn prisma generate
Expand All @@ -126,12 +127,16 @@ RUN mkdir ./src
RUN mkdir ./src/temp
RUN chmod 777 ./src/temp

# Copy and set permissions for entrypoint script as root
COPY build/docker/entrypoint-run.sh /app/api/entrypoint-run.sh
RUN chown node:node /app/api/entrypoint-run.sh
RUN chmod 755 /app/api/entrypoint-run.sh

# When running this image, make sure to use the built-in node user
USER node

RUN yarn prisma generate

CMD yarn start:prod
ENTRYPOINT [ "/app/api/entrypoint-run.sh" ]

#####################
##### NEW STAGE #####
Expand Down Expand Up @@ -159,10 +164,12 @@ COPY --from=source --chown=node:node /app/api/src ./src
COPY --from=source --chown=node:node /app/api/prisma ./prisma
COPY --from=source --chown=node:node /app/api/scripts ./scripts


COPY build/docker/entrypoint-migrate.sh /app/api/entrypoint-migrate.sh
RUN chown node:node /app/api/entrypoint-migrate.sh
RUN chmod 755 /app/api/entrypoint-migrate.sh
## This CMD should be run as the node user
USER node
RUN yarn prisma generate

# We need to skip all migrations that are just for local development (changes already exist in deployed environment)
CMD if [ "$SKIP_MIGRATIONS" = TRUE ]; then yarn db:migration:skip 00_init || true && yarn db:migration:skip 02_hba_to_prisma || true && yarn db:migration:skip 03_0_external_listing || true && yarn db:migration:run; \
else yarn db:migration:run; \
fi
ENTRYPOINT [ "/app/api/entrypoint-migrate.sh" ]
28 changes: 28 additions & 0 deletions build/docker/entrypoint-migrate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh
# Debug the individual secret values
echo "PGUSER: $PGUSER"
echo "PGHOST: $PGHOST"
echo "PGPORT: $PGPORT"
echo "PGDATABASE: $PGDATABASE"
echo "PGPASSWORD length: ${#PGPASSWORD}"

# Validate port is numeric
if ! echo "$PGPORT" | grep -qE '^[0-9]+$'; then
echo "ERROR: PGPORT is not a valid number: '$PGPORT'"
exit 1
fi

# URL encode the password to handle special characters
ENCODED_PASSWORD=$(node -e "console.log(encodeURIComponent('$PGPASSWORD'))")

export DATABASE_URL="postgresql://${PGUSER}:${ENCODED_PASSWORD}@${PGHOST}:${PGPORT}/${PGDATABASE}"
echo "DATABASE_URL (password masked): postgresql://${PGUSER}:***@${PGHOST}:${PGPORT}/${PGDATABASE}"


if [ "$SKIP_MIGRATIONS" = TRUE ];then
echo "Skipping Migrations"
yarn db:migration:skip 00_init || true && yarn db:migration:skip 02_hba_to_prisma || true && yarn db:migration:skip 03_0_external_listing || true && yarn db:migration:run;
else
echo "Running migrations...${MIGRATION_CMD}";
yarn ${MIGRATION_CMD};
fi
23 changes: 23 additions & 0 deletions build/docker/entrypoint-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

# Debug the individual secret values
echo "PGUSER: $PGUSER"
echo "PGHOST: $PGHOST"
echo "PGPORT: $PGPORT"
echo "PGDATABASE: $PGDATABASE"
echo "PGPASSWORD length: ${#PGPASSWORD}"

# Validate port is numeric
if ! echo "$PGPORT" | grep -qE '^[0-9]+$'; then
echo "ERROR: PGPORT is not a valid number: '$PGPORT'"
exit 1
fi

# URL encode the password to handle special characters
ENCODED_PASSWORD=$(node -e "console.log(encodeURIComponent('$PGPASSWORD'))")

export DATABASE_URL="postgresql://${PGUSER}:${ENCODED_PASSWORD}@${PGHOST}:${PGPORT}/${PGDATABASE}"
echo "DATABASE_URL (password masked): postgresql://${PGUSER}:***@${PGHOST}:${PGPORT}/${PGDATABASE}"

echo "Starting Service..."
yarn start:prod
8 changes: 8 additions & 0 deletions cdk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.js
!jest.config.js
*.d.ts
node_modules

# CDK asset staging directory
.cdk.staging
cdk.out
6 changes: 6 additions & 0 deletions cdk/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.ts
!*.d.ts

# CDK asset staging directory
.cdk.staging
cdk.out
26 changes: 26 additions & 0 deletions cdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Doorway App CDK Project

This project uses [CDK](https://aws.amazon.com/cdk/) to deploy the ECS tasks and services to AWS. This presumes that you have already deployed [doorway-infra](https://github.com/metrotranscom/doorway-infra) to the environment.

The `cdk.json` file tells the CDK Toolkit how to execute your app.

# Necessary workstation setup

You will need the following things set up before you work with the code in this repo:

- A Typescript IDE like VS Code.
- NodeJS - currently version 22 - I reccomend using [NVM](https://github.com/nvm-sh/nvm).
- The [AWS CLI](https://aws.amazon.com/cli/).
- The [AWS CDK](https://docs.aws.amazon.com/cdk/v2/guide/getting-started.html)
- [Yarn](https://yarnpkg.com/)

## Useful commands

- `yarn test` Perform the jest unit tests.
- `cdk synth` emits the synthesized CloudFormation template. This is also good to use on your local
workstation to make sure your CDK code hangs together. **This doesn't touch the actual AWS
infrastructure.**
- `cdk deploy DoorwayBuildPipelineStack` This deploys the Doorway application delivery pipeline. **This impacts AWS and will only work if you have the proper access and have configured your AWS credentials file.**
- `cdk deploy DoorwayAppEnvironmentStack` This deploys a Doorway application. You will likely need to be an AWS admin to run this. You will also need to set an an environment variable named ENVIRONMENT. and a ".env" file named [$ENVIRONMENT].env for the scriot to load. **This impacts AWS and will only work if you have the proper access and have configured your AWS credentials file.**
- `cdk diff` compare deployed stack with current state

29 changes: 29 additions & 0 deletions cdk/bin/doorway-cdk.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import * as cdk from "aws-cdk-lib"
import { DoorwayBuildPipelineStack } from "../lib/build-pipeline/doorway-build-pipeline-stack"
import { DoorwayAppEnvironmentStack } from "../lib/doorway_environment/doorway-app-environment-stack"
import { DoorwayCloudFrontStack } from "../lib/doorway_environment/doorway-cloudfront-stack"

/**
* This script is really just a wrapper to execute the various
* stacks that make up the Doorway Application infrastructure and build pipeline.
**/
const app = new cdk.App()
const environment = process.env.ENVIRONMENT || "dev"


/** This stack creates the doorway application build pipeline **/
new DoorwayBuildPipelineStack(app, "DoorwayBuildPipelineStack", {
githubSecret: "mtc/githubSecret",
dockerHubSecret: "mtc/dockerHub",
})
/** This stack actually creates a doorway environment. */
const appStack = new DoorwayAppEnvironmentStack(app, `DoorwayAppEnvironmentStack-${environment}`, environment)

/** This stack creates the cert used by the cloudfront distribution. It sits in it's own stack because cloudfront certs have to be created in us-east-1 **/
const cfCertStack = new DoorwayCloudFrontStack(app, `DoorwayCloudFrontStack-${environment}`, {
environment: environment,
publicDomainName: process.env.PUBLIC_PORTAL_DOMAIN || `${environment}.housingbayarea.mtc.ca.gov`,
partnersDomainName: process.env.PARTNERS_PORTAL_DOMAIN || `partners.${environment}.housingbayarea.mtc.ca.gov`,
loadBalancerDnsName: appStack.loadBalancerDnsName
})

Loading