feat: implement supplier management module with create, update, find, and delete functionalities
- Added CreateSupplierDto for supplier creation - Added UpdateSupplierDto for supplier updates - Implemented SuppliersController to handle HTTP requests for suppliers - Created SuppliersService to manage supplier data using Prisma - Integrated SuppliersModule to encapsulate suppliers-related components
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { PrismaService } from '../prisma/prisma.service'
|
||||
|
||||
@Injectable()
|
||||
export class SuppliersService {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
|
||||
create(data: any) {
|
||||
return this.prisma.supplier.create({ data })
|
||||
}
|
||||
|
||||
findAll() {
|
||||
return this.prisma.supplier.findMany()
|
||||
}
|
||||
|
||||
findOne(id: number) {
|
||||
return this.prisma.supplier.findUnique({ where: { id } })
|
||||
}
|
||||
|
||||
update(id: number, data: any) {
|
||||
return this.prisma.supplier.update({ where: { id }, data })
|
||||
}
|
||||
|
||||
remove(id: number) {
|
||||
return this.prisma.supplier.delete({ where: { id } })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user