Ajustes em data

This commit is contained in:
Matheus Albino Brunhara
2022-08-22 19:40:05 -03:00
parent d86a37613f
commit a4b3b02cf2
5 changed files with 41 additions and 14 deletions

View File

@@ -18,7 +18,7 @@ interface Request {
class CreateUserService {
public async execute({ name, lastname, email, birth_date, password }: Request): Promise<User> {
const usersRepository = getRepository(User);
const socialInformationRepository = getRepository(Social);
// const socialInformationRepository = getRepository(Social);
const checkUserEmailExists = await usersRepository.findOne({
where: { email },

View File

@@ -34,6 +34,7 @@ class UpdateUserService {
if (lastname) user.lastname = lastname
if (bio) user.bio = bio
if (email) user.email = email
if (birth_date) user.birth_date = birth_date
if (phone_number) {
const phoneAlreadyExists = await usersRepository.findOne({
@@ -44,13 +45,11 @@ class UpdateUserService {
throw new AppError('O telefone informado já está em uso por outra conta!', 409);
}
}
user.phone_number = phone_number
if (document_type) user.document_type = document_type
if (document) user.document = document
// user.birth_date = new Date(birth_date); // TODO, funciona?
await usersRepository.save(user);