This commit is contained in:
2026-02-04 13:49:07 +03:30
parent 5fd6611aca
commit de14d531e1
222 changed files with 7053 additions and 57956 deletions
@@ -0,0 +1,33 @@
import { Injectable } from '@nestjs/common'
import { ResponseMapper } from '../../common/response/response-mapper'
import { PrismaService } from '../../prisma/prisma.service'
@Injectable()
export class CustomersService {
constructor(private prisma: PrismaService) {}
async create(data: any) {
const item = await this.prisma.customer.create({ data })
return ResponseMapper.create(item)
}
async findAll() {
const items = await this.prisma.customer.findMany()
return ResponseMapper.list(items)
}
async findOne(id: number) {
const item = await this.prisma.customer.findUnique({ where: { id } })
if (!item) return null
return ResponseMapper.single(item)
}
async update(id: number, data: any) {
const item = await this.prisma.customer.update({ where: { id }, data })
return ResponseMapper.update(item)
}
async remove(id: number) {
const item = await this.prisma.customer.delete({ where: { id } })
return ResponseMapper.single(item)
}
}