This commit is contained in:
2026-01-14 00:05:13 +03:30
parent d046dc21ac
commit 1075dbc44f
12 changed files with 106 additions and 296 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
import { Injectable, NotFoundException, BadRequestException } from '@nestjs/common';
import { RequiredEntityData } from '@mikro-orm/core';
import { RequiredEntityData } from '@mikro-orm/core';
import { User } from '../entities/user.entity';
import { UserAddress } from '../entities/user-address.entity';
import { EntityManager } from '@mikro-orm/postgresql';
@@ -17,7 +17,7 @@ export class UserService {
private readonly em: EntityManager,
) { }
async create(dto: CreateUserDto): Promise<User> {
async getOrCreate(dto: CreateUserDto): Promise<User> {
const normalizedPhone = normalizePhone(dto.phone)
const currentUser = await this.userRepository.findOne({ phone: normalizedPhone });