cambios
This commit is contained in:
Generated
+21
@@ -11,6 +11,7 @@
|
||||
"dependencies": {
|
||||
"@nestjs/common": "^11.1.6",
|
||||
"@nestjs/core": "^11.0.1",
|
||||
"@nestjs/mapped-types": "*",
|
||||
"@nestjs/platform-express": "^11.0.1",
|
||||
"@nestjs/typeorm": "^11.0.0",
|
||||
"class-transformer": "0.5.1",
|
||||
@@ -2399,6 +2400,26 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@nestjs/mapped-types": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/mapped-types/-/mapped-types-2.1.0.tgz",
|
||||
"integrity": "sha512-W+n+rM69XsFdwORF11UqJahn4J3xi4g/ZEOlJNL6KoW5ygWSmBB2p0S2BZ4FQeS/NDH72e6xIcu35SfJnE8bXw==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@nestjs/common": "^10.0.0 || ^11.0.0",
|
||||
"class-transformer": "^0.4.0 || ^0.5.0",
|
||||
"class-validator": "^0.13.0 || ^0.14.0",
|
||||
"reflect-metadata": "^0.1.12 || ^0.2.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"class-transformer": {
|
||||
"optional": true
|
||||
},
|
||||
"class-validator": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@nestjs/platform-express": {
|
||||
"version": "11.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/platform-express/-/platform-express-11.1.6.tgz",
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
"dependencies": {
|
||||
"@nestjs/common": "^11.1.6",
|
||||
"@nestjs/core": "^11.0.1",
|
||||
"@nestjs/mapped-types": "*",
|
||||
"@nestjs/platform-express": "^11.0.1",
|
||||
"@nestjs/typeorm": "^11.0.0",
|
||||
"class-transformer": "0.5.1",
|
||||
|
||||
+3
-1
@@ -3,6 +3,7 @@ import { AppController } from './app.controller';
|
||||
import { AppService } from './app.service';
|
||||
import {ConfigModule} from '@nestjs/config'
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { UsuariosModule } from './usuarios/usuarios.module';
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +25,8 @@ import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
synchronize:true,
|
||||
|
||||
|
||||
})
|
||||
}),
|
||||
UsuariosModule
|
||||
],
|
||||
controllers: [],
|
||||
providers: [AppService],
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export class CreateUsuarioDto {}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { PartialType } from '@nestjs/mapped-types';
|
||||
import { CreateUsuarioDto } from './create-usuario.dto';
|
||||
|
||||
export class UpdateUsuarioDto extends PartialType(CreateUsuarioDto) {}
|
||||
@@ -0,0 +1,31 @@
|
||||
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
|
||||
|
||||
|
||||
|
||||
@Entity()
|
||||
export class Usuario {
|
||||
@PrimaryGeneratedColumn()
|
||||
id_usuario: number
|
||||
|
||||
@Column({nullable:true})
|
||||
id_tipo_usuario:number
|
||||
|
||||
@Column({length:100, nullable:true})
|
||||
nombre:string
|
||||
|
||||
@Column({length:100,nullable:true})
|
||||
contraseña:string
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@Entity()
|
||||
export class Tipo_Usuario{
|
||||
|
||||
@PrimaryGeneratedColumn()
|
||||
id_tipo_usuario:number
|
||||
@Column({nullable:true})
|
||||
tipo_usuario:string
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { UsuariosController } from './usuarios.controller';
|
||||
import { UsuariosService } from './usuarios.service';
|
||||
|
||||
describe('UsuariosController', () => {
|
||||
let controller: UsuariosController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [UsuariosController],
|
||||
providers: [UsuariosService],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<UsuariosController>(UsuariosController);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,34 @@
|
||||
import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
|
||||
import { UsuariosService } from './usuarios.service';
|
||||
import { CreateUsuarioDto } from './dto/create-usuario.dto';
|
||||
import { UpdateUsuarioDto } from './dto/update-usuario.dto';
|
||||
|
||||
@Controller('usuarios')
|
||||
export class UsuariosController {
|
||||
constructor(private readonly usuariosService: UsuariosService) {}
|
||||
|
||||
@Post()
|
||||
create(@Body() createUsuarioDto: CreateUsuarioDto) {
|
||||
return this.usuariosService.create(createUsuarioDto);
|
||||
}
|
||||
|
||||
@Get()
|
||||
findAll() {
|
||||
return this.usuariosService.findAll();
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
findOne(@Param('id') id: string) {
|
||||
return this.usuariosService.findOne(+id);
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
update(@Param('id') id: string, @Body() updateUsuarioDto: UpdateUsuarioDto) {
|
||||
return this.usuariosService.update(+id, updateUsuarioDto);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
remove(@Param('id') id: string) {
|
||||
return this.usuariosService.remove(+id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { UsuariosService } from './usuarios.service';
|
||||
import { UsuariosController } from './usuarios.controller';
|
||||
|
||||
@Module({
|
||||
controllers: [UsuariosController],
|
||||
providers: [UsuariosService],
|
||||
})
|
||||
export class UsuariosModule {}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { UsuariosService } from './usuarios.service';
|
||||
|
||||
describe('UsuariosService', () => {
|
||||
let service: UsuariosService;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [UsuariosService],
|
||||
}).compile();
|
||||
|
||||
service = module.get<UsuariosService>(UsuariosService);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,26 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { CreateUsuarioDto } from './dto/create-usuario.dto';
|
||||
import { UpdateUsuarioDto } from './dto/update-usuario.dto';
|
||||
|
||||
@Injectable()
|
||||
export class UsuariosService {
|
||||
create(createUsuarioDto: CreateUsuarioDto) {
|
||||
return 'This action adds a new usuario';
|
||||
}
|
||||
|
||||
findAll() {
|
||||
return `This action returns all usuarios`;
|
||||
}
|
||||
|
||||
findOne(id: number) {
|
||||
return `This action returns a #${id} usuario`;
|
||||
}
|
||||
|
||||
update(id: number, updateUsuarioDto: UpdateUsuarioDto) {
|
||||
return `This action updates a #${id} usuario`;
|
||||
}
|
||||
|
||||
remove(id: number) {
|
||||
return `This action removes a #${id} usuario`;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user