Files
hefesto/backend/src/modules/centros-custo/centros-custo.service.ts
bigtux d8ca580acb HEFESTO v1.0 - Sistema de Controle Orçamentário para Facilities
- 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
2026-02-09 14:53:01 -03:00

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 }); }
}