Skip to content

Commit

Permalink
fix: cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
ludtkemorgan committed Mar 8, 2024
1 parent 58275f5 commit 585574e
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cypress_public.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
build: yarn build
start: yarn dev:new-backend, yarn start
wait-on: 'http://localhost:3100/jurisdictions'
record: true # set this value to true to record videos in cypress cloud for debugging purposes - skip passing tests
record: false # set this value to true to record videos in cypress cloud for debugging purposes - skip passing tests
env:
CYPRESS_RECORD_KEY: ${{ secrets.PUBLIC_CYPRESS_RECORD_KEY }}

Expand Down
7 changes: 7 additions & 0 deletions api/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,10 @@ CORS_ORIGINS=["http://localhost:3000", "http://localhost:3001"]
CORS_REGEX=["test1", "test2"]
# controls the repetition of the temp file clearing cron job
TEMP_FILE_CLEAR_CRON_STRING=0 * * *

# Doorway specific values
ASSET_UPLOAD_MAX_SIZE=
ASSET_FILE_SERVICE=
ASSET_FS_CONFIG_s3_REGION=
ASSET_FS_CONFIG_s3_BUCKET=
ASSET_FS_CONFIG_s3_URL_FORMAT=public
3 changes: 1 addition & 2 deletions api/prisma/seed-helpers/translation-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ const translations = (jurisdictionName?: string) => ({
footer: `${jurisdictionName || 'Bloom Housing'}`,
},
header: {
logoUrl:
'https://res.cloudinary.com/exygy/image/upload/v1692118607/core/bloom_housing_logo.png',
logoUrl: 'https://housingbayarea.mtc.ca.gov/images/doorway-logo.png',
logoTitle: 'Bloom Housing Portal',
},
invite: {
Expand Down
18 changes: 10 additions & 8 deletions api/prisma/seed-helpers/user-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ export const userFactory = async (optionalParams?: {
firstName: optionalParams?.firstName || 'First',
lastName: optionalParams?.lastName || 'Last',
passwordHash: await passwordToHash('abcdef'),
userRoles: {
create: {
isAdmin: optionalParams?.roles?.isAdmin || false,
isJurisdictionalAdmin:
optionalParams?.roles?.isJurisdictionalAdmin || false,
isPartner: optionalParams?.roles?.isPartner || false,
},
},
userRoles: optionalParams?.roles
? {
create: {
isAdmin: optionalParams?.roles?.isAdmin || false,
isJurisdictionalAdmin:
optionalParams?.roles?.isJurisdictionalAdmin || false,
isPartner: optionalParams?.roles?.isPartner || false,
},
}
: undefined,
mfaCode: optionalParams?.mfaCode || null,
mfaEnabled: optionalParams?.mfaEnabled || false,
confirmedAt: optionalParams?.confirmedAt || null,
Expand Down
9 changes: 8 additions & 1 deletion api/prisma/seed-staging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export const stagingSeed = async (
await prismaClient.jurisdictions.create({
data: jurisdictionFactory('San Francisco'),
});
// Alameda,Contra%20Costa,Marin,Napa,San%20Mateo,Santa%20Clara,Solano,Sonoma,San%20Francisco
// create admin user
await prismaClient.userAccounts.create({
data: await userFactory({
Expand Down Expand Up @@ -113,6 +112,14 @@ export const stagingSeed = async (
mfaCode: '12345',
}),
});
await prismaClient.userAccounts.create({
data: await userFactory({
email: '[email protected]',
confirmedAt: new Date(),
jurisdictionIds: [jurisdiction.id],
acceptedTerms: false,
}),
});
// add jurisdiction specific translations and default ones
await prismaClient.translations.create({
data: translationFactory(jurisdiction.id, jurisdiction.name),
Expand Down
2 changes: 1 addition & 1 deletion api/src/dtos/assets/asset.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ApiProperty } from '@nestjs/swagger';
export class Asset extends AbstractDTO {
@Expose()
@IsString({ groups: [ValidationsGroupsEnum.default] })
@MaxLength(128, { groups: [ValidationsGroupsEnum.default] })
@MaxLength(256, { groups: [ValidationsGroupsEnum.default] })
@IsDefined({ groups: [ValidationsGroupsEnum.default] })
@ApiProperty()
fileId: string;
Expand Down
16 changes: 0 additions & 16 deletions api/test/unit/services/asset.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,8 @@ describe('Testing asset service', () => {
AssetService,
PrismaService,
ConfigService,
// { provide: UploadService, useValue: {} },
{ provide: FileServiceProvider, useValue: {} },
{ provide: UploadService, useClass: CloudinaryService },
// {
// provide: FileServiceProvider,
// useFactory: (): FileServiceProvider => {
// // the constructor is where we define which service to use by default
// return (
// new FileServiceProvider(process.env.ASSET_FILE_SERVICE)
// // register the null file service
// .registerFileService('null', new NullFileService())
// // register the Amazon S3 file service
// .registerFileService('s3', new AmazonS3FileService())
// // configure() will filter out the config values we actually need
// .configure(process.env, 'ASSET_FS_CONFIG_')
// );
// },
// },
],
}).compile();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export class TranslationsService extends AbstractServiceFactory<
}

public async translateListing(listing: Listing, language: Language) {
console.log("translateListing", listing)
if (!this.googleTranslateService.isConfigured()) {
console.warn("listing translation requested, but google translate service is not configured")
return
Expand Down Expand Up @@ -158,12 +157,10 @@ export class TranslationsService extends AbstractServiceFactory<
Object.keys(listingPathsAndValues).length > 0 &&
(!persistedTranslatedValues || persistedTranslatedValues.timestamp < listing.updatedAt)
) {
console.log("newTranslation")
const newTranslations = await this.googleTranslateService.fetch(
Object.values(listingPathsAndValues),
language
)
console.log("after", newTranslations)
persistedTranslatedValues = await this.persistTranslatedValues(
persistedTranslatedValues?.id,
listing,
Expand Down
3 changes: 0 additions & 3 deletions shared-helpers/__tests__/testHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,6 @@ export const listing: Listing = {
jurisdictions: {
id: "id",
name: "San Jose",
// publicUrl: "",
// enableAccessibilityFeatures: false,
// enableUtilitiesIncluded: false,
},
depositMax: "",
disableUnitsAccordion: false,
Expand Down

0 comments on commit 585574e

Please sign in to comment.