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,43 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `vendorId` on the `Product_info` table. All the data in the column will be lost.
|
||||
- You are about to drop the `Vendors` table. If the table is not empty, all the data it contains will be lost.
|
||||
- Added the required column `supplierId` to the `Product_info` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `Product_info` DROP FOREIGN KEY `Product_info_vendorId_fkey`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `Product_info_vendorId_fkey` ON `Product_info`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Product_info` DROP COLUMN `vendorId`,
|
||||
ADD COLUMN `supplierId` INTEGER NOT NULL;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE `Vendors`;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Suppliers` (
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`firstName` VARCHAR(255) NOT NULL,
|
||||
`lastName` VARCHAR(255) NOT NULL,
|
||||
`email` VARCHAR(255) NULL,
|
||||
`mobileNumber` CHAR(11) NOT NULL,
|
||||
`address` TEXT NULL,
|
||||
`city` VARCHAR(100) NULL,
|
||||
`state` VARCHAR(100) NULL,
|
||||
`country` VARCHAR(100) NULL,
|
||||
`isActive` BOOLEAN NOT NULL DEFAULT true,
|
||||
`createdAt` TIMESTAMP(0) NULL,
|
||||
`updatedAt` TIMESTAMP(0) NULL,
|
||||
`deletedAt` TIMESTAMP(0) NULL,
|
||||
|
||||
UNIQUE INDEX `Suppliers_mobileNumber_key`(`mobileNumber`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Product_info` ADD CONSTRAINT `Product_info_supplierId_fkey` FOREIGN KEY (`supplierId`) REFERENCES `Suppliers`(`id`) ON DELETE RESTRICT ON UPDATE NO ACTION;
|
||||
@@ -86,8 +86,8 @@ model ProductInfo {
|
||||
category ProductCategory? @relation("ProductInfo_Category", fields: [categoryId], references: [id], onUpdate: NoAction)
|
||||
categoryId Int?
|
||||
|
||||
vendor Vendor @relation("ProductInfo_Vendor", fields: [vendorId], references: [id], onUpdate: NoAction)
|
||||
vendorId Int
|
||||
supplier Supplier @relation("ProductInfo_Supplier", fields: [supplierId], references: [id], onUpdate: NoAction)
|
||||
supplierId Int
|
||||
|
||||
@@map("Product_info")
|
||||
}
|
||||
@@ -120,7 +120,7 @@ model ProductCategory {
|
||||
@@map("Product_categories")
|
||||
}
|
||||
|
||||
model Vendor {
|
||||
model Supplier {
|
||||
id Int @id @default(autoincrement())
|
||||
firstName String @db.VarChar(255)
|
||||
lastName String @db.VarChar(255)
|
||||
@@ -135,9 +135,9 @@ model Vendor {
|
||||
updatedAt DateTime? @db.Timestamp(0)
|
||||
deletedAt DateTime? @db.Timestamp(0)
|
||||
|
||||
productInfo ProductInfo[] @relation("ProductInfo_Vendor")
|
||||
productInfo ProductInfo[] @relation("ProductInfo_Supplier")
|
||||
|
||||
@@map("Vendors")
|
||||
@@map("Suppliers")
|
||||
}
|
||||
|
||||
model Customer {
|
||||
|
||||
Reference in New Issue
Block a user