fixed pago kiosco
This commit is contained in:
@@ -1,4 +1,12 @@
|
||||
import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
|
||||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Body,
|
||||
Patch,
|
||||
Param,
|
||||
Delete,
|
||||
} from '@nestjs/common';
|
||||
import { KioscoService } from './kiosco.service';
|
||||
import { CreateKioscoDto } from './dto/create-kiosco.dto';
|
||||
import { UpdateKioscoDto } from './dto/update-kiosco.dto';
|
||||
@@ -7,28 +15,8 @@ import { UpdateKioscoDto } from './dto/update-kiosco.dto';
|
||||
export class KioscoController {
|
||||
constructor(private readonly kioscoService: KioscoService) {}
|
||||
|
||||
@Post()
|
||||
create(@Body() createKioscoDto: CreateKioscoDto) {
|
||||
return this.kioscoService.create(createKioscoDto);
|
||||
}
|
||||
|
||||
@Get()
|
||||
findAll() {
|
||||
return this.kioscoService.findAll();
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
findOne(@Param('id') id: string) {
|
||||
return this.kioscoService.findOne(+id);
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
update(@Param('id') id: string, @Body() updateKioscoDto: UpdateKioscoDto) {
|
||||
return this.kioscoService.update(+id, updateKioscoDto);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
remove(@Param('id') id: string) {
|
||||
return this.kioscoService.remove(+id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { KioscoService } from './kiosco.service';
|
||||
import { KioscoController } from './kiosco.controller';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { Kiosco } from './entities/kiosco.entity';
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([Kiosco])],
|
||||
controllers: [KioscoController],
|
||||
providers: [KioscoService],
|
||||
exports: [KioscoService],
|
||||
})
|
||||
export class KioscoModule {}
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Injectable, NotFoundException } from '@nestjs/common';
|
||||
import { CreateKioscoDto } from './dto/create-kiosco.dto';
|
||||
import { UpdateKioscoDto } from './dto/update-kiosco.dto';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Kiosco } from './entities/kiosco.entity';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
@Injectable()
|
||||
export class KioscoService {
|
||||
create(createKioscoDto: CreateKioscoDto) {
|
||||
return 'This action adds a new kiosco';
|
||||
}
|
||||
|
||||
constructor(
|
||||
@InjectRepository(Kiosco)
|
||||
private readonly KioscoRepository: Repository<Kiosco>,
|
||||
) {}
|
||||
findAll() {
|
||||
return `This action returns all kiosco`;
|
||||
return this.KioscoRepository.find();
|
||||
}
|
||||
|
||||
findOne(id: number) {
|
||||
return `This action returns a #${id} kiosco`;
|
||||
}
|
||||
async findById(idKiosco: number): Promise<Kiosco> {
|
||||
const kiosco = await this.KioscoRepository.findOne({ where: { idKiosco } });
|
||||
|
||||
update(id: number, updateKioscoDto: UpdateKioscoDto) {
|
||||
return `This action updates a #${id} kiosco`;
|
||||
}
|
||||
if (!kiosco) {
|
||||
throw new NotFoundException('kiosco not found');
|
||||
}
|
||||
|
||||
remove(id: number) {
|
||||
return `This action removes a #${id} kiosco`;
|
||||
return kiosco;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user