621e15dd02
- Added Create and Update DTOs for Inventory, Product Brand, Product Category, Product Info, Product, Role, Store, User, and Vendor. - Implemented InventoriesController, ProductBrandsController, ProductCategoriesController, ProductInfoController, ProductsController, RolesController, StoresController, UsersController, and VendorsController with respective CRUD endpoints. - Developed InventoriesService, ProductBrandsService, ProductCategoriesService, ProductInfoService, ProductsService, RolesService, StoresService, UsersService, and VendorsService to handle business logic. - Created PrismaModule and PrismaService for database interactions using Prisma with MariaDB adapter. - Configured application with Swagger for API documentation and added global interceptors for logging and response mapping. - Established e2e testing setup with Jest for the application.
28 lines
604 B
TypeScript
28 lines
604 B
TypeScript
import { Injectable } from '@nestjs/common'
|
|
import { PrismaService } from '../prisma/prisma.service'
|
|
|
|
@Injectable()
|
|
export class VendorsService {
|
|
constructor(private prisma: PrismaService) {}
|
|
|
|
create(data: any) {
|
|
return this.prisma.vendor.create({ data })
|
|
}
|
|
|
|
findAll() {
|
|
return this.prisma.vendor.findMany()
|
|
}
|
|
|
|
findOne(id: number) {
|
|
return this.prisma.vendor.findUnique({ where: { id } })
|
|
}
|
|
|
|
update(id: number, data: any) {
|
|
return this.prisma.vendor.update({ where: { id }, data })
|
|
}
|
|
|
|
remove(id: number) {
|
|
return this.prisma.vendor.delete({ where: { id } })
|
|
}
|
|
}
|