diff --git a/backend/src/admin/admin.controller.ts b/backend/src/admin/admin.controller.ts index 0d0350ccf40f0056096b8cb8d083b262aa11f7ab..16e65b95280aa2dcd6305f5e430bc98a34dbadb0 100644 --- a/backend/src/admin/admin.controller.ts +++ b/backend/src/admin/admin.controller.ts @@ -18,13 +18,6 @@ export class AdminController { return this.adminService.findOne(id.toString()); } - @Patch(':id') - update(@Param('id') id: string, @Body() updateAdminDto: UpdateAdminDto) { - return this.adminService.update(+id, updateAdminDto); - } - @Delete(':id') - remove(@Param('id') id: string) { - return this.adminService.remove(+id); - } + } diff --git a/backend/src/auth-user/auth-user.controller.ts b/backend/src/auth-user/auth-user.controller.ts index 02b71d97d1f6697a6e41b352b426e4818056fb29..8d32ba8d8e4b2e710fe203e614eff53f9366e6eb 100644 --- a/backend/src/auth-user/auth-user.controller.ts +++ b/backend/src/auth-user/auth-user.controller.ts @@ -10,7 +10,9 @@ export class AuthUserController { @Post('register') register(@Body() registerUser: RegisterDto) { + console.log(registerUser); return this.authUserService.register(registerUser); + } @HttpCode(HttpStatus.OK) diff --git a/backend/src/auth-user/auth-user.module.ts b/backend/src/auth-user/auth-user.module.ts index fbb0b3522ac03fd130eb4c6fff65fc9a30c90950..f59d9c5f084aa608bee1bde1bb784278995608c5 100644 --- a/backend/src/auth-user/auth-user.module.ts +++ b/backend/src/auth-user/auth-user.module.ts @@ -2,9 +2,13 @@ import { Module } from '@nestjs/common'; import { AuthUserService } from './auth-user.service'; import { AuthUserController } from './auth-user.controller'; import { UserService } from 'src/user/user.service'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { User } from 'src/user/entities/user.entity'; @Module({ + imports: [TypeOrmModule.forFeature([User])], controllers: [AuthUserController], providers: [AuthUserService, UserService], + exports: [UserService], }) export class AuthUserModule {} diff --git a/backend/src/auth-user/dto/registrer.dto.ts b/backend/src/auth-user/dto/registrer.dto.ts index c00276f814095c8c1d60219cb4842d61d1192106..1ec1e11d481f6a52e1f876e882f65e8d6cebfdb2 100644 --- a/backend/src/auth-user/dto/registrer.dto.ts +++ b/backend/src/auth-user/dto/registrer.dto.ts @@ -3,22 +3,22 @@ import { IsEmail, IsNumber, IsString, MinLength } from "class-validator"; export class RegisterDto { @IsString() - @MinLength(1) + @MinLength(30) name: string; @IsString() - @MinLength(1) + @MinLength(30) lastname: string; @IsEmail() email: string; - @IsNumber() - @MinLength(1) - phone: number; + @IsString() + @MinLength(10) + phone: string; @IsString() - @MinLength(6) + @MinLength(8) @Transform(({ value }) => value.trim()) password: string; diff --git a/backend/src/auth/auth-admin/auth-admin.controller.ts b/backend/src/auth/auth-admin/auth-admin.controller.ts index 56da9cd4e091fe929d8d30cb28a0717e2dc0ccde..b886107aeef26ddfd5ee211f7230ebea27f13754 100644 --- a/backend/src/auth/auth-admin/auth-admin.controller.ts +++ b/backend/src/auth/auth-admin/auth-admin.controller.ts @@ -1,15 +1,15 @@ import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common'; import { AuthAdminService } from './auth-admin.service'; -import { CreateAuthAdminDto } from './dto/login-admin.dto'; -import { UpdateAuthAdminDto } from './dto/update-auth-admin.dto'; +import { loginAdmin } from './dto/login-admin.dto'; + @Controller('auth-admin') export class AuthAdminController { constructor(private readonly authAdminService: AuthAdminService) {} @Post() - create(@Body() createAuthAdminDto: CreateAuthAdminDto) { - return this.authAdminService.create(createAuthAdminDto); + create(@Body() loginAdmin: loginAdmin) { + return this.authAdminService.create(loginAdmin); } @Get() @@ -22,13 +22,5 @@ export class AuthAdminController { return this.authAdminService.findOne(+id); } - @Patch(':id') - update(@Param('id') id: string, @Body() updateAuthAdminDto: UpdateAuthAdminDto) { - return this.authAdminService.update(+id, updateAuthAdminDto); - } - @Delete(':id') - remove(@Param('id') id: string) { - return this.authAdminService.remove(+id); - } } diff --git a/backend/src/auth/auth-admin/auth-admin.service.ts b/backend/src/auth/auth-admin/auth-admin.service.ts index 54bee0b14c84e26e1de7ff3b8dcaec45acc6ca5f..d740eb957a071964069453cf48e67faee625a92b 100644 --- a/backend/src/auth/auth-admin/auth-admin.service.ts +++ b/backend/src/auth/auth-admin/auth-admin.service.ts @@ -1,10 +1,9 @@ import { Injectable } from '@nestjs/common'; -import { CreateAuthAdminDto } from './dto/login-admin.dto'; -import { UpdateAuthAdminDto } from './dto/update-auth-admin.dto'; +import { loginAdmin } from './dto/login-admin.dto'; @Injectable() export class AuthAdminService { - create(createAuthAdminDto: CreateAuthAdminDto) { + create(loginAdmin: loginAdmin) { return 'This action adds a new authAdmin'; } @@ -16,11 +15,4 @@ export class AuthAdminService { return `This action returns a #${id} authAdmin`; } - update(id: number, updateAuthAdminDto: UpdateAuthAdminDto) { - return `This action updates a #${id} authAdmin`; - } - - remove(id: number) { - return `This action removes a #${id} authAdmin`; - } } diff --git a/backend/src/main.ts b/backend/src/main.ts index 13cad38cff92aa3b3d3ef6232306e450cadf5713..da5451cc04f610adb3ce2e90759f1f2140c105fe 100644 --- a/backend/src/main.ts +++ b/backend/src/main.ts @@ -3,6 +3,7 @@ import { AppModule } from './app.module'; async function bootstrap() { const app = await NestFactory.create(AppModule); + app.enableCors(); await app.listen(3000); } bootstrap(); diff --git a/backend/src/user/dto/create-user.dto.ts b/backend/src/user/dto/create-user.dto.ts index b9f5a75f5695ee6d4dc57cd6f2a3acd8f2824108..5a592abdb9567be9f5bdcc3751ca9f8e9ce2371e 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: number; + phone: string; } diff --git a/backend/src/user/entities/user.entity.ts b/backend/src/user/entities/user.entity.ts index 4f58986e986995086bb13eb6bc718440a1d6c26f..c8acdd87723664bab3060139cb783fb798a32724 100644 --- a/backend/src/user/entities/user.entity.ts +++ b/backend/src/user/entities/user.entity.ts @@ -1,8 +1,8 @@ -import { Column, Entity, PrimaryColumn } from "typeorm"; +import { Column, Entity, PrimaryColumn, PrimaryGeneratedColumn } from "typeorm"; @Entity() export class User { - @PrimaryColumn() + @PrimaryGeneratedColumn() idUser: number @Column() @@ -18,5 +18,5 @@ export class User { email: string @Column() - phone: number + phone: string } diff --git a/backend/src/user/user.controller.ts b/backend/src/user/user.controller.ts index cbc95ae5d7aebf4255e9fe355c6e8581cedade4e..78f29425b26588d812cd5a712cc462bbc1955eae 100644 --- a/backend/src/user/user.controller.ts +++ b/backend/src/user/user.controller.ts @@ -12,20 +12,9 @@ export class UserController { return this.userService.create(createUserDto); } - @Get() - @Get(':id') - findOne(@Param('id') id: string) { - return this.userService.findOne(id.toString()); - } + - @Patch(':id') - update(@Param('id') id: string, @Body() updateUserDto: UpdateUserDto) { - return this.userService.update(+id, updateUserDto); - } + - @Delete(':id') - remove(@Param('id') id: string) { - - return this.userService.remove(+id); - } + } diff --git a/backend/src/user/user.module.ts b/backend/src/user/user.module.ts index c20f6ad201e367e98dca26cce1fcc8a2cf183097..2693fa59186ada648d6160a485d15aa5cd84d0a8 100644 --- a/backend/src/user/user.module.ts +++ b/backend/src/user/user.module.ts @@ -3,10 +3,11 @@ import { UserService } from './user.service'; import { UserController } from './user.controller'; import { TypeOrmModule } from '@nestjs/typeorm'; import { User } from './entities/user.entity'; +import { AuthUserService } from 'src/auth-user/auth-user.service'; @Module({ imports: [TypeOrmModule.forFeature([User])], controllers: [UserController], - providers: [UserService], + providers: [UserService, AuthUserService], exports: [UserService], }) export class UserModule {} diff --git a/backend/src/user/user.service.ts b/backend/src/user/user.service.ts index 2deda19cd3ffc0f958a20dd000da7cad3c732af1..96a338dac541e2575c5f71be55fd3712cbe2eb9b 100644 --- a/backend/src/user/user.service.ts +++ b/backend/src/user/user.service.ts @@ -1,6 +1,5 @@ import { Injectable } from '@nestjs/common'; import { CreateUserDto } from './dto/create-user.dto'; -import { UpdateUserDto } from './dto/update-user.dto'; import { InjectRepository } from '@nestjs/typeorm'; import { User } from './entities/user.entity'; import { Repository } from 'typeorm'; diff --git a/fronted/aplicacionrutasturisticas/.gitignore b/fronted/aplicacionrutasturisticas/.gitignore index 29a3a5017f048d6d8e6a450eef64435ddee44fb7..e62807ca0ee3ccca955f363ac6c07d7181f88aa3 100644 --- a/fronted/aplicacionrutasturisticas/.gitignore +++ b/fronted/aplicacionrutasturisticas/.gitignore @@ -41,3 +41,6 @@ app.*.map.json /android/app/debug /android/app/profile /android/app/release + +pubspec.lock +pubspec.yaml diff --git a/fronted/aplicacionrutasturisticas/lib/config/dio.dart b/fronted/aplicacionrutasturisticas/lib/config/dio.dart index 6b9ecbe9e576003492d1db7b17e152c8727f8099..a583352765f7a8134eee70567bf92432db827bb3 100644 --- a/fronted/aplicacionrutasturisticas/lib/config/dio.dart +++ b/fronted/aplicacionrutasturisticas/lib/config/dio.dart @@ -1,16 +1,17 @@ import 'package:dio/dio.dart'; final dio = Dio(); -void Registro_Datos(String nombre, String lastname, String email, int phone, +void Registro_Datos(String nombre, String lastname, String email, String phone, String password) async { Response response; - response = await dio.post("http://localhost:3306", data: { - 'name': nombre, - 'lastname': lastname, - 'email': email, - 'phone': phone, - 'password': password + //response = await dio.get("http://172.26.128.1:3000") + response = await dio.post("http://10.2.81.72:3000/auth-user/register", data: { + "name": nombre, + "lastname": lastname, + "password": password, + "email": email, + "phone": phone, + }); - print("Hola\n"); print(response.data.toString()); } diff --git a/fronted/aplicacionrutasturisticas/lib/main.dart b/fronted/aplicacionrutasturisticas/lib/main.dart index 65f821a43081444e5b1e0814897c1d3a49177ac2..098762319c59099ce84a4c40a27e2ec96db040c3 100644 --- a/fronted/aplicacionrutasturisticas/lib/main.dart +++ b/fronted/aplicacionrutasturisticas/lib/main.dart @@ -15,9 +15,9 @@ class MyApp extends StatelessWidget { primarySwatch: Colors.indigo, visualDensity: VisualDensity.adaptivePlatformDensity, ), - initialRoute: TextFielEjemploLogin.id, + initialRoute: RegistroPage.id, routes: { - TextFielEjemploLogin.id: (_) => const TextFielEjemploLogin(), + RegistroPage.id: (_) => const RegistroPage(), }, ); } diff --git a/fronted/aplicacionrutasturisticas/lib/pages/register.dart b/fronted/aplicacionrutasturisticas/lib/pages/register.dart index 9aa7ea2744a95484e3eb136e2f2d5d17244f323f..b05dc578cc135e12acf756f66e52d058fe2e2043 100644 --- a/fronted/aplicacionrutasturisticas/lib/pages/register.dart +++ b/fronted/aplicacionrutasturisticas/lib/pages/register.dart @@ -109,7 +109,7 @@ class RegistroPageState extends State { } void precionaRegistro() { - int phoneInt = int.parse(pho); + //int phoneInt = int.parse(pho); nom = nombre.text; ape = apellido.text; ema = email.text; @@ -132,7 +132,7 @@ class RegistroPageState extends State { " \n "); if (pass == passc) { - Registro_Datos(nom, ape, ema, phoneInt, pass); + Registro_Datos(nom, ape, ema, pho, pass); } else { print("La contraseƱa es incorrecta"); }