From 10f66d9c48552bab65930981d280f541ec4bc971 Mon Sep 17 00:00:00 2001 From: Giovanna Esmeralda Chavez Espino <79319097+gio-gigi@users.noreply.github.com> Date: Thu, 2 May 2024 10:31:25 -0600 Subject: [PATCH] Se modifico un atributo del usuario para el registro --- backend/src/auth-user/auth-user.service.ts | 3 +-- backend/src/auth-user/dto/registrer.dto.ts | 7 ++++--- backend/src/user/dto/create-user.dto.ts | 2 +- backend/src/user/entities/user.entity.ts | 2 +- fronted/aplicacionrutasturisticas/.gitignore | 3 +++ .../lib/config/dio.dart | 5 ++--- .../lib/pages/register.dart | 16 +++------------- 7 files changed, 15 insertions(+), 23 deletions(-) diff --git a/backend/src/auth-user/auth-user.service.ts b/backend/src/auth-user/auth-user.service.ts index af30a90..f646844 100644 --- a/backend/src/auth-user/auth-user.service.ts +++ b/backend/src/auth-user/auth-user.service.ts @@ -13,7 +13,7 @@ export class AuthUserService { /* Metodo para registrar un usuario */ - async register({ name, lastname, email, phone, password }: RegisterDto) { + async register({ name, lastname, email, password }: RegisterDto) { const hashedPassword = await bcryptjs.hash(password, 10); const userExists = await this.userService.findOneByEmail(email); if (userExists) { @@ -23,7 +23,6 @@ export class AuthUserService { name, lastname, email, - phone, password: hashedPassword, }); return { diff --git a/backend/src/auth-user/dto/registrer.dto.ts b/backend/src/auth-user/dto/registrer.dto.ts index 1ec1e11..d4e6939 100644 --- a/backend/src/auth-user/dto/registrer.dto.ts +++ b/backend/src/auth-user/dto/registrer.dto.ts @@ -13,13 +13,14 @@ export class RegisterDto { @IsEmail() email: string; - @IsString() + @IsNumber() @MinLength(10) - phone: string; + phone: number; @IsString() @MinLength(8) @Transform(({ value }) => value.trim()) - password: string; + password: string; + } diff --git a/backend/src/user/dto/create-user.dto.ts b/backend/src/user/dto/create-user.dto.ts index 5a592ab..b9f5a75 100644 --- a/backend/src/user/dto/create-user.dto.ts +++ b/backend/src/user/dto/create-user.dto.ts @@ -3,5 +3,5 @@ export class CreateUserDto { lastname: string; password: string; email: string; - phone: string; + phone: number; } diff --git a/backend/src/user/entities/user.entity.ts b/backend/src/user/entities/user.entity.ts index c8acdd8..b363286 100644 --- a/backend/src/user/entities/user.entity.ts +++ b/backend/src/user/entities/user.entity.ts @@ -18,5 +18,5 @@ export class User { email: string @Column() - phone: string + phone: number } diff --git a/fronted/aplicacionrutasturisticas/.gitignore b/fronted/aplicacionrutasturisticas/.gitignore index e62807c..fecb9bb 100644 --- a/fronted/aplicacionrutasturisticas/.gitignore +++ b/fronted/aplicacionrutasturisticas/.gitignore @@ -44,3 +44,6 @@ app.*.map.json pubspec.lock pubspec.yaml +Flutter-Generated.xcconfig +flutter_export_environment.sh +GeneratedPluginRegistrant.swift diff --git a/fronted/aplicacionrutasturisticas/lib/config/dio.dart b/fronted/aplicacionrutasturisticas/lib/config/dio.dart index 1d44319..501bfac 100644 --- a/fronted/aplicacionrutasturisticas/lib/config/dio.dart +++ b/fronted/aplicacionrutasturisticas/lib/config/dio.dart @@ -1,17 +1,16 @@ import 'package:dio/dio.dart'; final dio = Dio(); -void Registro_Datos(String nombre, String lastname, String email, String phone, +void Registro_Datos(String nombre, String lastname, String email, String password) async { Response response; //response = await dio.get("http://172.26.128.1:3000") response = - await dio.post("http://172.31.128.1:3000/auth-user/register", data: { + await dio.post("http://192.168.1.81:3000/auth-user/register", data: { "name": nombre, "lastname": lastname, "password": password, "email": email, - "phone": phone, }); print(response.data.toString()); } diff --git a/fronted/aplicacionrutasturisticas/lib/pages/register.dart b/fronted/aplicacionrutasturisticas/lib/pages/register.dart index b05dc57..9c380e1 100644 --- a/fronted/aplicacionrutasturisticas/lib/pages/register.dart +++ b/fronted/aplicacionrutasturisticas/lib/pages/register.dart @@ -19,11 +19,11 @@ class RegistroPageState extends State { final nombre = TextEditingController(); final apellido = TextEditingController(); final email = TextEditingController(); - final phone = TextEditingController(); + final pasword = TextEditingController(); final passwordConfirmed = TextEditingController(); - String nom = "", ape = "", ema = "", pho = "", pass = "", passc = ""; + String nom = "", ape = "", ema = "", pass = "", passc = ""; @override Widget build(BuildContext context) { @@ -72,13 +72,6 @@ class RegistroPageState extends State { SizedBox( height: 20, ), - ColoredBox( - color: Colors.white, - child: hacerTextField( - controller: phone, - texto: "Numero de teléfono", - ocultar: false)), - SizedBox(height: 20), ColoredBox( color: Colors.white, child: hacerTextField( @@ -113,7 +106,6 @@ class RegistroPageState extends State { nom = nombre.text; ape = apellido.text; ema = email.text; - pho = phone.text; pass = pasword.text; passc = passwordConfirmed.text; @@ -124,15 +116,13 @@ class RegistroPageState extends State { ' ' + ema + ' ' + - pho + - ' ' + pass + ' ' + passc + " \n "); if (pass == passc) { - Registro_Datos(nom, ape, ema, pho, pass); + Registro_Datos(nom, ape, ema, pass); } else { print("La contraseña es incorrecta"); } -- GitLab