added nombreTransaccion and pagoPatronato
This commit is contained in:
@@ -9,6 +9,8 @@ import { AbonoTicketModule } from './abono-ticket/abono-ticket.module';
|
||||
import { PagoKioscoModule } from './pago-kiosco/pago-kiosco.module';
|
||||
import { KioscoModule } from './kiosco/kiosco.module';
|
||||
import { OperationsModule } from './operations/operations.module';
|
||||
import { PagoPatronatoModule } from './pago-patronato/pago-patronato.module';
|
||||
import { NombreTransaccionModule } from './nombre-transaccion/nombre-transaccion.module';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
@@ -36,6 +38,8 @@ import { OperationsModule } from './operations/operations.module';
|
||||
PagoKioscoModule,
|
||||
KioscoModule,
|
||||
OperationsModule,
|
||||
PagoPatronatoModule,
|
||||
NombreTransaccionModule,
|
||||
],
|
||||
controllers: [AppController],
|
||||
providers: [AppService],
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';
|
||||
import { PagoKiosco } from 'src/pago-kiosco/entities/pago-kiosco.entity';
|
||||
import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Entity('Kiosco')
|
||||
export class Kiosco {
|
||||
@PrimaryGeneratedColumn({ type: 'int' })
|
||||
idKiosco: number;
|
||||
@@ -37,4 +38,7 @@ export class Kiosco {
|
||||
|
||||
@Column({ type: 'tinyint', width: 1, default: 0 })
|
||||
activado: boolean;
|
||||
|
||||
@OneToMany(() => PagoKiosco, (pagokiosco) => pagokiosco.kiosco)
|
||||
pagoKiosco: PagoKiosco[];
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export class CreateNombreTransaccionDto {}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { PartialType } from '@nestjs/mapped-types';
|
||||
import { CreateNombreTransaccionDto } from './create-nombre-transaccion.dto';
|
||||
|
||||
export class UpdateNombreTransaccionDto extends PartialType(CreateNombreTransaccionDto) {}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Transaccion } from 'src/transaccion/entities/transaccion.entity';
|
||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
@Entity('NombreTransaccion')
|
||||
export class NombreTransaccion {
|
||||
@PrimaryGeneratedColumn()
|
||||
idNombreTransaccion: number;
|
||||
|
||||
@Column({ type: 'varchar', length: '50' })
|
||||
nombreTransaccion: string;
|
||||
|
||||
@OneToMany(() => Transaccion, (transaccion) => transaccion.nombreTransaccion)
|
||||
transacciones: Transaccion[];
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { NombreTransaccionController } from './nombre-transaccion.controller';
|
||||
import { NombreTransaccionService } from './nombre-transaccion.service';
|
||||
|
||||
describe('NombreTransaccionController', () => {
|
||||
let controller: NombreTransaccionController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [NombreTransaccionController],
|
||||
providers: [NombreTransaccionService],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<NombreTransaccionController>(NombreTransaccionController);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Body,
|
||||
Patch,
|
||||
Param,
|
||||
Delete,
|
||||
} from '@nestjs/common';
|
||||
import { NombreTransaccionService } from './nombre-transaccion.service';
|
||||
import { CreateNombreTransaccionDto } from './dto/create-nombre-transaccion.dto';
|
||||
|
||||
@Controller('nombre-transaccion')
|
||||
export class NombreTransaccionController {
|
||||
constructor(
|
||||
private readonly nombreTransaccionService: NombreTransaccionService,
|
||||
) {}
|
||||
|
||||
@Get()
|
||||
findAll() {
|
||||
return this.nombreTransaccionService.findAll();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { NombreTransaccionService } from './nombre-transaccion.service';
|
||||
import { NombreTransaccionController } from './nombre-transaccion.controller';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { NombreTransaccion } from './entities/nombre-transaccion.entity';
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([NombreTransaccion])],
|
||||
controllers: [NombreTransaccionController],
|
||||
providers: [NombreTransaccionService],
|
||||
})
|
||||
export class NombreTransaccionModule {}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { NombreTransaccionService } from './nombre-transaccion.service';
|
||||
|
||||
describe('NombreTransaccionService', () => {
|
||||
let service: NombreTransaccionService;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [NombreTransaccionService],
|
||||
}).compile();
|
||||
|
||||
service = module.get<NombreTransaccionService>(NombreTransaccionService);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,30 @@
|
||||
import { Injectable, NotFoundException } from '@nestjs/common';
|
||||
import { CreateNombreTransaccionDto } from './dto/create-nombre-transaccion.dto';
|
||||
import { UpdateNombreTransaccionDto } from './dto/update-nombre-transaccion.dto';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { NombreTransaccion } from './entities/nombre-transaccion.entity';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
@Injectable()
|
||||
export class NombreTransaccionService {
|
||||
constructor(
|
||||
@InjectRepository(NombreTransaccion)
|
||||
private readonly nombreTransaccionRepository: Repository<NombreTransaccion>,
|
||||
) {}
|
||||
|
||||
findAll() {
|
||||
return this.nombreTransaccionRepository.find();
|
||||
}
|
||||
|
||||
findById(idNombreTransaccion: number): Promise<NombreTransaccion | null> {
|
||||
const nameTransaccion = this.nombreTransaccionRepository.findOne({
|
||||
where: { idNombreTransaccion },
|
||||
});
|
||||
|
||||
if (!nameTransaccion) {
|
||||
throw new NotFoundException('name transaccion not found');
|
||||
}
|
||||
|
||||
return nameTransaccion;
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ export class OperationsService {
|
||||
const today = new Date().toString();
|
||||
|
||||
const transaccion = {
|
||||
idNombreTransaccion: 1,
|
||||
idNombreTransaccion: 3,
|
||||
idPersona,
|
||||
fecha: today,
|
||||
tipoTransaccion: 2,
|
||||
|
||||
@@ -4,34 +4,10 @@ import {
|
||||
Column,
|
||||
ManyToOne,
|
||||
JoinColumn,
|
||||
OneToMany,
|
||||
} from 'typeorm';
|
||||
import { Transaccion } from 'src/transaccion/entities/transaccion.entity'; // ajusta la ruta
|
||||
import { Kiosco } from 'src/kiosco/entities/kiosco.entity';
|
||||
|
||||
@Entity()
|
||||
export class PagoPatronato {
|
||||
@PrimaryGeneratedColumn({ type: 'int' })
|
||||
idPagoPatronato: number;
|
||||
|
||||
@Column({ type: 'varchar', length: 30 })
|
||||
numeroTicket: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 30 })
|
||||
folio: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 50 })
|
||||
importeLetra: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 30 })
|
||||
fechaPago: string;
|
||||
|
||||
@Column({ type: 'datetime', nullable: true })
|
||||
fechaEnvio: Date;
|
||||
|
||||
@OneToMany(() => PagoKiosco, (pagokiosco) => pagokiosco.pagoPatronato)
|
||||
pagoKiosco: PagoKiosco[];
|
||||
}
|
||||
import { PagoPatronato } from 'src/pago-patronato/entities/pago-patronato.entity';
|
||||
|
||||
@Entity('PagoKiosco')
|
||||
export class PagoKiosco {
|
||||
@@ -40,6 +16,7 @@ export class PagoKiosco {
|
||||
|
||||
@ManyToOne(() => Transaccion, (transacccion) => transacccion.pagoKiosco, {
|
||||
onDelete: 'CASCADE',
|
||||
eager: true,
|
||||
})
|
||||
@JoinColumn({ name: 'idTransaccion' })
|
||||
transaccion: Transaccion;
|
||||
@@ -64,12 +41,14 @@ export class PagoKiosco {
|
||||
|
||||
@ManyToOne(() => PagoPatronato, (pago) => pago.pagoKiosco, {
|
||||
onDelete: 'CASCADE',
|
||||
eager: true,
|
||||
})
|
||||
@JoinColumn({ name: 'idPagoPatronato' })
|
||||
pagoPatronato: PagoPatronato;
|
||||
|
||||
@ManyToOne(() => Kiosco, (kiosco) => kiosco.idKiosco, {
|
||||
@ManyToOne(() => Kiosco, (kiosco) => kiosco.pagoKiosco, {
|
||||
onDelete: 'CASCADE',
|
||||
eager: true,
|
||||
})
|
||||
@JoinColumn({ name: 'idKiosco' })
|
||||
kiosco: Kiosco;
|
||||
|
||||
@@ -18,4 +18,9 @@ export class PagoKioscoController {
|
||||
create(@Body() createPagoKioscoDto: CreatePagoKioscoDto) {
|
||||
return this.pagoKioscoService.create(createPagoKioscoDto);
|
||||
}
|
||||
|
||||
@Get()
|
||||
all() {
|
||||
return this.pagoKioscoService.all();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,10 @@ export class PagoKioscoService {
|
||||
private readonly pagoKioscoRepository: Repository<PagoKiosco>,
|
||||
) {}
|
||||
|
||||
async all() {
|
||||
return this.pagoKioscoRepository.find();
|
||||
}
|
||||
|
||||
async create(createPagoKiosco: CreatePagoKioscoDto) {
|
||||
const create = this.pagoKioscoRepository.create(createPagoKiosco);
|
||||
await this.pagoKioscoRepository.save(create);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export class CreatePagoPatronatoDto {}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { PartialType } from '@nestjs/mapped-types';
|
||||
import { CreatePagoPatronatoDto } from './create-pago-patronato.dto';
|
||||
|
||||
export class UpdatePagoPatronatoDto extends PartialType(CreatePagoPatronatoDto) {}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { PagoKiosco } from 'src/pago-kiosco/entities/pago-kiosco.entity';
|
||||
import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm';
|
||||
|
||||
@Entity('PagoPatronato')
|
||||
export class PagoPatronato {
|
||||
@PrimaryGeneratedColumn({ name: 'idPagoPatronato', type: 'int' })
|
||||
idPagoPatronato: number;
|
||||
|
||||
@Column({ name: 'numeroTicket', type: 'varchar', length: 30 })
|
||||
numeroTicket: string;
|
||||
|
||||
@Column({ name: 'folio', type: 'varchar', length: 30 })
|
||||
folio: string;
|
||||
|
||||
@Column({ name: 'importeLetra', type: 'varchar', length: 50 })
|
||||
importeLetra: string;
|
||||
|
||||
@Column({ name: 'fechaPago', type: 'varchar', length: 30 })
|
||||
fechaPago: string;
|
||||
|
||||
@Column({ name: 'fechaEnvio', type: 'datetime' })
|
||||
fechaEnvio: Date;
|
||||
|
||||
@OneToMany(() => PagoKiosco, (pagokiosco) => pagokiosco.pagoPatronato)
|
||||
pagoKiosco: PagoKiosco[];
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { PagoPatronatoController } from './pago-patronato.controller';
|
||||
import { PagoPatronatoService } from './pago-patronato.service';
|
||||
|
||||
describe('PagoPatronatoController', () => {
|
||||
let controller: PagoPatronatoController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [PagoPatronatoController],
|
||||
providers: [PagoPatronatoService],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<PagoPatronatoController>(PagoPatronatoController);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Body,
|
||||
Patch,
|
||||
Param,
|
||||
Delete,
|
||||
} from '@nestjs/common';
|
||||
import { PagoPatronatoService } from './pago-patronato.service';
|
||||
|
||||
@Controller('pago-patronato')
|
||||
export class PagoPatronatoController {
|
||||
constructor(private readonly pagoPatronatoService: PagoPatronatoService) {}
|
||||
|
||||
@Get()
|
||||
findAll() {
|
||||
return this.pagoPatronatoService.findAll();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { PagoPatronatoService } from './pago-patronato.service';
|
||||
import { PagoPatronatoController } from './pago-patronato.controller';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { PagoPatronato } from './entities/pago-patronato.entity';
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([PagoPatronato])],
|
||||
controllers: [PagoPatronatoController],
|
||||
providers: [PagoPatronatoService],
|
||||
})
|
||||
export class PagoPatronatoModule {}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { PagoPatronatoService } from './pago-patronato.service';
|
||||
|
||||
describe('PagoPatronatoService', () => {
|
||||
let service: PagoPatronatoService;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [PagoPatronatoService],
|
||||
}).compile();
|
||||
|
||||
service = module.get<PagoPatronatoService>(PagoPatronatoService);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { CreatePagoPatronatoDto } from './dto/create-pago-patronato.dto';
|
||||
import { UpdatePagoPatronatoDto } from './dto/update-pago-patronato.dto';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { PagoPatronato } from './entities/pago-patronato.entity';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
@Injectable()
|
||||
export class PagoPatronatoService {
|
||||
constructor(
|
||||
@InjectRepository(PagoPatronato)
|
||||
private readonly pagoPatronatoRepository: Repository<PagoPatronato>,
|
||||
) {}
|
||||
|
||||
findAll() {
|
||||
return this.pagoPatronatoRepository.find();
|
||||
}
|
||||
}
|
||||
@@ -9,18 +9,7 @@ import {
|
||||
import { Persona } from 'src/persona/entities/persona.entity'; // ajusta la ruta según tu estructura
|
||||
import { AbonoTicket } from 'src/abono-ticket/entities/abono-ticket.entity';
|
||||
import { PagoKiosco } from 'src/pago-kiosco/entities/pago-kiosco.entity';
|
||||
|
||||
@Entity('NombreTransaccion')
|
||||
export class NombreTransaccion {
|
||||
@PrimaryGeneratedColumn()
|
||||
idNombreTransaccion: number;
|
||||
|
||||
@Column({ type: 'varchar', length: '50' })
|
||||
nombreTransaccion: string;
|
||||
|
||||
@OneToMany(() => Transaccion, (transaccion) => transaccion.nombreTransaccion)
|
||||
transacciones: Transaccion[];
|
||||
}
|
||||
import { NombreTransaccion } from 'src/nombre-transaccion/entities/nombre-transaccion.entity';
|
||||
|
||||
@Entity('Transaccion')
|
||||
export class Transaccion {
|
||||
@@ -30,11 +19,12 @@ export class Transaccion {
|
||||
@ManyToOne(
|
||||
() => NombreTransaccion,
|
||||
(nombreTransaccion) => nombreTransaccion.transacciones,
|
||||
{ eager: true },
|
||||
)
|
||||
@JoinColumn({ name: 'idNombreTransaccion' })
|
||||
nombreTransaccion: NombreTransaccion;
|
||||
|
||||
@ManyToOne(() => Persona, (people) => people.transacciones)
|
||||
@ManyToOne(() => Persona, (people) => people.transacciones, { eager: true })
|
||||
@JoinColumn({ name: 'idPersona' })
|
||||
persona: Persona;
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ export class TransaccionService {
|
||||
}
|
||||
|
||||
async create(createTransaccion: CreateTransaccionDto): Promise<Transaccion> {
|
||||
const { idNombreTransaccion } = createTransaccion;
|
||||
|
||||
const create = this.transaccionRepository.create(createTransaccion);
|
||||
return await this.transaccionRepository.save(create);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user