Commit 8af18641 authored by Diego Iván's avatar Diego Iván
Browse files

agregando servicio de estado

parent 5661cd3a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
export class CreateStateDto {
  name: string;
  imageURL: string;
}
+13 −0
Original line number Diff line number Diff line
import { Entity, Column, PrimaryColumn } from 'typeorm';

@Entity()
export class State {
  @PrimaryColumn()
  stateId: number;

  @Column()
  name: string;

  @Column()
  imageURL: string;
}
+11 −0
Original line number Diff line number Diff line
import { Module } from '@nestjs/common';
import { StateService } from './state.service';
import { State } from './entities/state.entity';
import { TypeOrmModule } from '@nestjs/typeorm';

@Module({
  controllers: [],
  providers: [StateService],
  imports: [TypeOrmModule.forFeature([State])],
})
export class StateModule {}
+16 −0
Original line number Diff line number Diff line
import { Injectable } from '@nestjs/common';
import { CreateStateDto } from './dto/create-state.dto';
import { InjectRepository } from '@nestjs/typeorm';
import { State } from './entities/state.entity';
import { Repository } from 'typeorm';

@Injectable()
export class StateService {
  constructor(
    @InjectRepository(State) private stateRepository: Repository<State>,
  ) {}

  async create(createStateDto: CreateStateDto) {
    await this.stateRepository.save(createStateDto);
  }
}