Skip to content

Commit 84ffed8

Browse files
committed
fix: some updates that will need to be rolled back
1 parent 8e4ceeb commit 84ffed8

4 files changed

Lines changed: 51 additions & 19 deletions

File tree

api/prisma/seed-staging.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -122,24 +122,6 @@ export const stagingSeed = async (
122122
}),
123123
});
124124

125-
for (let i = 0; i < 10000; i++) {
126-
await prismaClient.userAccounts.create({
127-
data: await userFactory({
128-
email: `yazeed.loonat+${i}@exygy.com`,
129-
confirmedAt: new Date(),
130-
jurisdictionIds: allJurisdictions,
131-
acceptedTerms: true,
132-
password: 'abcdef',
133-
notificationPreferences: {
134-
regions: ['Eastside'],
135-
},
136-
userPreferences: true,
137-
}),
138-
});
139-
if (i % 1000 === 0) {
140-
console.log(new Date(), 'I have created', i, ' users so far');
141-
}
142-
}
143125
// create a support admin
144126
await prismaClient.userAccounts.create({
145127
data: await userFactory({

api/src/controllers/listing.controller.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,19 @@ export class ListingController {
9292
return await this.listingService.list(queryParams);
9393
}
9494

95+
// TODO: REMOVE THIS
96+
@Get('makeusers')
97+
@ApiOperation({
98+
summary: 'make users',
99+
operationId: 'makeusers',
100+
})
101+
@UsePipes(new ValidationPipe(defaultValidationPipeOptions))
102+
@UseInterceptors(ClassSerializerInterceptor)
103+
@ApiOkResponse({ type: PaginatedListingDto })
104+
public async makeUsers() {
105+
return await this.listingService.makeUsers();
106+
}
107+
95108
@Post('list')
96109
@ApiOperation({
97110
summary: 'Get a paginated set of listings',

api/src/services/listing.service.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ import { doJurisdictionHaveFeatureFlagSet } from '../utilities/feature-flag-util
6868
import { addUnitGroupsSummarized } from '../utilities/unit-groups-transformations';
6969
import { ListingMultiselectQuestion } from '../dtos/listings/listing-multiselect-question.dto';
7070
import { SnapshotCreateService } from './snapshot-create.service';
71+
import { userFactory } from '../../prisma/seed-helpers/user-factory';
7172

7273
dayjs.extend(utc);
7374
dayjs.extend(tz);
@@ -3405,4 +3406,28 @@ export class ListingService implements OnModuleInit {
34053406
} as ListingMapMarker;
34063407
});
34073408
}
3409+
3410+
async makeUsers() {
3411+
const juris = await this.prisma.jurisdictions.findMany({
3412+
select: {
3413+
id: true,
3414+
name: true,
3415+
},
3416+
});
3417+
for (let i = 0; i < 10000; i++) {
3418+
await this.prisma.userAccounts.create({
3419+
data: await userFactory({
3420+
email: `yazeed.loonat+${i}@exygy.com`,
3421+
confirmedAt: new Date(),
3422+
jurisdictionIds: juris.map((elem) => elem.id),
3423+
acceptedTerms: true,
3424+
password: 'abcdef',
3425+
notificationPreferences: {
3426+
regions: ['Eastside'],
3427+
},
3428+
userPreferences: true,
3429+
}),
3430+
});
3431+
}
3432+
}
34083433
}

shared-helpers/src/types/backend-swagger.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,18 @@ export class ListingsService {
252252
axios(configs, resolve, reject)
253253
})
254254
}
255+
/**
256+
* make users
257+
*/
258+
makeusers(options: IRequestOptions = {}): Promise<PaginatedListing> {
259+
return new Promise((resolve, reject) => {
260+
let url = basePath + "/listings/makeusers"
261+
262+
const configs: IRequestConfig = getConfigs("get", "application/json", url, options)
263+
264+
axios(configs, resolve, reject)
265+
})
266+
}
255267
/**
256268
* Get a paginated set of listings
257269
*/
@@ -3420,7 +3432,7 @@ export interface ListingFilterParams {
34203432
availability?: FilterAvailabilityEnum
34213433

34223434
/** */
3423-
bathrooms?: number
3435+
bathrooms?: []
34243436

34253437
/** */
34263438
bedrooms?: number

0 commit comments

Comments
 (0)