correciones
This commit is contained in:
@@ -15,6 +15,7 @@ export class CarreraProgramaController {
|
||||
);
|
||||
}
|
||||
|
||||
// terminar delte
|
||||
@Delete()
|
||||
delete() {}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ export class CarreraProgramaService {
|
||||
});
|
||||
}
|
||||
|
||||
// Eliminar update, no tiene sentido tenerlo, me equivoque xd
|
||||
async update(attrs: Partial<CarreraPrograma>) {
|
||||
const carreraPrograma = await this.findById(attrs.id_carrera_programa);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ export class CarreraProgramaUpdateDto {
|
||||
@IsNumber()
|
||||
id_carrera_programa: number;
|
||||
|
||||
// Falta IsOptional para este y el de abajo
|
||||
@IsNumber()
|
||||
id_carrera: number;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ export class CarreraService {
|
||||
|
||||
findById(id_carrera: number) {
|
||||
return this.repository.findOne({ id_carrera }).then((carrera) => {
|
||||
if (!carrera) throw new NotFoundException('No existe esta carrera');
|
||||
if (!carrera) throw new NotFoundException('No existe esta carrera.');
|
||||
return carrera;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { IsString } from 'class-validator';
|
||||
|
||||
export class CarritoGetDto {
|
||||
// Cambiar IsString por IsNumberString
|
||||
@IsString()
|
||||
id_carrera: string;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ export class CarritoController {
|
||||
return this.carritoService.findAll();
|
||||
}
|
||||
|
||||
// Crear dto que solo espere el campo id_carrito
|
||||
@Get('carrito')
|
||||
carrito(@Query() query: CarritoGetDto) {
|
||||
return this.carritoService.findById(Number(query.id_carrito));
|
||||
|
||||
@@ -17,6 +17,7 @@ export class CarritoService {
|
||||
private institucionTipoCarritoService: InstitucionTipoCarritoService,
|
||||
) {}
|
||||
|
||||
// Eliminar carrito (argumento) de este proceso. Buscar cuantos carritos tiene el modulo de ese tipo carrito y automaticamente generar carrito
|
||||
async create(id_tipo_carrito: number, id_modulo: number, carrito: string) {
|
||||
const modulo = await this.moduloService.findById(id_modulo);
|
||||
const tipoCarrito =
|
||||
@@ -24,13 +25,13 @@ export class CarritoService {
|
||||
id_tipo_carrito,
|
||||
);
|
||||
const nuevoCarrito = this.repository.create({
|
||||
tipoCarrito,
|
||||
modulo,
|
||||
carrito,
|
||||
modulo,
|
||||
tipoCarrito,
|
||||
});
|
||||
|
||||
return this.repository
|
||||
.findOne({ carrito, modulo })
|
||||
.findOne({ carrito, modulo, tipoCarrito })
|
||||
.then((existeCarrito) => {
|
||||
if (existeCarrito)
|
||||
throw new ConflictException('Este carrito ya existe en este modulo');
|
||||
@@ -52,6 +53,7 @@ export class CarritoService {
|
||||
});
|
||||
}
|
||||
|
||||
// Toma de ejemplo la funcion que esta en /src/usuario/usuario.service.ts
|
||||
findByIdModulo(
|
||||
pagina: number,
|
||||
id_modulo: number,
|
||||
@@ -65,6 +67,7 @@ export class CarritoService {
|
||||
});
|
||||
}
|
||||
|
||||
// re hacer
|
||||
async update(attrs: Partial<Carrito>) {
|
||||
const carrito = await this.findById(attrs.id_carrito);
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ export class CarritoCreateDto {
|
||||
@IsNumber()
|
||||
id_modulo: number;
|
||||
|
||||
// Cambiar por IsString
|
||||
@IsNumber()
|
||||
carrito: string;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { IsBoolean, IsNumber, IsOptional, IsString } from 'class-validator';
|
||||
|
||||
export class CarritoUpdateDto {
|
||||
// Cambiar por IsInt
|
||||
@IsNumber()
|
||||
id_carrito: number;
|
||||
|
||||
// Solo dejar cambiar el modulo y activo, es decir quita carrito y agrega id_modulo
|
||||
@IsNumber()
|
||||
@IsOptional()
|
||||
carrito?: string;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { IsOptional, IsString } from 'class-validator';
|
||||
|
||||
export class CarritoGetDto {
|
||||
// Cambiar por IsNumberString, en todas
|
||||
@IsString()
|
||||
pagina: string;
|
||||
|
||||
// De aqui para abajo agregar IsOptional y operadro ?
|
||||
@IsString()
|
||||
id_carrito: string;
|
||||
|
||||
@@ -13,6 +15,7 @@ export class CarritoGetDto {
|
||||
@IsString()
|
||||
id_modulo: string;
|
||||
|
||||
// Cambiat por IsBooleanString
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
activo?: string;
|
||||
|
||||
@@ -18,7 +18,7 @@ export class Carrito {
|
||||
@Column({ type: Boolean, nullable: false, default: false })
|
||||
activo: boolean;
|
||||
|
||||
@Column({ type: String, nullable: false, length: 50 })
|
||||
@Column({ type: String, nullable: false, length: 4 })
|
||||
carrito: string;
|
||||
|
||||
@ManyToOne(() => Modulo, (modulo) => modulo.carritos)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { IsString } from 'class-validator';
|
||||
|
||||
export class EquipoDto {
|
||||
// Cambiar por IsString
|
||||
@IsString()
|
||||
id_equipo: string;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import { EquipoDto } from './dto/equipo.dto';
|
||||
export class EquipoController {
|
||||
constructor(private equipoService: EquipoService) {}
|
||||
|
||||
// Para cuando este listo lo de subir archivos... puede que hasta se cambie de controller
|
||||
@Post()
|
||||
cargaMasiva() {}
|
||||
|
||||
@@ -19,9 +20,11 @@ export class EquipoController {
|
||||
return this.equipoService.findById(Number(query.id_equipo));
|
||||
}
|
||||
|
||||
// Terminar uwu
|
||||
@Get('equipos')
|
||||
equiposs() {}
|
||||
|
||||
// Terminar uwu
|
||||
@Put()
|
||||
update() {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user