Merge branch 'dev' into staging

This commit is contained in:
Vins 2024-02-26 11:07:43 +01:00
commit fd67d8da96
3 changed files with 14 additions and 5 deletions

View File

@ -21,7 +21,10 @@ export default class ContactRepository extends BaseRepository {
public async findSomeByEmail(email: string): Promise<(Contacts & {customers: Customers | null})[] | null> { public async findSomeByEmail(email: string): Promise<(Contacts & {customers: Customers | null})[] | null> {
return this.model.findMany({ return this.model.findMany({
where: { where: {
email: email, email: {
equals: email,
mode: "insensitive"
}
}, },
include: { customers: true } include: { customers: true }
}); });

View File

@ -27,9 +27,12 @@ export default class WhitelistRepository extends BaseRepository {
* @description : find unique by email * @description : find unique by email
*/ */
public async findOneByEmail(email: string) { public async findOneByEmail(email: string) {
return this.model.findUnique({ return this.model.findMany({
where: { where: {
email: email, email: {
equals: email,
mode: "insensitive"
}
}, },
}); });
} }

View File

@ -91,7 +91,7 @@ export default class CustomersService extends BaseService {
public async verifyEmail2FASms(email: string): Promise<{ customer: Customer; totpCode: TotpCodesResource } | null> { public async verifyEmail2FASms(email: string): Promise<{ customer: Customer; totpCode: TotpCodesResource } | null> {
// 1: Check if the customer exists // 1: Check if the customer exists
const customer = await this.getByEmail(email); const customer = await this.getByEmail(email);
if (!customer) return null; if (!customer) return null;
const now = new Date().getTime(); const now = new Date().getTime();
const customerHydrated = Customer.hydrate<Customer>(customer); const customerHydrated = Customer.hydrate<Customer>(customer);
@ -316,7 +316,10 @@ export default class CustomersService extends BaseService {
return this.customerRepository.findOne({ return this.customerRepository.findOne({
where: { where: {
contact: { contact: {
email, email:{
equals: email,
mode: 'insensitive'
}
}, },
}, },
include: { include: {