From 99f9058db8efaed4fdb917bcd115503d7cb75a95 Mon Sep 17 00:00:00 2001 From: Anand Chowdhary Date: Fri, 30 Oct 2020 16:58:53 +0530 Subject: [PATCH] :bug: Fix registration, location --- src/modules/auth/auth.service.ts | 5 +++++ src/modules/geolocation/geolocation.service.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/auth/auth.service.ts b/src/modules/auth/auth.service.ts index 47bc318be..cd082b0ea 100644 --- a/src/modules/auth/auth.service.ts +++ b/src/modules/auth/auth.service.ts @@ -155,6 +155,11 @@ export class AuthService { create: { email: email, emailSafe }, }, }, + include: { emails: { select: { id: true } } }, + }); + await this.prisma.users.update({ + where: { id: user.id }, + data: { prefersEmail: { connect: { id: user.emails[0]?.id } } }, }); await this.sendEmailVerification(email); await this.approvedSubnetsService.approveNewSubnet(user.id, ipAddress); diff --git a/src/modules/geolocation/geolocation.service.ts b/src/modules/geolocation/geolocation.service.ts index ce4d627e1..e82188d46 100644 --- a/src/modules/geolocation/geolocation.service.ts +++ b/src/modules/geolocation/geolocation.service.ts @@ -36,7 +36,7 @@ export class GeolocationService implements OnModuleDestroy { } private async getUnsafeLocation(ipAddress: string) { - if (this.lookup) + if (!this.lookup) this.lookup = await geolite2.open('GeoLite2-City', path => { return maxmind.open(path); });