- Backend NestJS com 12 módulos - Frontend React com dashboard e gestão - Manuais técnico e de negócios (MD + PDF) - Workflow de aprovação com alçadas - RBAC com 6 perfis de acesso
15 lines
739 B
TypeScript
15 lines
739 B
TypeScript
import { Injectable } from '@nestjs/common';
|
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
import { Repository } from 'typeorm';
|
|
import { CentroCusto } from './entities/centro-custo.entity';
|
|
|
|
@Injectable()
|
|
export class CentrosCustoService {
|
|
constructor(@InjectRepository(CentroCusto) private repo: Repository<CentroCusto>) {}
|
|
findAll() { return this.repo.find({ where: { ativo: true } }); }
|
|
findOne(id: string) { return this.repo.findOne({ where: { id } }); }
|
|
create(data: Partial<CentroCusto>) { return this.repo.save(data); }
|
|
async update(id: string, data: Partial<CentroCusto>) { await this.repo.update(id, data); return this.findOne(id); }
|
|
async remove(id: string) { await this.repo.update(id, { ativo: false }); }
|
|
}
|