institucion tipo carrito casi terminado
This commit is contained in:
parent
104ba5c816
commit
e60e04a197
@ -1,8 +1,6 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||||
import { AppController } from './app.controller';
|
|
||||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
import { AppService } from './app.service';
|
|
||||||
|
|
||||||
import { CarritoModule } from './carrito/carrito.module';
|
import { CarritoModule } from './carrito/carrito.module';
|
||||||
import { EquipoModule } from './equipo/equipo.module';
|
import { EquipoModule } from './equipo/equipo.module';
|
||||||
@ -18,7 +16,6 @@ import { OperadorModule } from './operador/operador.module';
|
|||||||
import { PrestamoModule } from './prestamo/prestamo.module';
|
import { PrestamoModule } from './prestamo/prestamo.module';
|
||||||
import { ProgramaModule } from './programa/programa.module';
|
import { ProgramaModule } from './programa/programa.module';
|
||||||
import { StatusModule } from './status/status.module';
|
import { StatusModule } from './status/status.module';
|
||||||
import { TipoCarritoModule } from './tipo-carrito/tipo-carrito.module';
|
|
||||||
import { TipoUsuarioModule } from './tipo-usuario/tipo-usuario.module';
|
import { TipoUsuarioModule } from './tipo-usuario/tipo-usuario.module';
|
||||||
import { UsuarioModule } from './usuario/usuario.module';
|
import { UsuarioModule } from './usuario/usuario.module';
|
||||||
import { CarreraModule } from './carrera/carrera.module';
|
import { CarreraModule } from './carrera/carrera.module';
|
||||||
@ -44,7 +41,7 @@ import { Operador } from './operador/entity/operador.entity';
|
|||||||
import { Prestamo } from './prestamo/entity/prestamo.entity';
|
import { Prestamo } from './prestamo/entity/prestamo.entity';
|
||||||
import { Programa } from './programa/entity/programa.entity';
|
import { Programa } from './programa/entity/programa.entity';
|
||||||
import { Status } from './status/entity/status.entity';
|
import { Status } from './status/entity/status.entity';
|
||||||
import { TipoCarrito } from './tipo-carrito/entity/tipo-carrito.entity';
|
import { TipoCarrito } from './institucion-tipo-carrito/entity/tipo-carrito.entity';
|
||||||
import { TipoEntrada } from './tipo-entrada/entity/tipo-entrada.entity';
|
import { TipoEntrada } from './tipo-entrada/entity/tipo-entrada.entity';
|
||||||
import { TipoUsuario } from './tipo-usuario/entity/tipo-usuario.entity';
|
import { TipoUsuario } from './tipo-usuario/entity/tipo-usuario.entity';
|
||||||
import { Usuario } from './usuario/entity/usuario.entity';
|
import { Usuario } from './usuario/entity/usuario.entity';
|
||||||
@ -106,13 +103,10 @@ import { Usuario } from './usuario/entity/usuario.entity';
|
|||||||
PrestamoModule,
|
PrestamoModule,
|
||||||
ProgramaModule,
|
ProgramaModule,
|
||||||
StatusModule,
|
StatusModule,
|
||||||
TipoCarritoModule,
|
|
||||||
TipoEntradaModule,
|
TipoEntradaModule,
|
||||||
TipoUsuarioModule,
|
TipoUsuarioModule,
|
||||||
UsuarioModule,
|
UsuarioModule,
|
||||||
InstitucionTipoCarritoModule,
|
InstitucionTipoCarritoModule,
|
||||||
],
|
],
|
||||||
controllers: [AppController],
|
|
||||||
providers: [AppService],
|
|
||||||
})
|
})
|
||||||
export class AppModule {}
|
export class AppModule {}
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
} from 'typeorm';
|
} from 'typeorm';
|
||||||
import { Equipo } from '../../equipo/entity/equipo.entity';
|
import { Equipo } from '../../equipo/entity/equipo.entity';
|
||||||
import { Modulo } from '../../modulo/entity/modulo.entity';
|
import { Modulo } from '../../modulo/entity/modulo.entity';
|
||||||
import { TipoCarrito } from '../../tipo-carrito/entity/tipo-carrito.entity';
|
import { TipoCarrito } from '../../institucion-tipo-carrito/entity/tipo-carrito.entity';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class Carrito {
|
export class Carrito {
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
import { IsString } from 'class-validator';
|
||||||
|
|
||||||
|
export class InstitucionTipoCarritoCreateDto {
|
||||||
|
@IsString()
|
||||||
|
letra: string;
|
||||||
|
|
||||||
|
@IsString()
|
||||||
|
tipo_carrito: string;
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
import { IsBoolean, IsNumber } from 'class-validator';
|
||||||
|
|
||||||
|
export class InstitucionTipoCarritoUpdateDto {
|
||||||
|
@IsNumber()
|
||||||
|
id_institucion_tipo_carrito: number;
|
||||||
|
|
||||||
|
@IsBoolean()
|
||||||
|
mostar: boolean;
|
||||||
|
}
|
@ -6,7 +6,7 @@ import {
|
|||||||
PrimaryGeneratedColumn,
|
PrimaryGeneratedColumn,
|
||||||
} from 'typeorm';
|
} from 'typeorm';
|
||||||
import { Institucion } from '../../institucion/entity/institucion.entity';
|
import { Institucion } from '../../institucion/entity/institucion.entity';
|
||||||
import { TipoCarrito } from '../../tipo-carrito/entity/tipo-carrito.entity';
|
import { TipoCarrito } from './tipo-carrito.entity';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class InstitucionTipoCarrito {
|
export class InstitucionTipoCarrito {
|
||||||
@ -26,6 +26,7 @@ export class InstitucionTipoCarrito {
|
|||||||
@ManyToOne(
|
@ManyToOne(
|
||||||
() => TipoCarrito,
|
() => TipoCarrito,
|
||||||
(tipoCarrito) => tipoCarrito.institucionesTipoCarrito,
|
(tipoCarrito) => tipoCarrito.institucionesTipoCarrito,
|
||||||
|
{ eager: true },
|
||||||
)
|
)
|
||||||
@JoinColumn({ name: 'id_tipo_carrito' })
|
@JoinColumn({ name: 'id_tipo_carrito' })
|
||||||
tipoCarrito: TipoCarrito;
|
tipoCarrito: TipoCarrito;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||||
import { Carrito } from '../../carrito/entity/carrito.entity';
|
import { Carrito } from '../../carrito/entity/carrito.entity';
|
||||||
import { InstitucionTipoCarrito } from '../../institucion-tipo-carrito/entity/institucion-tipo-carrito.entity';
|
import { InstitucionTipoCarrito } from './institucion-tipo-carrito.entity';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class TipoCarrito {
|
export class TipoCarrito {
|
@ -9,7 +9,9 @@ describe('InstitucionTipoCarritoController', () => {
|
|||||||
controllers: [InstitucionTipoCarritoController],
|
controllers: [InstitucionTipoCarritoController],
|
||||||
}).compile();
|
}).compile();
|
||||||
|
|
||||||
controller = module.get<InstitucionTipoCarritoController>(InstitucionTipoCarritoController);
|
controller = module.get<InstitucionTipoCarritoController>(
|
||||||
|
InstitucionTipoCarritoController,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be defined', () => {
|
it('should be defined', () => {
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
import { Controller, Get, Put } from '@nestjs/common';
|
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
|
||||||
import { InstitucionTipoCarritoService } from './institucion-tipo-carrito.service';
|
import { InstitucionTipoCarritoService } from './institucion-tipo-carrito.service';
|
||||||
|
import { IdInstitucionDto } from '../dto/id-institucion.dto';
|
||||||
|
import { InstitucionTipoCarritoCreateDto } from './dto/institucion-tipo-carrito-create.dto';
|
||||||
|
import { InstitucionTipoCarritoUpdateDto } from './dto/institucion-tipo-carrito-update.dto';
|
||||||
|
|
||||||
@Controller('institucion-tipo-carrito')
|
@Controller('institucion-tipo-carrito')
|
||||||
export class InstitucionTipoCarritoController {
|
export class InstitucionTipoCarritoController {
|
||||||
@ -7,9 +10,28 @@ export class InstitucionTipoCarritoController {
|
|||||||
private institucionTipoCarritoService: InstitucionTipoCarritoService,
|
private institucionTipoCarritoService: InstitucionTipoCarritoService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
@Post()
|
||||||
|
create(@Body() body: InstitucionTipoCarritoCreateDto) {
|
||||||
|
return this.institucionTipoCarritoService.create(
|
||||||
|
body.letra,
|
||||||
|
body.tipo_carrito,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
get() {}
|
get() {
|
||||||
|
return this.institucionTipoCarritoService.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('tipos_carritos_institucion')
|
||||||
|
tiposCarritosInstitucion(@Query() query: IdInstitucionDto) {
|
||||||
|
return this.institucionTipoCarritoService.findAllByIdInstitucion(
|
||||||
|
Number(query.id_institucion),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Put()
|
@Put()
|
||||||
update() {}
|
update(@Body() body: InstitucionTipoCarritoUpdateDto) {
|
||||||
|
this.institucionTipoCarritoService.update(body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,14 @@ import { TypeOrmModule } from '@nestjs/typeorm';
|
|||||||
import { InstitucionTipoCarritoController } from './institucion-tipo-carrito.controller';
|
import { InstitucionTipoCarritoController } from './institucion-tipo-carrito.controller';
|
||||||
import { InstitucionTipoCarritoService } from './institucion-tipo-carrito.service';
|
import { InstitucionTipoCarritoService } from './institucion-tipo-carrito.service';
|
||||||
import { InstitucionTipoCarrito } from './entity/institucion-tipo-carrito.entity';
|
import { InstitucionTipoCarrito } from './entity/institucion-tipo-carrito.entity';
|
||||||
|
import { TipoCarrito } from './entity/tipo-carrito.entity';
|
||||||
|
import { InstitucionModule } from 'src/institucion/institucion.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [TypeOrmModule.forFeature([InstitucionTipoCarrito])],
|
imports: [
|
||||||
|
TypeOrmModule.forFeature([InstitucionTipoCarrito, TipoCarrito]),
|
||||||
|
InstitucionModule,
|
||||||
|
],
|
||||||
controllers: [InstitucionTipoCarritoController],
|
controllers: [InstitucionTipoCarritoController],
|
||||||
providers: [InstitucionTipoCarritoService],
|
providers: [InstitucionTipoCarritoService],
|
||||||
})
|
})
|
||||||
|
@ -1,4 +1,105 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import {
|
||||||
|
ConflictException,
|
||||||
|
Injectable,
|
||||||
|
NotFoundException,
|
||||||
|
} from '@nestjs/common';
|
||||||
|
import { InjectRepository } from '@nestjs/typeorm';
|
||||||
|
import { Repository } from 'typeorm';
|
||||||
|
import { InstitucionTipoCarrito } from './entity/institucion-tipo-carrito.entity';
|
||||||
|
import { TipoCarrito } from './entity/tipo-carrito.entity';
|
||||||
|
import { InstitucionService } from 'src/institucion/institucion.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class InstitucionTipoCarritoService {}
|
export class InstitucionTipoCarritoService {
|
||||||
|
constructor(
|
||||||
|
@InjectRepository(TipoCarrito)
|
||||||
|
private repositoryTipoCarrito: Repository<TipoCarrito>,
|
||||||
|
@InjectRepository(InstitucionTipoCarrito)
|
||||||
|
private repositoryInstitucionTipoCarrito: Repository<InstitucionTipoCarrito>,
|
||||||
|
private institucionService: InstitucionService,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
create(letra: string, tipo_carrito: string) {
|
||||||
|
/** Checar que no este usando la letra ni el nombre */
|
||||||
|
return this.repositoryTipoCarrito
|
||||||
|
.findOne({ letra, tipo_carrito })
|
||||||
|
.then((existeTipoCarrito) => {
|
||||||
|
if (existeTipoCarrito) {
|
||||||
|
if (letra === existeTipoCarrito.letra)
|
||||||
|
throw new ConflictException(
|
||||||
|
'Ya existe un tipo carrito con esta letra, intente con otra letra.',
|
||||||
|
);
|
||||||
|
else
|
||||||
|
throw new ConflictException(
|
||||||
|
'Ya existe un tipo carrito con este nombre, intente con otro nombre.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return this.repositoryTipoCarrito.save(
|
||||||
|
this.repositoryTipoCarrito.create({ letra, tipo_carrito }),
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.then(async (tipoCarrito) => {
|
||||||
|
const instituciones = await this.institucionService.findAll();
|
||||||
|
|
||||||
|
for (let i = 0; i < instituciones.length; i++) {
|
||||||
|
await this.repositoryInstitucionTipoCarrito.save(
|
||||||
|
this.repositoryInstitucionTipoCarrito.create({
|
||||||
|
tipoCarrito,
|
||||||
|
institucion: instituciones[i],
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return { message: 'Se creo correctamente el tipo carrito.' };
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
findAll() {
|
||||||
|
return this.repositoryTipoCarrito.find();
|
||||||
|
}
|
||||||
|
|
||||||
|
findAllByIdInstitucion(id_institucion: number) {
|
||||||
|
return this.institucionService
|
||||||
|
.findById(id_institucion)
|
||||||
|
.then((institucion) =>
|
||||||
|
this.repositoryInstitucionTipoCarrito.find({ institucion }),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
findAllByIdInstitucionMostar(id_institucion: number) {
|
||||||
|
return this.institucionService
|
||||||
|
.findById(id_institucion)
|
||||||
|
.then((institucion) =>
|
||||||
|
this.repositoryInstitucionTipoCarrito.find({
|
||||||
|
institucion,
|
||||||
|
mostrar: true,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
findById(id_institucion_tipo_carrito) {
|
||||||
|
return this.repositoryInstitucionTipoCarrito
|
||||||
|
.findOne({
|
||||||
|
id_institucion_tipo_carrito,
|
||||||
|
})
|
||||||
|
.then((institucionTipoCarrito) => {
|
||||||
|
if (!institucionTipoCarrito)
|
||||||
|
throw new NotFoundException(
|
||||||
|
'No existe esta institucion tipo carrito.',
|
||||||
|
);
|
||||||
|
return institucionTipoCarrito;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
update(attrs: Partial<InstitucionTipoCarrito>) {
|
||||||
|
return this.findById(attrs.id_institucion_tipo_carrito)
|
||||||
|
.then((institucionTipoCarrito) => {
|
||||||
|
Object.assign(institucionTipoCarrito, attrs);
|
||||||
|
return this.repositoryInstitucionTipoCarrito.save(
|
||||||
|
institucionTipoCarrito,
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.then((_) => ({
|
||||||
|
message: 'Se actualió correctamente la institucion tipo carrtio.',
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { IsNumber, IsString } from 'class-validator';
|
import { IsNumber, IsString } from 'class-validator';
|
||||||
|
|
||||||
export class ModuloCrearDto {
|
export class ModuloCreateDto {
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
id_institucion: number;
|
id_institucion: number;
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
|
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
|
||||||
import { ModuloService } from './modulo.service';
|
import { ModuloService } from './modulo.service';
|
||||||
import { IdInstitucionDto } from '../dto/id-institucion.dto';
|
import { IdInstitucionDto } from '../dto/id-institucion.dto';
|
||||||
import { ModuloCrearDto } from './dto/modulo-crear.dto';
|
import { ModuloCreateDto } from './dto/modulo-create.dto';
|
||||||
import { ModuloUpdateDto } from './dto/modulo-update.dto';
|
import { ModuloUpdateDto } from './dto/modulo-update.dto';
|
||||||
// import { Serealize } from '../interceptors/serialize.interceptor';
|
// import { Serealize } from '../interceptors/serialize.interceptor';
|
||||||
@Controller('modulo')
|
@Controller('modulo')
|
||||||
@ -9,7 +9,7 @@ export class ModuloController {
|
|||||||
constructor(private moduloService: ModuloService) {}
|
constructor(private moduloService: ModuloService) {}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
create(@Body() body: ModuloCrearDto) {
|
create(@Body() body: ModuloCreateDto) {
|
||||||
return this.moduloService.create(body.id_institucion, body.modulo);
|
return this.moduloService.create(body.id_institucion, body.modulo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,41 +11,41 @@ import { InstitucionService } from '../institucion/institucion.service';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class ModuloService {
|
export class ModuloService {
|
||||||
constructor(
|
constructor(
|
||||||
@InjectRepository(Modulo) private moduloRepository: Repository<Modulo>,
|
@InjectRepository(Modulo) private repository: Repository<Modulo>,
|
||||||
private institucionService: InstitucionService,
|
private institucionService: InstitucionService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async create(id_institucion: number, modulo: string) {
|
async create(id_institucion: number, modulo: string) {
|
||||||
const institucion = await this.institucionService.findById(id_institucion);
|
const institucion = await this.institucionService.findById(id_institucion);
|
||||||
const nuevoModulo = this.moduloRepository.create({
|
const nuevoModulo = this.repository.create({
|
||||||
institucion,
|
institucion,
|
||||||
modulo,
|
modulo,
|
||||||
});
|
});
|
||||||
|
|
||||||
return this.moduloRepository
|
return this.repository
|
||||||
.findOne({ modulo, institucion })
|
.findOne({ modulo, institucion })
|
||||||
.then((existeModulo) => {
|
.then((existeModulo) => {
|
||||||
if (existeModulo)
|
if (existeModulo)
|
||||||
throw new ConflictException(
|
throw new ConflictException(
|
||||||
'Ya existe un módulo con este nombre, intente con otro nombre.',
|
'Ya existe un módulo con este nombre, intente con otro nombre.',
|
||||||
);
|
);
|
||||||
return this.moduloRepository.save(nuevoModulo);
|
return this.repository.save(nuevoModulo);
|
||||||
})
|
})
|
||||||
.then(() => ({ message: 'Se creo correctamente el módulo.' }));
|
.then((_) => ({ message: 'Se creo correctamente el módulo.' }));
|
||||||
}
|
}
|
||||||
|
|
||||||
findAll() {
|
findAll() {
|
||||||
return this.moduloRepository.find();
|
return this.repository.find();
|
||||||
}
|
}
|
||||||
|
|
||||||
findAllByIdInstitucion(id_institucion: number) {
|
findAllByIdInstitucion(id_institucion: number) {
|
||||||
return this.institucionService
|
return this.institucionService
|
||||||
.findById(id_institucion)
|
.findById(id_institucion)
|
||||||
.then((institucion) => this.moduloRepository.find({ institucion }));
|
.then((institucion) => this.repository.find({ institucion }));
|
||||||
}
|
}
|
||||||
|
|
||||||
findById(id_modulo: number) {
|
findById(id_modulo: number) {
|
||||||
return this.moduloRepository.findOne({ id_modulo }).then((modulo) => {
|
return this.repository.findOne({ id_modulo }).then((modulo) => {
|
||||||
if (!modulo) throw new NotFoundException('No existe este módulo.');
|
if (!modulo) throw new NotFoundException('No existe este módulo.');
|
||||||
return modulo;
|
return modulo;
|
||||||
});
|
});
|
||||||
@ -54,7 +54,7 @@ export class ModuloService {
|
|||||||
async update(attrs: Partial<Modulo>) {
|
async update(attrs: Partial<Modulo>) {
|
||||||
const modulo = await this.findById(attrs.id_modulo);
|
const modulo = await this.findById(attrs.id_modulo);
|
||||||
|
|
||||||
return this.moduloRepository
|
return this.repository
|
||||||
.findOne({ modulo: attrs.modulo, institucion: modulo.institucion })
|
.findOne({ modulo: attrs.modulo, institucion: modulo.institucion })
|
||||||
.then((existeModulo) => {
|
.then((existeModulo) => {
|
||||||
if (existeModulo)
|
if (existeModulo)
|
||||||
@ -62,9 +62,9 @@ export class ModuloService {
|
|||||||
'Ya existe un módulo con este nombre, intente con otro nombre.',
|
'Ya existe un módulo con este nombre, intente con otro nombre.',
|
||||||
);
|
);
|
||||||
Object.assign(modulo, attrs);
|
Object.assign(modulo, attrs);
|
||||||
return this.moduloRepository.save(modulo);
|
return this.repository.save(modulo);
|
||||||
})
|
})
|
||||||
.then(() => ({
|
.then((_) => ({
|
||||||
message: 'Se actualizo correctamente la información del módulo.',
|
message: 'Se actualizo correctamente la información del módulo.',
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
import { Test, TestingModule } from '@nestjs/testing';
|
|
||||||
import { TipoCarritoController } from './tipo-carrito.controller';
|
|
||||||
|
|
||||||
describe('TipoCarritoController', () => {
|
|
||||||
let controller: TipoCarritoController;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
const module: TestingModule = await Test.createTestingModule({
|
|
||||||
controllers: [TipoCarritoController],
|
|
||||||
}).compile();
|
|
||||||
|
|
||||||
controller = module.get<TipoCarritoController>(TipoCarritoController);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be defined', () => {
|
|
||||||
expect(controller).toBeDefined();
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,10 +0,0 @@
|
|||||||
import { Controller, Get } from '@nestjs/common';
|
|
||||||
import { TipoCarritoService } from './tipo-carrito.service';
|
|
||||||
|
|
||||||
@Controller('tipo-carrito')
|
|
||||||
export class TipoCarritoController {
|
|
||||||
constructor(private tipoCarritoService: TipoCarritoService) {}
|
|
||||||
|
|
||||||
@Get()
|
|
||||||
get() {}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
import { Module } from '@nestjs/common';
|
|
||||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
||||||
import { TipoCarritoController } from './tipo-carrito.controller';
|
|
||||||
import { TipoCarritoService } from './tipo-carrito.service';
|
|
||||||
import { TipoCarrito } from './entity/tipo-carrito.entity';
|
|
||||||
|
|
||||||
@Module({
|
|
||||||
imports: [TypeOrmModule.forFeature([TipoCarrito])],
|
|
||||||
controllers: [TipoCarritoController],
|
|
||||||
providers: [TipoCarritoService],
|
|
||||||
})
|
|
||||||
export class TipoCarritoModule {}
|
|
@ -1,18 +0,0 @@
|
|||||||
import { Test, TestingModule } from '@nestjs/testing';
|
|
||||||
import { TipoCarritoService } from './tipo-carrito.service';
|
|
||||||
|
|
||||||
describe('TipoCarritoService', () => {
|
|
||||||
let service: TipoCarritoService;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
const module: TestingModule = await Test.createTestingModule({
|
|
||||||
providers: [TipoCarritoService],
|
|
||||||
}).compile();
|
|
||||||
|
|
||||||
service = module.get<TipoCarritoService>(TipoCarritoService);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be defined', () => {
|
|
||||||
expect(service).toBeDefined();
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,11 +0,0 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
|
||||||
import { InjectRepository } from '@nestjs/typeorm';
|
|
||||||
import { Repository } from 'typeorm';
|
|
||||||
import { TipoCarrito } from './entity/tipo-carrito.entity';
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class TipoCarritoService {
|
|
||||||
constructor(
|
|
||||||
@InjectRepository(TipoCarrito) private repository: Repository<TipoCarrito>,
|
|
||||||
) {}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user