feat: add product variant management functionality
- Implemented CreateProductVariantDto and UpdateProductVariantDto for product variant data transfer. - Developed ProductVariantsController to handle CRUD operations for product variants. - Created ProductVariantsService to interact with the database using Prisma. - Added ProductVariantsModule to encapsulate the product variant feature. - Included response mapping for consistent API responses.
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
"@nestjs/swagger": "^11.2.3",
|
||||
"@prisma/adapter-mariadb": "^7.1.0",
|
||||
"@prisma/client": "^7.1.0",
|
||||
"class-transformer": "^0.5.1",
|
||||
"class-validator": "^0.14.3",
|
||||
"dotenv": "^17.2.3",
|
||||
"reflect-metadata": "^0.2.2",
|
||||
"rxjs": "^7.8.1"
|
||||
@@ -36,6 +38,7 @@
|
||||
"ts-loader": "^9.5.2",
|
||||
"ts-node": "^10.9.2",
|
||||
"tsconfig-paths": "^4.2.0",
|
||||
"tsx": "^4.21.0",
|
||||
"typescript": "^5.7.3",
|
||||
"typescript-eslint": "^8.20.0"
|
||||
},
|
||||
@@ -62,6 +65,7 @@
|
||||
"scripts": {
|
||||
"build": "nest build",
|
||||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"generate:permissions": "tsx scripts/generate-permissions.ts",
|
||||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
||||
"start": "nest start",
|
||||
"start:debug": "nest start --debug --watch",
|
||||
|
||||
Generated
+362
-22
@@ -10,22 +10,28 @@ importers:
|
||||
dependencies:
|
||||
'@nestjs/common':
|
||||
specifier: ^11.0.1
|
||||
version: 11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||
version: 11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||
'@nestjs/core':
|
||||
specifier: ^11.0.1
|
||||
version: 11.1.9(@nestjs/common@11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@11.1.9)(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||
version: 11.1.9(@nestjs/common@11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@11.1.9)(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||
'@nestjs/platform-express':
|
||||
specifier: ^11.0.1
|
||||
version: 11.1.9(@nestjs/common@11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.9)
|
||||
version: 11.1.9(@nestjs/common@11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.9)
|
||||
'@nestjs/swagger':
|
||||
specifier: ^11.2.3
|
||||
version: 11.2.3(@nestjs/common@11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.9)(reflect-metadata@0.2.2)
|
||||
version: 11.2.3(@nestjs/common@11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.9)(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)
|
||||
'@prisma/adapter-mariadb':
|
||||
specifier: ^7.1.0
|
||||
version: 7.1.0
|
||||
'@prisma/client':
|
||||
specifier: ^7.1.0
|
||||
version: 7.1.0(prisma@7.1.0(@types/react@19.2.7)(react-dom@19.2.1(react@19.2.1))(react@19.2.1)(typescript@5.9.3))(typescript@5.9.3)
|
||||
class-transformer:
|
||||
specifier: ^0.5.1
|
||||
version: 0.5.1
|
||||
class-validator:
|
||||
specifier: ^0.14.3
|
||||
version: 0.14.3
|
||||
dotenv:
|
||||
specifier: ^17.2.3
|
||||
version: 17.2.3
|
||||
@@ -50,7 +56,7 @@ importers:
|
||||
version: 11.0.9(chokidar@4.0.3)(typescript@5.9.3)
|
||||
'@nestjs/testing':
|
||||
specifier: ^11.0.1
|
||||
version: 11.1.9(@nestjs/common@11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.9)(@nestjs/platform-express@11.1.9)
|
||||
version: 11.1.9(@nestjs/common@11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.9)(@nestjs/platform-express@11.1.9)
|
||||
'@types/express':
|
||||
specifier: ^5.0.0
|
||||
version: 5.0.6
|
||||
@@ -105,6 +111,9 @@ importers:
|
||||
tsconfig-paths:
|
||||
specifier: ^4.2.0
|
||||
version: 4.2.0
|
||||
tsx:
|
||||
specifier: ^4.21.0
|
||||
version: 4.21.0
|
||||
typescript:
|
||||
specifier: ^5.7.3
|
||||
version: 5.9.3
|
||||
@@ -356,6 +365,162 @@ packages:
|
||||
'@emnapi/wasi-threads@1.1.0':
|
||||
resolution: {integrity: sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ==}
|
||||
|
||||
'@esbuild/aix-ppc64@0.27.1':
|
||||
resolution: {integrity: sha512-HHB50pdsBX6k47S4u5g/CaLjqS3qwaOVE5ILsq64jyzgMhLuCuZ8rGzM9yhsAjfjkbgUPMzZEPa7DAp7yz6vuA==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [ppc64]
|
||||
os: [aix]
|
||||
|
||||
'@esbuild/android-arm64@0.27.1':
|
||||
resolution: {integrity: sha512-45fuKmAJpxnQWixOGCrS+ro4Uvb4Re9+UTieUY2f8AEc+t7d4AaZ6eUJ3Hva7dtrxAAWHtlEFsXFMAgNnGU9uQ==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [arm64]
|
||||
os: [android]
|
||||
|
||||
'@esbuild/android-arm@0.27.1':
|
||||
resolution: {integrity: sha512-kFqa6/UcaTbGm/NncN9kzVOODjhZW8e+FRdSeypWe6j33gzclHtwlANs26JrupOntlcWmB0u8+8HZo8s7thHvg==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [arm]
|
||||
os: [android]
|
||||
|
||||
'@esbuild/android-x64@0.27.1':
|
||||
resolution: {integrity: sha512-LBEpOz0BsgMEeHgenf5aqmn/lLNTFXVfoWMUox8CtWWYK9X4jmQzWjoGoNb8lmAYml/tQ/Ysvm8q7szu7BoxRQ==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [x64]
|
||||
os: [android]
|
||||
|
||||
'@esbuild/darwin-arm64@0.27.1':
|
||||
resolution: {integrity: sha512-veg7fL8eMSCVKL7IW4pxb54QERtedFDfY/ASrumK/SbFsXnRazxY4YykN/THYqFnFwJ0aVjiUrVG2PwcdAEqQQ==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@esbuild/darwin-x64@0.27.1':
|
||||
resolution: {integrity: sha512-+3ELd+nTzhfWb07Vol7EZ+5PTbJ/u74nC6iv4/lwIU99Ip5uuY6QoIf0Hn4m2HoV0qcnRivN3KSqc+FyCHjoVQ==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@esbuild/freebsd-arm64@0.27.1':
|
||||
resolution: {integrity: sha512-/8Rfgns4XD9XOSXlzUDepG8PX+AVWHliYlUkFI3K3GB6tqbdjYqdhcb4BKRd7C0BhZSoaCxhv8kTcBrcZWP+xg==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [arm64]
|
||||
os: [freebsd]
|
||||
|
||||
'@esbuild/freebsd-x64@0.27.1':
|
||||
resolution: {integrity: sha512-GITpD8dK9C+r+5yRT/UKVT36h/DQLOHdwGVwwoHidlnA168oD3uxA878XloXebK4Ul3gDBBIvEdL7go9gCUFzQ==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [x64]
|
||||
os: [freebsd]
|
||||
|
||||
'@esbuild/linux-arm64@0.27.1':
|
||||
resolution: {integrity: sha512-W9//kCrh/6in9rWIBdKaMtuTTzNj6jSeG/haWBADqLLa9P8O5YSRDzgD5y9QBok4AYlzS6ARHifAb75V6G670Q==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@esbuild/linux-arm@0.27.1':
|
||||
resolution: {integrity: sha512-ieMID0JRZY/ZeCrsFQ3Y3NlHNCqIhTprJfDgSB3/lv5jJZ8FX3hqPyXWhe+gvS5ARMBJ242PM+VNz/ctNj//eA==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
|
||||
'@esbuild/linux-ia32@0.27.1':
|
||||
resolution: {integrity: sha512-VIUV4z8GD8rtSVMfAj1aXFahsi/+tcoXXNYmXgzISL+KB381vbSTNdeZHHHIYqFyXcoEhu9n5cT+05tRv13rlw==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [ia32]
|
||||
os: [linux]
|
||||
|
||||
'@esbuild/linux-loong64@0.27.1':
|
||||
resolution: {integrity: sha512-l4rfiiJRN7sTNI//ff65zJ9z8U+k6zcCg0LALU5iEWzY+a1mVZ8iWC1k5EsNKThZ7XCQ6YWtsZ8EWYm7r1UEsg==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [loong64]
|
||||
os: [linux]
|
||||
|
||||
'@esbuild/linux-mips64el@0.27.1':
|
||||
resolution: {integrity: sha512-U0bEuAOLvO/DWFdygTHWY8C067FXz+UbzKgxYhXC0fDieFa0kDIra1FAhsAARRJbvEyso8aAqvPdNxzWuStBnA==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [mips64el]
|
||||
os: [linux]
|
||||
|
||||
'@esbuild/linux-ppc64@0.27.1':
|
||||
resolution: {integrity: sha512-NzdQ/Xwu6vPSf/GkdmRNsOfIeSGnh7muundsWItmBsVpMoNPVpM61qNzAVY3pZ1glzzAxLR40UyYM23eaDDbYQ==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [ppc64]
|
||||
os: [linux]
|
||||
|
||||
'@esbuild/linux-riscv64@0.27.1':
|
||||
resolution: {integrity: sha512-7zlw8p3IApcsN7mFw0O1Z1PyEk6PlKMu18roImfl3iQHTnr/yAfYv6s4hXPidbDoI2Q0pW+5xeoM4eTCC0UdrQ==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
|
||||
'@esbuild/linux-s390x@0.27.1':
|
||||
resolution: {integrity: sha512-cGj5wli+G+nkVQdZo3+7FDKC25Uh4ZVwOAK6A06Hsvgr8WqBBuOy/1s+PUEd/6Je+vjfm6stX0kmib5b/O2Ykw==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [s390x]
|
||||
os: [linux]
|
||||
|
||||
'@esbuild/linux-x64@0.27.1':
|
||||
resolution: {integrity: sha512-z3H/HYI9MM0HTv3hQZ81f+AKb+yEoCRlUby1F80vbQ5XdzEMyY/9iNlAmhqiBKw4MJXwfgsh7ERGEOhrM1niMA==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@esbuild/netbsd-arm64@0.27.1':
|
||||
resolution: {integrity: sha512-wzC24DxAvk8Em01YmVXyjl96Mr+ecTPyOuADAvjGg+fyBpGmxmcr2E5ttf7Im8D0sXZihpxzO1isus8MdjMCXQ==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [arm64]
|
||||
os: [netbsd]
|
||||
|
||||
'@esbuild/netbsd-x64@0.27.1':
|
||||
resolution: {integrity: sha512-1YQ8ybGi2yIXswu6eNzJsrYIGFpnlzEWRl6iR5gMgmsrR0FcNoV1m9k9sc3PuP5rUBLshOZylc9nqSgymI+TYg==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [x64]
|
||||
os: [netbsd]
|
||||
|
||||
'@esbuild/openbsd-arm64@0.27.1':
|
||||
resolution: {integrity: sha512-5Z+DzLCrq5wmU7RDaMDe2DVXMRm2tTDvX2KU14JJVBN2CT/qov7XVix85QoJqHltpvAOZUAc3ndU56HSMWrv8g==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [arm64]
|
||||
os: [openbsd]
|
||||
|
||||
'@esbuild/openbsd-x64@0.27.1':
|
||||
resolution: {integrity: sha512-Q73ENzIdPF5jap4wqLtsfh8YbYSZ8Q0wnxplOlZUOyZy7B4ZKW8DXGWgTCZmF8VWD7Tciwv5F4NsRf6vYlZtqg==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [x64]
|
||||
os: [openbsd]
|
||||
|
||||
'@esbuild/openharmony-arm64@0.27.1':
|
||||
resolution: {integrity: sha512-ajbHrGM/XiK+sXM0JzEbJAen+0E+JMQZ2l4RR4VFwvV9JEERx+oxtgkpoKv1SevhjavK2z2ReHk32pjzktWbGg==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [arm64]
|
||||
os: [openharmony]
|
||||
|
||||
'@esbuild/sunos-x64@0.27.1':
|
||||
resolution: {integrity: sha512-IPUW+y4VIjuDVn+OMzHc5FV4GubIwPnsz6ubkvN8cuhEqH81NovB53IUlrlBkPMEPxvNnf79MGBoz8rZ2iW8HA==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [x64]
|
||||
os: [sunos]
|
||||
|
||||
'@esbuild/win32-arm64@0.27.1':
|
||||
resolution: {integrity: sha512-RIVRWiljWA6CdVu8zkWcRmGP7iRRIIwvhDKem8UMBjPql2TXM5PkDVvvrzMtj1V+WFPB4K7zkIGM7VzRtFkjdg==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@esbuild/win32-ia32@0.27.1':
|
||||
resolution: {integrity: sha512-2BR5M8CPbptC1AK5JbJT1fWrHLvejwZidKx3UMSF0ecHMa+smhi16drIrCEggkgviBwLYd5nwrFLSl5Kho96RQ==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [ia32]
|
||||
os: [win32]
|
||||
|
||||
'@esbuild/win32-x64@0.27.1':
|
||||
resolution: {integrity: sha512-d5X6RMYv6taIymSk8JBP+nxv8DQAMY6A51GPgusqLdK9wBz5wWIXy1KjTck6HnjE9hqJzJRdk+1p/t5soSbCtw==}
|
||||
engines: {node: '>=18'}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@eslint-community/eslint-utils@4.9.0':
|
||||
resolution: {integrity: sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
@@ -1003,6 +1168,9 @@ packages:
|
||||
'@types/supertest@6.0.3':
|
||||
resolution: {integrity: sha512-8WzXq62EXFhJ7QsH3Ocb/iKQ/Ty9ZVWnVzoTKc9tyyFRRF3a74Tk2+TLFgaFFw364Ere+npzHKEJ6ga2LzIL7w==}
|
||||
|
||||
'@types/validator@13.15.10':
|
||||
resolution: {integrity: sha512-T8L6i7wCuyoK8A/ZeLYt1+q0ty3Zb9+qbSSvrIVitzT3YjZqkTZ40IbRsPanlB4h1QB3JVL1SYCdR6ngtFYcuA==}
|
||||
|
||||
'@types/yargs-parser@21.0.3':
|
||||
resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==}
|
||||
|
||||
@@ -1475,6 +1643,12 @@ packages:
|
||||
cjs-module-lexer@2.1.1:
|
||||
resolution: {integrity: sha512-+CmxIZ/L2vNcEfvNtLdU0ZQ6mbq3FZnwAP2PPTiKP+1QOoKwlKlPgb8UKV0Dds7QVaMnHm+FwSft2VB0s/SLjQ==}
|
||||
|
||||
class-transformer@0.5.1:
|
||||
resolution: {integrity: sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw==}
|
||||
|
||||
class-validator@0.14.3:
|
||||
resolution: {integrity: sha512-rXXekcjofVN1LTOSw+u4u9WXVEUvNBVjORW154q/IdmYWy1nMbOU9aNtZB0t8m+FJQ9q91jlr2f9CwwUFdFMRA==}
|
||||
|
||||
cli-cursor@3.1.0:
|
||||
resolution: {integrity: sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -1721,6 +1895,11 @@ packages:
|
||||
resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
esbuild@0.27.1:
|
||||
resolution: {integrity: sha512-yY35KZckJJuVVPXpvjgxiCuVEJT67F6zDeVTv4rizyPrfGBUpZQsvmxnN+C371c2esD/hNMjj4tpBhuueLN7aA==}
|
||||
engines: {node: '>=18'}
|
||||
hasBin: true
|
||||
|
||||
escalade@3.2.0:
|
||||
resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==}
|
||||
engines: {node: '>=6'}
|
||||
@@ -1981,6 +2160,9 @@ packages:
|
||||
resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
get-tsconfig@4.13.0:
|
||||
resolution: {integrity: sha512-1VKTZJCwBrvbd+Wn3AOgQP/2Av+TfTCOlE4AcRJE72W1ksZXbAx8PPBR9RzgTeSPzlPMHrbANMH3LbltH73wxQ==}
|
||||
|
||||
giget@2.0.0:
|
||||
resolution: {integrity: sha512-L5bGsVkxJbJgdnwyuheIunkGatUF/zssUoxxjACCseZYAVbaqdh9Tsmmlkl8vYan09H7sbvKt4pS8GqKLBrEzA==}
|
||||
hasBin: true
|
||||
@@ -2367,6 +2549,9 @@ packages:
|
||||
resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
|
||||
libphonenumber-js@1.12.31:
|
||||
resolution: {integrity: sha512-Z3IhgVgrqO1S5xPYM3K5XwbkDasU67/Vys4heW+lfSBALcUZjeIIzI8zCLifY+OCzSq+fpDdywMDa7z+4srJPQ==}
|
||||
|
||||
lilconfig@2.1.0:
|
||||
resolution: {integrity: sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==}
|
||||
engines: {node: '>=10'}
|
||||
@@ -2833,6 +3018,9 @@ packages:
|
||||
resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
resolve-pkg-maps@1.0.0:
|
||||
resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==}
|
||||
|
||||
restore-cursor@3.1.0:
|
||||
resolution: {integrity: sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -3156,6 +3344,11 @@ packages:
|
||||
tslib@2.8.1:
|
||||
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
|
||||
|
||||
tsx@4.21.0:
|
||||
resolution: {integrity: sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==}
|
||||
engines: {node: '>=18.0.0'}
|
||||
hasBin: true
|
||||
|
||||
type-check@0.4.0:
|
||||
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
@@ -3252,6 +3445,10 @@ packages:
|
||||
typescript:
|
||||
optional: true
|
||||
|
||||
validator@13.15.23:
|
||||
resolution: {integrity: sha512-4yoz1kEWqUjzi5zsPbAS/903QXSYp0UOtHsPpp7p9rHAw/W+dkInskAE386Fat3oKRROwO98d9ZB0G4cObgUyw==}
|
||||
engines: {node: '>= 0.10'}
|
||||
|
||||
vary@1.1.2:
|
||||
resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==}
|
||||
engines: {node: '>= 0.8'}
|
||||
@@ -3644,6 +3841,84 @@ snapshots:
|
||||
tslib: 2.8.1
|
||||
optional: true
|
||||
|
||||
'@esbuild/aix-ppc64@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/android-arm64@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/android-arm@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/android-x64@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/darwin-arm64@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/darwin-x64@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/freebsd-arm64@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/freebsd-x64@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/linux-arm64@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/linux-arm@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/linux-ia32@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/linux-loong64@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/linux-mips64el@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/linux-ppc64@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/linux-riscv64@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/linux-s390x@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/linux-x64@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/netbsd-arm64@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/netbsd-x64@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/openbsd-arm64@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/openbsd-x64@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/openharmony-arm64@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/sunos-x64@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/win32-arm64@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/win32-ia32@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@esbuild/win32-x64@0.27.1':
|
||||
optional: true
|
||||
|
||||
'@eslint-community/eslint-utils@4.9.0(eslint@9.39.1(jiti@2.6.1))':
|
||||
dependencies:
|
||||
eslint: 9.39.1(jiti@2.6.1)
|
||||
@@ -4120,7 +4395,7 @@ snapshots:
|
||||
- uglify-js
|
||||
- webpack-cli
|
||||
|
||||
'@nestjs/common@11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2)':
|
||||
'@nestjs/common@11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2)':
|
||||
dependencies:
|
||||
file-type: 21.1.0
|
||||
iterare: 1.2.1
|
||||
@@ -4129,12 +4404,15 @@ snapshots:
|
||||
rxjs: 7.8.2
|
||||
tslib: 2.8.1
|
||||
uid: 2.0.2
|
||||
optionalDependencies:
|
||||
class-transformer: 0.5.1
|
||||
class-validator: 0.14.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@nestjs/core@11.1.9(@nestjs/common@11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@11.1.9)(reflect-metadata@0.2.2)(rxjs@7.8.2)':
|
||||
'@nestjs/core@11.1.9(@nestjs/common@11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@11.1.9)(reflect-metadata@0.2.2)(rxjs@7.8.2)':
|
||||
dependencies:
|
||||
'@nestjs/common': 11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||
'@nestjs/common': 11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||
'@nuxt/opencollective': 0.4.1
|
||||
fast-safe-stringify: 2.1.1
|
||||
iterare: 1.2.1
|
||||
@@ -4144,17 +4422,20 @@ snapshots:
|
||||
tslib: 2.8.1
|
||||
uid: 2.0.2
|
||||
optionalDependencies:
|
||||
'@nestjs/platform-express': 11.1.9(@nestjs/common@11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.9)
|
||||
'@nestjs/platform-express': 11.1.9(@nestjs/common@11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.9)
|
||||
|
||||
'@nestjs/mapped-types@2.1.0(@nestjs/common@11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2))(reflect-metadata@0.2.2)':
|
||||
'@nestjs/mapped-types@2.1.0(@nestjs/common@11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)':
|
||||
dependencies:
|
||||
'@nestjs/common': 11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||
'@nestjs/common': 11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||
reflect-metadata: 0.2.2
|
||||
optionalDependencies:
|
||||
class-transformer: 0.5.1
|
||||
class-validator: 0.14.3
|
||||
|
||||
'@nestjs/platform-express@11.1.9(@nestjs/common@11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.9)':
|
||||
'@nestjs/platform-express@11.1.9(@nestjs/common@11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.9)':
|
||||
dependencies:
|
||||
'@nestjs/common': 11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||
'@nestjs/core': 11.1.9(@nestjs/common@11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@11.1.9)(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||
'@nestjs/common': 11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||
'@nestjs/core': 11.1.9(@nestjs/common@11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@11.1.9)(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||
cors: 2.8.5
|
||||
express: 5.1.0
|
||||
multer: 2.0.2
|
||||
@@ -4174,25 +4455,28 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- chokidar
|
||||
|
||||
'@nestjs/swagger@11.2.3(@nestjs/common@11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.9)(reflect-metadata@0.2.2)':
|
||||
'@nestjs/swagger@11.2.3(@nestjs/common@11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.9)(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)':
|
||||
dependencies:
|
||||
'@microsoft/tsdoc': 0.16.0
|
||||
'@nestjs/common': 11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||
'@nestjs/core': 11.1.9(@nestjs/common@11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@11.1.9)(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||
'@nestjs/mapped-types': 2.1.0(@nestjs/common@11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2))(reflect-metadata@0.2.2)
|
||||
'@nestjs/common': 11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||
'@nestjs/core': 11.1.9(@nestjs/common@11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@11.1.9)(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||
'@nestjs/mapped-types': 2.1.0(@nestjs/common@11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)
|
||||
js-yaml: 4.1.1
|
||||
lodash: 4.17.21
|
||||
path-to-regexp: 8.3.0
|
||||
reflect-metadata: 0.2.2
|
||||
swagger-ui-dist: 5.30.2
|
||||
optionalDependencies:
|
||||
class-transformer: 0.5.1
|
||||
class-validator: 0.14.3
|
||||
|
||||
'@nestjs/testing@11.1.9(@nestjs/common@11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.9)(@nestjs/platform-express@11.1.9)':
|
||||
'@nestjs/testing@11.1.9(@nestjs/common@11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.9)(@nestjs/platform-express@11.1.9)':
|
||||
dependencies:
|
||||
'@nestjs/common': 11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||
'@nestjs/core': 11.1.9(@nestjs/common@11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@11.1.9)(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||
'@nestjs/common': 11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||
'@nestjs/core': 11.1.9(@nestjs/common@11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@11.1.9)(reflect-metadata@0.2.2)(rxjs@7.8.2)
|
||||
tslib: 2.8.1
|
||||
optionalDependencies:
|
||||
'@nestjs/platform-express': 11.1.9(@nestjs/common@11.1.9(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.9)
|
||||
'@nestjs/platform-express': 11.1.9(@nestjs/common@11.1.9(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.9)
|
||||
|
||||
'@noble/hashes@1.8.0': {}
|
||||
|
||||
@@ -4451,6 +4735,8 @@ snapshots:
|
||||
'@types/methods': 1.1.4
|
||||
'@types/superagent': 8.1.9
|
||||
|
||||
'@types/validator@13.15.10': {}
|
||||
|
||||
'@types/yargs-parser@21.0.3': {}
|
||||
|
||||
'@types/yargs@17.0.35':
|
||||
@@ -4968,6 +5254,14 @@ snapshots:
|
||||
|
||||
cjs-module-lexer@2.1.1: {}
|
||||
|
||||
class-transformer@0.5.1: {}
|
||||
|
||||
class-validator@0.14.3:
|
||||
dependencies:
|
||||
'@types/validator': 13.15.10
|
||||
libphonenumber-js: 1.12.31
|
||||
validator: 13.15.23
|
||||
|
||||
cli-cursor@3.1.0:
|
||||
dependencies:
|
||||
restore-cursor: 3.1.0
|
||||
@@ -5159,6 +5453,35 @@ snapshots:
|
||||
has-tostringtag: 1.0.2
|
||||
hasown: 2.0.2
|
||||
|
||||
esbuild@0.27.1:
|
||||
optionalDependencies:
|
||||
'@esbuild/aix-ppc64': 0.27.1
|
||||
'@esbuild/android-arm': 0.27.1
|
||||
'@esbuild/android-arm64': 0.27.1
|
||||
'@esbuild/android-x64': 0.27.1
|
||||
'@esbuild/darwin-arm64': 0.27.1
|
||||
'@esbuild/darwin-x64': 0.27.1
|
||||
'@esbuild/freebsd-arm64': 0.27.1
|
||||
'@esbuild/freebsd-x64': 0.27.1
|
||||
'@esbuild/linux-arm': 0.27.1
|
||||
'@esbuild/linux-arm64': 0.27.1
|
||||
'@esbuild/linux-ia32': 0.27.1
|
||||
'@esbuild/linux-loong64': 0.27.1
|
||||
'@esbuild/linux-mips64el': 0.27.1
|
||||
'@esbuild/linux-ppc64': 0.27.1
|
||||
'@esbuild/linux-riscv64': 0.27.1
|
||||
'@esbuild/linux-s390x': 0.27.1
|
||||
'@esbuild/linux-x64': 0.27.1
|
||||
'@esbuild/netbsd-arm64': 0.27.1
|
||||
'@esbuild/netbsd-x64': 0.27.1
|
||||
'@esbuild/openbsd-arm64': 0.27.1
|
||||
'@esbuild/openbsd-x64': 0.27.1
|
||||
'@esbuild/openharmony-arm64': 0.27.1
|
||||
'@esbuild/sunos-x64': 0.27.1
|
||||
'@esbuild/win32-arm64': 0.27.1
|
||||
'@esbuild/win32-ia32': 0.27.1
|
||||
'@esbuild/win32-x64': 0.27.1
|
||||
|
||||
escalade@3.2.0: {}
|
||||
|
||||
escape-html@1.0.3: {}
|
||||
@@ -5477,6 +5800,10 @@ snapshots:
|
||||
|
||||
get-stream@6.0.1: {}
|
||||
|
||||
get-tsconfig@4.13.0:
|
||||
dependencies:
|
||||
resolve-pkg-maps: 1.0.0
|
||||
|
||||
giget@2.0.0:
|
||||
dependencies:
|
||||
citty: 0.1.6
|
||||
@@ -6029,6 +6356,8 @@ snapshots:
|
||||
prelude-ls: 1.2.1
|
||||
type-check: 0.4.0
|
||||
|
||||
libphonenumber-js@1.12.31: {}
|
||||
|
||||
lilconfig@2.1.0: {}
|
||||
|
||||
lines-and-columns@1.2.4: {}
|
||||
@@ -6444,6 +6773,8 @@ snapshots:
|
||||
|
||||
resolve-from@5.0.0: {}
|
||||
|
||||
resolve-pkg-maps@1.0.0: {}
|
||||
|
||||
restore-cursor@3.1.0:
|
||||
dependencies:
|
||||
onetime: 5.1.2
|
||||
@@ -6787,6 +7118,13 @@ snapshots:
|
||||
|
||||
tslib@2.8.1: {}
|
||||
|
||||
tsx@4.21.0:
|
||||
dependencies:
|
||||
esbuild: 0.27.1
|
||||
get-tsconfig: 4.13.0
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.3
|
||||
|
||||
type-check@0.4.0:
|
||||
dependencies:
|
||||
prelude-ls: 1.2.1
|
||||
@@ -6888,6 +7226,8 @@ snapshots:
|
||||
optionalDependencies:
|
||||
typescript: 5.9.3
|
||||
|
||||
validator@13.15.23: {}
|
||||
|
||||
vary@1.1.2: {}
|
||||
|
||||
walker@1.0.8:
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
// This file was generated by Prisma and assumes you have installed the following:
|
||||
// npm install --save-dev prisma dotenv
|
||||
import "dotenv/config";
|
||||
import { defineConfig, env } from "prisma/config";
|
||||
export default defineConfig({
|
||||
schema: "prisma/schema.prisma",
|
||||
migrations: {
|
||||
path: "prisma/migrations",
|
||||
},
|
||||
datasource: {
|
||||
url: env("DATABASE_URL"),
|
||||
},
|
||||
});
|
||||
+7
-6
@@ -1,14 +1,15 @@
|
||||
// This file was generated by Prisma and assumes you have installed the following:
|
||||
// npm install --save-dev prisma dotenv
|
||||
import "dotenv/config";
|
||||
import { defineConfig, env } from "prisma/config";
|
||||
import 'dotenv/config'
|
||||
import { defineConfig, env } from 'prisma/config'
|
||||
|
||||
export default defineConfig({
|
||||
schema: "prisma/schema.prisma",
|
||||
schema: 'prisma/schema.prisma',
|
||||
migrations: {
|
||||
path: "prisma/migrations",
|
||||
path: 'prisma/migrations',
|
||||
seed: 'tsx prisma/seed.ts',
|
||||
},
|
||||
datasource: {
|
||||
url: env("DATABASE_URL"),
|
||||
url: env('DATABASE_URL'),
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `alertQuantity` on the `Products` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `attachmentId` on the `Products` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `discount` on the `Products` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `imageUrl` on the `Products` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `isActive` on the `Products` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `isFeatured` on the `Products` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `productInfoId` on the `Products` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `quantity` on the `Products` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `unit` on the `Products` table. All the data in the column will be lost.
|
||||
- You are about to drop the `Product_info` table. If the table is not empty, all the data it contains will be lost.
|
||||
- Made the column `createdAt` on table `Products` required. This step will fail if there are existing NULL values in that column.
|
||||
- Made the column `updatedAt` on table `Products` required. This step will fail if there are existing NULL values in that column.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `Product_info` DROP FOREIGN KEY `Product_info_brandId_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `Product_info` DROP FOREIGN KEY `Product_info_categoryId_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `Product_info` DROP FOREIGN KEY `Product_info_supplierId_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `Products` DROP FOREIGN KEY `Products_productInfoId_fkey`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `Products_productInfoId_fkey` ON `Products`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Products` DROP COLUMN `alertQuantity`,
|
||||
DROP COLUMN `attachmentId`,
|
||||
DROP COLUMN `discount`,
|
||||
DROP COLUMN `imageUrl`,
|
||||
DROP COLUMN `isActive`,
|
||||
DROP COLUMN `isFeatured`,
|
||||
DROP COLUMN `productInfoId`,
|
||||
DROP COLUMN `quantity`,
|
||||
DROP COLUMN `unit`,
|
||||
ADD COLUMN `brandId` INTEGER NULL,
|
||||
ADD COLUMN `categoryId` INTEGER NULL,
|
||||
ADD COLUMN `metaData` JSON NULL,
|
||||
ADD COLUMN `productType` VARCHAR(50) NULL DEFAULT 'simple',
|
||||
MODIFY `createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
MODIFY `updatedAt` TIMESTAMP(0) NOT NULL;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE `Product_info`;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Product_Variants` (
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`basePrice` DECIMAL(10, 2) NOT NULL,
|
||||
`salePrice` DECIMAL(10, 2) NOT NULL,
|
||||
`description` TEXT NULL,
|
||||
`barcode` VARCHAR(100) NULL,
|
||||
`imageUrl` VARCHAR(255) NULL,
|
||||
`unit` VARCHAR(10) NULL,
|
||||
`quantity` DECIMAL(10, 2) NULL DEFAULT 0.00,
|
||||
`alertQuantity` DECIMAL(10, 2) NULL DEFAULT 5.00,
|
||||
`isActive` BOOLEAN NOT NULL DEFAULT true,
|
||||
`isFeatured` BOOLEAN NOT NULL DEFAULT false,
|
||||
`createdAt` TIMESTAMP(0) NULL,
|
||||
`updatedAt` TIMESTAMP(0) NULL,
|
||||
`deletedAt` TIMESTAMP(0) NULL,
|
||||
`productId` INTEGER NOT NULL,
|
||||
|
||||
UNIQUE INDEX `products_barcode_unique`(`barcode`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Product_Variants` ADD CONSTRAINT `Product_Variants_productId_fkey` FOREIGN KEY (`productId`) REFERENCES `Products`(`id`) ON DELETE RESTRICT ON UPDATE NO ACTION;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Products` ADD CONSTRAINT `Products_brandId_fkey` FOREIGN KEY (`brandId`) REFERENCES `Product_brands`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Products` ADD CONSTRAINT `Products_categoryId_fkey` FOREIGN KEY (`categoryId`) REFERENCES `Product_categories`(`id`) ON DELETE SET NULL ON UPDATE NO ACTION;
|
||||
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `metaData` on the `Products` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `productType` on the `Products` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE `Products` DROP COLUMN `metaData`,
|
||||
DROP COLUMN `productType`;
|
||||
+19
-25
@@ -35,26 +35,25 @@ model Role {
|
||||
@@map("Roles")
|
||||
}
|
||||
|
||||
model Product {
|
||||
model ProductVariant {
|
||||
id Int @id @default(autoincrement())
|
||||
name String @db.VarChar(255)
|
||||
basePrice Decimal @db.Decimal(10, 2)
|
||||
salePrice Decimal @db.Decimal(10, 2)
|
||||
description String? @db.Text
|
||||
sku String? @unique(map: "products_sku_unique") @db.VarChar(100)
|
||||
barcode String? @unique(map: "products_barcode_unique") @db.VarChar(100)
|
||||
imageUrl String? @db.VarChar(255)
|
||||
attachmentId BigInt? @db.UnsignedBigInt
|
||||
unit String @db.VarChar(10)
|
||||
discount Decimal @default(0.00) @db.Decimal(10, 2)
|
||||
quantity Decimal @default(0.00) @db.Decimal(10, 2)
|
||||
alertQuantity Decimal @default(5.00) @db.Decimal(10, 2)
|
||||
unit String? @db.VarChar(10)
|
||||
quantity Decimal? @default(0.00) @db.Decimal(10, 2)
|
||||
alertQuantity Decimal? @default(5.00) @db.Decimal(10, 2)
|
||||
isActive Boolean @default(true)
|
||||
isFeatured Boolean @default(false)
|
||||
createdAt DateTime? @db.Timestamp(0)
|
||||
updatedAt DateTime? @db.Timestamp(0)
|
||||
deletedAt DateTime? @db.Timestamp(0)
|
||||
|
||||
productInfo ProductInfo @relation("Product_ProductInfo", fields: [productInfoId], references: [id], onUpdate: NoAction)
|
||||
productInfoId Int
|
||||
product Product @relation("Product_Variant", fields: [productId], references: [id], onUpdate: NoAction)
|
||||
productId Int
|
||||
// is_stock_managed Boolean @default(true)
|
||||
// created_by Int?
|
||||
// collection_product collection_product[]
|
||||
@@ -64,32 +63,29 @@ model Product {
|
||||
// purchase_items purchase_items[]
|
||||
// sale_items sale_items[]
|
||||
|
||||
// @@index([attachment_id], map: "products_attachment_id_foreign")
|
||||
@@map("Products")
|
||||
@@map("Product_Variants")
|
||||
}
|
||||
|
||||
model ProductInfo {
|
||||
model Product {
|
||||
id Int @id @default(autoincrement())
|
||||
name String @db.VarChar(255)
|
||||
barcode String? @unique(map: "products_barcode_unique") @db.VarChar(100)
|
||||
sku String? @unique(map: "products_sku_unique") @db.VarChar(100)
|
||||
description String? @db.Text
|
||||
productType String? @default("simple") @db.VarChar(50)
|
||||
metaData Json?
|
||||
// productType String? @default("simple") @db.VarChar(50)
|
||||
createdAt DateTime @default(now()) @db.Timestamp(0)
|
||||
updatedAt DateTime @updatedAt @db.Timestamp(0)
|
||||
deletedAt DateTime? @db.Timestamp(0)
|
||||
|
||||
products Product[] @relation("Product_ProductInfo")
|
||||
variants ProductVariant[] @relation("Product_Variant")
|
||||
|
||||
brand ProductBrand? @relation("ProductInfo_Brand", fields: [brandId], references: [id], onUpdate: NoAction)
|
||||
brand ProductBrand? @relation("Product_Brand", fields: [brandId], references: [id], onUpdate: NoAction)
|
||||
brandId Int?
|
||||
|
||||
category ProductCategory? @relation("ProductInfo_Category", fields: [categoryId], references: [id], onUpdate: NoAction)
|
||||
category ProductCategory? @relation("Product_Category", fields: [categoryId], references: [id], onUpdate: NoAction)
|
||||
categoryId Int?
|
||||
|
||||
supplier Supplier @relation("ProductInfo_Supplier", fields: [supplierId], references: [id], onUpdate: NoAction)
|
||||
supplierId Int
|
||||
|
||||
@@map("Product_info")
|
||||
@@map("Products")
|
||||
}
|
||||
|
||||
model ProductBrand {
|
||||
@@ -101,7 +97,7 @@ model ProductBrand {
|
||||
updatedAt DateTime @updatedAt @db.Timestamp(0)
|
||||
deletedAt DateTime? @db.Timestamp(0)
|
||||
|
||||
productInfo ProductInfo[] @relation("ProductInfo_Brand")
|
||||
products Product[] @relation("Product_Brand")
|
||||
|
||||
@@map("Product_brands")
|
||||
}
|
||||
@@ -115,7 +111,7 @@ model ProductCategory {
|
||||
updatedAt DateTime @updatedAt @db.Timestamp(0)
|
||||
deletedAt DateTime? @db.Timestamp(0)
|
||||
|
||||
productInfo ProductInfo[] @relation("ProductInfo_Category")
|
||||
products Product[] @relation("Product_Category")
|
||||
|
||||
@@map("Product_categories")
|
||||
}
|
||||
@@ -135,8 +131,6 @@ model Supplier {
|
||||
updatedAt DateTime? @db.Timestamp(0)
|
||||
deletedAt DateTime? @db.Timestamp(0)
|
||||
|
||||
productInfo ProductInfo[] @relation("ProductInfo_Supplier")
|
||||
|
||||
@@map("Suppliers")
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import { prisma } from '../src/lib/prisma'
|
||||
|
||||
async function main() {
|
||||
console.log('first')
|
||||
|
||||
await prisma.role.upsert({
|
||||
where: { id: 0, name: 'Admin' },
|
||||
update: {},
|
||||
create: {
|
||||
name: 'Admin',
|
||||
},
|
||||
})
|
||||
}
|
||||
main()
|
||||
.then(async () => {
|
||||
await prisma.$disconnect()
|
||||
})
|
||||
.catch(async e => {
|
||||
console.error(e)
|
||||
await prisma.$disconnect()
|
||||
process.exit(1)
|
||||
})
|
||||
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env ts-node
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import { prisma } from '../src/lib/prisma'
|
||||
|
||||
function findModules(dir: string): string[] {
|
||||
const results: string[] = []
|
||||
const entries = fs.readdirSync(dir, { withFileTypes: true })
|
||||
for (const e of entries) {
|
||||
const full = path.join(dir, e.name)
|
||||
if (e.isDirectory()) {
|
||||
results.push(...findModules(full))
|
||||
} else if (e.isFile() && e.name.endsWith('.module.ts')) {
|
||||
results.push(full)
|
||||
}
|
||||
}
|
||||
return results
|
||||
}
|
||||
|
||||
function moduleNameFromFile(filePath: string) {
|
||||
const name = path.basename(filePath).replace('.module.ts', '')
|
||||
return name.replace(/-module$|\.module$/i, '')
|
||||
}
|
||||
|
||||
function makePermissionsFor(moduleName: string) {
|
||||
const base = moduleName.replace(/\W+/g, '_').toLowerCase()
|
||||
return [`${base}:create`, `${base}:read`, `${base}:update`, `${base}:delete`]
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const srcDir = path.resolve(__dirname, '..', 'src')
|
||||
const moduleFiles = findModules(srcDir)
|
||||
const modules = moduleFiles.map(moduleNameFromFile)
|
||||
|
||||
const permsMap: Record<string, boolean> = {}
|
||||
for (const m of modules) {
|
||||
for (const p of makePermissionsFor(m)) permsMap[p] = false
|
||||
}
|
||||
|
||||
// Upsert roles: ensure admin has full permissions, others get entries added
|
||||
const roles = await prisma.role.findMany()
|
||||
for (const r of roles) {
|
||||
const current: Record<string, any> = (r.permissions as any) || {}
|
||||
const merged = { ...permsMap, ...current }
|
||||
|
||||
// If role name is admin (case-insensitive), set all permissions to true
|
||||
if (r.name && r.name.toLowerCase() === 'admin') {
|
||||
for (const key of Object.keys(merged)) merged[key] = true
|
||||
} else {
|
||||
// keep existing truthy values, otherwise false
|
||||
for (const key of Object.keys(merged)) merged[key] = merged[key] || false
|
||||
}
|
||||
|
||||
await prisma.role.update({ where: { id: r.id }, data: { permissions: merged } })
|
||||
console.log(
|
||||
`Updated role ${r.name} (id=${r.id}) with ${Object.keys(merged).length} permissions`,
|
||||
)
|
||||
}
|
||||
|
||||
await prisma.$disconnect()
|
||||
}
|
||||
|
||||
main().catch(e => {
|
||||
console.error(e)
|
||||
process.exit(1)
|
||||
})
|
||||
+2
-2
@@ -6,7 +6,7 @@ import { InventoriesModule } from './inventories/inventories.module'
|
||||
import { PrismaModule } from './prisma/prisma.module'
|
||||
import { ProductBrandsModule } from './product-brands/product-brands.module'
|
||||
import { ProductCategoriesModule } from './product-categories/product-categories.module'
|
||||
import { ProductInfoModule } from './product-info/product-info.module'
|
||||
import { ProductVariantsModule } from './product-variants/product-variants.module'
|
||||
import { ProductsModule } from './products/products.module'
|
||||
import { RolesModule } from './roles/roles.module'
|
||||
import { StoresModule } from './stores/stores.module'
|
||||
@@ -19,7 +19,7 @@ import { UsersModule } from './users/users.module'
|
||||
UsersModule,
|
||||
RolesModule,
|
||||
ProductsModule,
|
||||
ProductInfoModule,
|
||||
ProductVariantsModule,
|
||||
ProductBrandsModule,
|
||||
ProductCategoriesModule,
|
||||
SuppliersModule,
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
import {
|
||||
ArgumentsHost,
|
||||
Catch,
|
||||
ExceptionFilter,
|
||||
HttpException,
|
||||
HttpStatus,
|
||||
} from '@nestjs/common'
|
||||
import type { Request, Response } from 'express'
|
||||
import { Prisma } from '../../generated/prisma/client'
|
||||
|
||||
@Catch()
|
||||
export class PrismaExceptionFilter implements ExceptionFilter {
|
||||
catch(exception: any, host: ArgumentsHost) {
|
||||
const ctx = host.switchToHttp()
|
||||
const response = ctx.getResponse<Response>()
|
||||
const request = ctx.getRequest<Request>()
|
||||
const now = new Date().toISOString()
|
||||
|
||||
// Helper: normalize various payload shapes into an array of text errors
|
||||
const extractErrors = (payload: any): string[] => {
|
||||
if (!payload) return []
|
||||
// If payload is already an array of strings
|
||||
if (Array.isArray(payload) && payload.every(p => typeof p === 'string')) {
|
||||
return payload
|
||||
}
|
||||
|
||||
// If payload itself is a string
|
||||
if (typeof payload === 'string') return [payload]
|
||||
|
||||
// Common Nest ValidationPipe shape: { message: [...], error: 'Bad Request' }
|
||||
if (typeof payload === 'object') {
|
||||
if (Array.isArray(payload.message)) {
|
||||
return payload.message.map(m => String(m))
|
||||
}
|
||||
|
||||
// Zod/other validation libraries sometimes expose issues array
|
||||
if (Array.isArray(payload.errors)) return payload.errors.map(e => String(e))
|
||||
|
||||
// If payload has a nested 'issues' array (zod)
|
||||
if (Array.isArray(payload.issues))
|
||||
return payload.issues.map(i => i.message ?? String(i))
|
||||
|
||||
// If payload has a 'message' string
|
||||
if (typeof payload.message === 'string') return [payload.message]
|
||||
}
|
||||
|
||||
// Fallback to stringifying the payload
|
||||
return [String(payload)]
|
||||
}
|
||||
|
||||
// If Nest already threw an HttpException, normalize and return
|
||||
if (exception instanceof HttpException) {
|
||||
const status = exception.getStatus()
|
||||
const payload = exception.getResponse()
|
||||
|
||||
if (status === HttpStatus.BAD_REQUEST) {
|
||||
const errors = extractErrors(payload)
|
||||
return response.status(status).json({
|
||||
statusCode: status,
|
||||
timestamp: now,
|
||||
path: request.url,
|
||||
errors,
|
||||
})
|
||||
}
|
||||
|
||||
return response.status(status).json({
|
||||
statusCode: status,
|
||||
timestamp: now,
|
||||
path: request.url,
|
||||
...(typeof payload === 'object' ? payload : { message: payload }),
|
||||
})
|
||||
}
|
||||
|
||||
// Default values
|
||||
let status = HttpStatus.INTERNAL_SERVER_ERROR
|
||||
let message: any = 'Internal server error'
|
||||
let errors: string[] | undefined = undefined
|
||||
|
||||
// Prisma errors often expose a `code` property (e.g., P2002)
|
||||
const code = exception?.code
|
||||
if (code) {
|
||||
switch (code) {
|
||||
case 'P2002':
|
||||
// Unique constraint failed
|
||||
status = HttpStatus.CONFLICT
|
||||
message = 'Unique constraint failed'
|
||||
break
|
||||
case 'P2025':
|
||||
// Record not found for update/delete
|
||||
status = HttpStatus.NOT_FOUND
|
||||
message = exception?.meta?.cause ?? 'Record not found'
|
||||
break
|
||||
default:
|
||||
// Map other Prisma known errors to 400 Bad Request
|
||||
status = HttpStatus.BAD_REQUEST
|
||||
// try to extract readable errors (may contain newlines)
|
||||
errors = (exception.message || String(exception))
|
||||
.toString()
|
||||
.split('\n')
|
||||
.map(s => s.trim())
|
||||
.filter(Boolean)
|
||||
}
|
||||
} else if (exception instanceof Prisma.PrismaClientValidationError) {
|
||||
status = HttpStatus.BAD_REQUEST
|
||||
errors = exception.message
|
||||
.toString()
|
||||
.split('\n')
|
||||
.map(s => s.trim())
|
||||
.filter(Boolean)
|
||||
} else if (exception?.name === 'ValidationError' || exception?.name === 'ZodError') {
|
||||
// Common validation libraries
|
||||
status = HttpStatus.BAD_REQUEST
|
||||
// ZodError exposes issues array
|
||||
if (Array.isArray(exception.issues)) {
|
||||
errors = exception.issues.map((i: any) => i.message ?? String(i))
|
||||
} else {
|
||||
errors = exception.message
|
||||
? exception.message
|
||||
.toString()
|
||||
.split('\n')
|
||||
.map((s: string) => s.trim())
|
||||
.filter(Boolean)
|
||||
: [String(exception)]
|
||||
}
|
||||
} else if (exception instanceof Error) {
|
||||
// Generic JS error
|
||||
status = HttpStatus.INTERNAL_SERVER_ERROR
|
||||
message = exception.message
|
||||
}
|
||||
|
||||
const body: any = {
|
||||
statusCode: status,
|
||||
timestamp: now,
|
||||
path: request.url,
|
||||
}
|
||||
|
||||
if (status === HttpStatus.BAD_REQUEST) {
|
||||
body.errors = errors ?? [String(message)]
|
||||
} else {
|
||||
body.message = message
|
||||
}
|
||||
|
||||
response.status(status).json(body)
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
Injectable,
|
||||
NestInterceptor,
|
||||
} from '@nestjs/common'
|
||||
import { Response } from 'express'
|
||||
import { Observable } from 'rxjs'
|
||||
import { map } from 'rxjs/operators'
|
||||
|
||||
@@ -28,98 +29,177 @@ export class ResponseMappingInterceptor implements NestInterceptor {
|
||||
|
||||
return next.handle().pipe(
|
||||
map(data => {
|
||||
const statusCode = response?.statusCode ?? 200
|
||||
const statusCode: number = (response as Response)?.statusCode ?? 200
|
||||
|
||||
// Normalize list/paginated responses into { data, meta }
|
||||
if (data && typeof data === 'object') {
|
||||
if (Array.isArray((data as any).errors) && statusCode >= 400) {
|
||||
return {
|
||||
statusCode,
|
||||
timestamp: new Date().toISOString(),
|
||||
path: request?.url ?? '',
|
||||
errors: (data as any).errors,
|
||||
}
|
||||
}
|
||||
|
||||
if ((data as any).error && statusCode >= 400) {
|
||||
const e = (data as any).error
|
||||
const errors =
|
||||
typeof e === 'string' ? [e] : Array.isArray(e) ? e : [String(e)]
|
||||
return {
|
||||
statusCode,
|
||||
timestamp: new Date().toISOString(),
|
||||
path: request?.url ?? '',
|
||||
errors,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Normalize responses produced by ResponseMapper wrappers when present.
|
||||
let payload = data
|
||||
let meta: any = undefined
|
||||
let computedStatus = statusCode
|
||||
|
||||
// Case: plain array -> treat as list
|
||||
if (Array.isArray(data)) {
|
||||
payload = data
|
||||
meta = {
|
||||
totalRecords: data.length,
|
||||
totalPages: 1,
|
||||
page: 1,
|
||||
perPage: data.length,
|
||||
if (data && typeof data === 'object' && (data as any).__mapped) {
|
||||
const wrapped = data as any
|
||||
switch (wrapped.__mapped) {
|
||||
case 'create':
|
||||
computedStatus = 201
|
||||
payload = wrapped.data
|
||||
break
|
||||
case 'update':
|
||||
computedStatus = 200
|
||||
payload = wrapped.data
|
||||
break
|
||||
case 'single':
|
||||
computedStatus = 200
|
||||
payload = wrapped.data
|
||||
break
|
||||
case 'list':
|
||||
payload = Array.isArray(wrapped.items) ? wrapped.items : []
|
||||
meta = {
|
||||
totalRecords: payload.length,
|
||||
totalPages: 1,
|
||||
page: 1,
|
||||
perPage: payload.length,
|
||||
}
|
||||
break
|
||||
case 'paginate': {
|
||||
const items = Array.isArray(wrapped.items) ? wrapped.items : []
|
||||
const total =
|
||||
typeof wrapped.total === 'number' ? wrapped.total : items.length
|
||||
const perPage = wrapped.perPage ?? wrapped.limit ?? items.length
|
||||
const page = wrapped.page ?? 1
|
||||
payload = items
|
||||
meta = {
|
||||
totalRecords: total,
|
||||
totalPages: Math.max(1, Math.ceil(total / perPage)),
|
||||
page,
|
||||
perPage,
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'sequelize': {
|
||||
const items = Array.isArray(wrapped.rows) ? wrapped.rows : []
|
||||
const total =
|
||||
typeof wrapped.count === 'number' ? wrapped.count : items.length
|
||||
const perPage = wrapped.perPage ?? wrapped.limit ?? items.length
|
||||
const page = wrapped.page ?? 1
|
||||
payload = items
|
||||
meta = {
|
||||
totalRecords: total,
|
||||
totalPages: Math.max(1, Math.ceil(total / perPage)),
|
||||
page,
|
||||
perPage,
|
||||
}
|
||||
break
|
||||
}
|
||||
default:
|
||||
// Unknown wrapper — pass through payload as-is
|
||||
payload = wrapped
|
||||
}
|
||||
} else if (data && typeof data === 'object') {
|
||||
// Common pagination shapes
|
||||
// 1) { items: [...], total: N, page, perPage }
|
||||
if (
|
||||
Array.isArray((data as any).items) &&
|
||||
typeof (data as any).total === 'number'
|
||||
) {
|
||||
const items = (data as any).items
|
||||
const total = (data as any).total
|
||||
const perPage = (data as any).perPage ?? (data as any).limit ?? items.length
|
||||
const page = (data as any).page ?? 1
|
||||
payload = items
|
||||
} else {
|
||||
// Fallbacks for common shapes (arrays, items/rows/data shapes)
|
||||
if (Array.isArray(data)) {
|
||||
payload = data
|
||||
meta = {
|
||||
totalRecords: total,
|
||||
totalPages: Math.max(1, Math.ceil(total / perPage)),
|
||||
page,
|
||||
perPage,
|
||||
totalRecords: data.length,
|
||||
totalPages: 1,
|
||||
page: 1,
|
||||
perPage: data.length,
|
||||
}
|
||||
// 2) Sequelize-like: { rows: [...], count: N }
|
||||
} else if (
|
||||
Array.isArray((data as any).rows) &&
|
||||
typeof (data as any).count === 'number'
|
||||
) {
|
||||
const items = (data as any).rows
|
||||
const total = (data as any).count
|
||||
const perPage = (data as any).limit ?? (data as any).perPage ?? items.length
|
||||
const page = (data as any).page ?? 1
|
||||
payload = items
|
||||
meta = {
|
||||
totalRecords: total,
|
||||
totalPages: Math.max(1, Math.ceil(total / perPage)),
|
||||
page,
|
||||
perPage,
|
||||
}
|
||||
// 3) { data: [...], total, page, perPage }
|
||||
} else if (
|
||||
Array.isArray((data as any).data) &&
|
||||
typeof (data as any).total === 'number'
|
||||
) {
|
||||
const items = (data as any).data
|
||||
const total = (data as any).total
|
||||
const perPage = (data as any).perPage ?? (data as any).limit ?? items.length
|
||||
const page = (data as any).page ?? 1
|
||||
payload = items
|
||||
meta = {
|
||||
totalRecords: total,
|
||||
totalPages: Math.max(1, Math.ceil(total / perPage)),
|
||||
page,
|
||||
perPage,
|
||||
}
|
||||
// 4) fallback: object contains items array and optional total
|
||||
} else if (Array.isArray((data as any).items)) {
|
||||
const items = (data as any).items
|
||||
const total =
|
||||
typeof (data as any).total === 'number' ? (data as any).total : items.length
|
||||
const perPage = (data as any).perPage ?? (data as any).limit ?? items.length
|
||||
const page = (data as any).page ?? 1
|
||||
payload = items
|
||||
meta = {
|
||||
totalRecords: total,
|
||||
totalPages: Math.max(1, Math.ceil(total / perPage)),
|
||||
page,
|
||||
perPage,
|
||||
} else if (data && typeof data === 'object') {
|
||||
// Common pagination shapes
|
||||
if (
|
||||
Array.isArray((data as any).items) &&
|
||||
typeof (data as any).total === 'number'
|
||||
) {
|
||||
const items = (data as any).items
|
||||
const total = (data as any).total
|
||||
const perPage = (data as any).perPage ?? (data as any).limit ?? items.length
|
||||
const page = (data as any).page ?? 1
|
||||
payload = items
|
||||
meta = {
|
||||
totalRecords: total,
|
||||
totalPages: Math.max(1, Math.ceil(total / perPage)),
|
||||
page,
|
||||
perPage,
|
||||
}
|
||||
} else if (
|
||||
Array.isArray((data as any).rows) &&
|
||||
typeof (data as any).count === 'number'
|
||||
) {
|
||||
const items = (data as any).rows
|
||||
const total = (data as any).count
|
||||
const perPage = (data as any).limit ?? (data as any).perPage ?? items.length
|
||||
const page = (data as any).page ?? 1
|
||||
payload = items
|
||||
meta = {
|
||||
totalRecords: total,
|
||||
totalPages: Math.max(1, Math.ceil(total / perPage)),
|
||||
page,
|
||||
perPage,
|
||||
}
|
||||
} else if (
|
||||
Array.isArray((data as any).data) &&
|
||||
typeof (data as any).total === 'number'
|
||||
) {
|
||||
const items = (data as any).data
|
||||
const total = (data as any).total
|
||||
const perPage = (data as any).perPage ?? (data as any).limit ?? items.length
|
||||
const page = (data as any).page ?? 1
|
||||
payload = items
|
||||
meta = {
|
||||
totalRecords: total,
|
||||
totalPages: Math.max(1, Math.ceil(total / perPage)),
|
||||
page,
|
||||
perPage,
|
||||
}
|
||||
} else if (Array.isArray((data as any).items)) {
|
||||
const items = (data as any).items
|
||||
const total =
|
||||
typeof (data as any).total === 'number'
|
||||
? (data as any).total
|
||||
: items.length
|
||||
const perPage = (data as any).perPage ?? (data as any).limit ?? items.length
|
||||
const page = (data as any).page ?? 1
|
||||
payload = items
|
||||
meta = {
|
||||
totalRecords: total,
|
||||
totalPages: Math.max(1, Math.ceil(total / perPage)),
|
||||
page,
|
||||
perPage,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const envelope: any = {
|
||||
statusCode,
|
||||
timestamp: new Date().toISOString(),
|
||||
path: request?.url ?? '',
|
||||
data: payload,
|
||||
}
|
||||
if (meta)
|
||||
return {
|
||||
data: data.items,
|
||||
meta,
|
||||
}
|
||||
|
||||
if (meta) envelope.meta = meta
|
||||
|
||||
return envelope
|
||||
return data.data || data.items
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Response mapper helpers
|
||||
*
|
||||
* Services should use these helpers to return predictable shapes that
|
||||
* the global `ResponseMappingInterceptor` understands and normalizes.
|
||||
*/
|
||||
export type MapperWrapper<T> =
|
||||
| { __mapped: 'create' | 'update' | 'single'; data: T }
|
||||
| { __mapped: 'list'; items: T[] }
|
||||
| { __mapped: 'paginate'; items: T[]; total: number; page?: number; perPage?: number }
|
||||
| { __mapped: 'sequelize'; rows: T[]; count: number; page?: number; perPage?: number }
|
||||
|
||||
export const ResponseMapper = {
|
||||
create<T>(item: T): MapperWrapper<T> {
|
||||
return { __mapped: 'create', data: item }
|
||||
},
|
||||
|
||||
update<T>(item: T): MapperWrapper<T> {
|
||||
return { __mapped: 'update', data: item }
|
||||
},
|
||||
|
||||
single<T>(item: T): MapperWrapper<T> {
|
||||
return { __mapped: 'single', data: item }
|
||||
},
|
||||
|
||||
list<T>(items: T[]): MapperWrapper<T> {
|
||||
return { __mapped: 'list', items }
|
||||
},
|
||||
|
||||
paginate<T>(items: T[], total: number, page = 1, perPage = items.length) {
|
||||
return { __mapped: 'paginate', items, total, page, perPage }
|
||||
},
|
||||
|
||||
sequelizePaginate<T>(rows: T[], count: number, page = 1, perPage = rows.length) {
|
||||
return { __mapped: 'sequelize', rows, count, page, perPage }
|
||||
},
|
||||
}
|
||||
|
||||
export type Paginated<T> = ReturnType<typeof ResponseMapper.paginate>
|
||||
@@ -1,27 +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) {}
|
||||
|
||||
create(data: any) {
|
||||
return this.prisma.customer.create({ data })
|
||||
async create(data: any) {
|
||||
const item = await this.prisma.customer.create({ data })
|
||||
return ResponseMapper.create(item)
|
||||
}
|
||||
|
||||
findAll() {
|
||||
return this.prisma.customer.findMany()
|
||||
async findAll() {
|
||||
const items = await this.prisma.customer.findMany()
|
||||
return ResponseMapper.list(items)
|
||||
}
|
||||
|
||||
findOne(id: number) {
|
||||
return this.prisma.customer.findUnique({ where: { id } })
|
||||
async findOne(id: number) {
|
||||
const item = await this.prisma.customer.findUnique({ where: { id } })
|
||||
if (!item) return null
|
||||
return ResponseMapper.single(item)
|
||||
}
|
||||
|
||||
update(id: number, data: any) {
|
||||
return this.prisma.customer.update({ where: { id }, data })
|
||||
async update(id: number, data: any) {
|
||||
const item = await this.prisma.customer.update({ where: { id }, data })
|
||||
return ResponseMapper.update(item)
|
||||
}
|
||||
|
||||
remove(id: number) {
|
||||
return this.prisma.customer.delete({ where: { id } })
|
||||
async remove(id: number) {
|
||||
const item = await this.prisma.customer.delete({ where: { id } })
|
||||
return ResponseMapper.single(item)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,33 @@
|
||||
import { IsEmail, IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class CreateCustomerDto {
|
||||
@IsString()
|
||||
firstName: string
|
||||
|
||||
@IsString()
|
||||
lastName: string
|
||||
|
||||
@IsOptional()
|
||||
@IsEmail()
|
||||
email?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
mobileNumber?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
address?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
city?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
state?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
country?: string
|
||||
}
|
||||
|
||||
@@ -1,11 +1,41 @@
|
||||
import { Type } from 'class-transformer'
|
||||
import { IsBoolean, IsEmail, IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class UpdateCustomerDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
firstName?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
lastName?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsEmail()
|
||||
email?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
mobileNumber?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
address?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
city?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
state?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
country?: string
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Boolean)
|
||||
@IsBoolean()
|
||||
isActive?: boolean
|
||||
}
|
||||
|
||||
@@ -27,16 +27,16 @@ export type User = Prisma.UserModel
|
||||
*
|
||||
*/
|
||||
export type Role = Prisma.RoleModel
|
||||
/**
|
||||
* Model ProductVariant
|
||||
*
|
||||
*/
|
||||
export type ProductVariant = Prisma.ProductVariantModel
|
||||
/**
|
||||
* Model Product
|
||||
*
|
||||
*/
|
||||
export type Product = Prisma.ProductModel
|
||||
/**
|
||||
* Model ProductInfo
|
||||
*
|
||||
*/
|
||||
export type ProductInfo = Prisma.ProductInfoModel
|
||||
/**
|
||||
* Model ProductBrand
|
||||
*
|
||||
|
||||
@@ -47,16 +47,16 @@ export type User = Prisma.UserModel
|
||||
*
|
||||
*/
|
||||
export type Role = Prisma.RoleModel
|
||||
/**
|
||||
* Model ProductVariant
|
||||
*
|
||||
*/
|
||||
export type ProductVariant = Prisma.ProductVariantModel
|
||||
/**
|
||||
* Model Product
|
||||
*
|
||||
*/
|
||||
export type Product = Prisma.ProductModel
|
||||
/**
|
||||
* Model ProductInfo
|
||||
*
|
||||
*/
|
||||
export type ProductInfo = Prisma.ProductInfoModel
|
||||
/**
|
||||
* Model ProductBrand
|
||||
*
|
||||
|
||||
@@ -213,17 +213,6 @@ export type DateTimeNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedDateTimeNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type BigIntNullableFilter<$PrismaModel = never> = {
|
||||
equals?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel> | null
|
||||
in?: bigint[] | number[] | null
|
||||
notIn?: bigint[] | number[] | null
|
||||
lt?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel>
|
||||
lte?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel>
|
||||
gt?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel>
|
||||
gte?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedBigIntNullableFilter<$PrismaModel> | bigint | number | null
|
||||
}
|
||||
|
||||
export type DecimalFilter<$PrismaModel = never> = {
|
||||
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[]
|
||||
@@ -235,27 +224,22 @@ export type DecimalFilter<$PrismaModel = never> = {
|
||||
not?: Prisma.NestedDecimalFilter<$PrismaModel> | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
}
|
||||
|
||||
export type DecimalNullableFilter<$PrismaModel = never> = {
|
||||
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> | null
|
||||
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | null
|
||||
notIn?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | null
|
||||
lt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
lte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
gt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
gte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedDecimalNullableFilter<$PrismaModel> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
}
|
||||
|
||||
export type BoolFilter<$PrismaModel = never> = {
|
||||
equals?: boolean | Prisma.BooleanFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedBoolFilter<$PrismaModel> | boolean
|
||||
}
|
||||
|
||||
export type BigIntNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel> | null
|
||||
in?: bigint[] | number[] | null
|
||||
notIn?: bigint[] | number[] | null
|
||||
lt?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel>
|
||||
lte?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel>
|
||||
gt?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel>
|
||||
gte?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedBigIntNullableWithAggregatesFilter<$PrismaModel> | bigint | number | null
|
||||
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_avg?: Prisma.NestedFloatNullableFilter<$PrismaModel>
|
||||
_sum?: Prisma.NestedBigIntNullableFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedBigIntNullableFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedBigIntNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type DecimalWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[]
|
||||
@@ -272,6 +256,22 @@ export type DecimalWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedDecimalFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type DecimalNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> | null
|
||||
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | null
|
||||
notIn?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | null
|
||||
lt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
lte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
gt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
gte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedDecimalNullableWithAggregatesFilter<$PrismaModel> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_avg?: Prisma.NestedDecimalNullableFilter<$PrismaModel>
|
||||
_sum?: Prisma.NestedDecimalNullableFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedDecimalNullableFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedDecimalNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type BoolWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: boolean | Prisma.BooleanFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedBoolWithAggregatesFilter<$PrismaModel> | boolean
|
||||
@@ -496,17 +496,6 @@ export type NestedDateTimeNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedDateTimeNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedBigIntNullableFilter<$PrismaModel = never> = {
|
||||
equals?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel> | null
|
||||
in?: bigint[] | number[] | null
|
||||
notIn?: bigint[] | number[] | null
|
||||
lt?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel>
|
||||
lte?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel>
|
||||
gt?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel>
|
||||
gte?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedBigIntNullableFilter<$PrismaModel> | bigint | number | null
|
||||
}
|
||||
|
||||
export type NestedDecimalFilter<$PrismaModel = never> = {
|
||||
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[]
|
||||
@@ -518,38 +507,22 @@ export type NestedDecimalFilter<$PrismaModel = never> = {
|
||||
not?: Prisma.NestedDecimalFilter<$PrismaModel> | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
}
|
||||
|
||||
export type NestedDecimalNullableFilter<$PrismaModel = never> = {
|
||||
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> | null
|
||||
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | null
|
||||
notIn?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | null
|
||||
lt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
lte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
gt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
gte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedDecimalNullableFilter<$PrismaModel> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
}
|
||||
|
||||
export type NestedBoolFilter<$PrismaModel = never> = {
|
||||
equals?: boolean | Prisma.BooleanFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedBoolFilter<$PrismaModel> | boolean
|
||||
}
|
||||
|
||||
export type NestedBigIntNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel> | null
|
||||
in?: bigint[] | number[] | null
|
||||
notIn?: bigint[] | number[] | null
|
||||
lt?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel>
|
||||
lte?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel>
|
||||
gt?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel>
|
||||
gte?: bigint | number | Prisma.BigIntFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedBigIntNullableWithAggregatesFilter<$PrismaModel> | bigint | number | null
|
||||
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_avg?: Prisma.NestedFloatNullableFilter<$PrismaModel>
|
||||
_sum?: Prisma.NestedBigIntNullableFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedBigIntNullableFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedBigIntNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedFloatNullableFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel> | null
|
||||
in?: number[] | null
|
||||
notIn?: number[] | null
|
||||
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedFloatNullableFilter<$PrismaModel> | number | null
|
||||
}
|
||||
|
||||
export type NestedDecimalWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[]
|
||||
@@ -566,6 +539,22 @@ export type NestedDecimalWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedDecimalFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedDecimalNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> | null
|
||||
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | null
|
||||
notIn?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | null
|
||||
lt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
lte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
gt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
gte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedDecimalNullableWithAggregatesFilter<$PrismaModel> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_avg?: Prisma.NestedDecimalNullableFilter<$PrismaModel>
|
||||
_sum?: Prisma.NestedDecimalNullableFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedDecimalNullableFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedDecimalNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedBoolWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: boolean | Prisma.BooleanFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedBoolWithAggregatesFilter<$PrismaModel> | boolean
|
||||
@@ -590,4 +579,15 @@ export type NestedIntNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedFloatNullableFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel> | null
|
||||
in?: number[] | null
|
||||
notIn?: number[] | null
|
||||
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedFloatNullableFilter<$PrismaModel> | number | null
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -386,8 +386,8 @@ type FieldRefInputType<Model, FieldType> = Model extends never ? never : FieldRe
|
||||
export const ModelName = {
|
||||
User: 'User',
|
||||
Role: 'Role',
|
||||
ProductVariant: 'ProductVariant',
|
||||
Product: 'Product',
|
||||
ProductInfo: 'ProductInfo',
|
||||
ProductBrand: 'ProductBrand',
|
||||
ProductCategory: 'ProductCategory',
|
||||
Supplier: 'Supplier',
|
||||
@@ -409,7 +409,7 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
omit: GlobalOmitOptions
|
||||
}
|
||||
meta: {
|
||||
modelProps: "user" | "role" | "product" | "productInfo" | "productBrand" | "productCategory" | "supplier" | "customer" | "inventory" | "store"
|
||||
modelProps: "user" | "role" | "productVariant" | "product" | "productBrand" | "productCategory" | "supplier" | "customer" | "inventory" | "store"
|
||||
txIsolationLevel: TransactionIsolationLevel
|
||||
}
|
||||
model: {
|
||||
@@ -545,6 +545,72 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
}
|
||||
}
|
||||
}
|
||||
ProductVariant: {
|
||||
payload: Prisma.$ProductVariantPayload<ExtArgs>
|
||||
fields: Prisma.ProductVariantFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.ProductVariantFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductVariantPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.ProductVariantFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductVariantPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.ProductVariantFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductVariantPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.ProductVariantFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductVariantPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.ProductVariantFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductVariantPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.ProductVariantCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductVariantPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.ProductVariantCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.ProductVariantDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductVariantPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.ProductVariantUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductVariantPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.ProductVariantDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.ProductVariantUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.ProductVariantUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductVariantPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.ProductVariantAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateProductVariant>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.ProductVariantGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.ProductVariantGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.ProductVariantCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.ProductVariantCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
Product: {
|
||||
payload: Prisma.$ProductPayload<ExtArgs>
|
||||
fields: Prisma.ProductFieldRefs
|
||||
@@ -611,72 +677,6 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
}
|
||||
}
|
||||
}
|
||||
ProductInfo: {
|
||||
payload: Prisma.$ProductInfoPayload<ExtArgs>
|
||||
fields: Prisma.ProductInfoFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.ProductInfoFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductInfoPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.ProductInfoFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductInfoPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.ProductInfoFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductInfoPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.ProductInfoFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductInfoPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.ProductInfoFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductInfoPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.ProductInfoCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductInfoPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.ProductInfoCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.ProductInfoDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductInfoPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.ProductInfoUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductInfoPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.ProductInfoDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.ProductInfoUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.ProductInfoUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ProductInfoPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.ProductInfoAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateProductInfo>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.ProductInfoGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.ProductInfoGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.ProductInfoCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.ProductInfoCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
ProductBrand: {
|
||||
payload: Prisma.$ProductBrandPayload<ExtArgs>
|
||||
fields: Prisma.ProductBrandFieldRefs
|
||||
@@ -1137,16 +1137,15 @@ export const RoleScalarFieldEnum = {
|
||||
export type RoleScalarFieldEnum = (typeof RoleScalarFieldEnum)[keyof typeof RoleScalarFieldEnum]
|
||||
|
||||
|
||||
export const ProductScalarFieldEnum = {
|
||||
export const ProductVariantScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
basePrice: 'basePrice',
|
||||
salePrice: 'salePrice',
|
||||
description: 'description',
|
||||
sku: 'sku',
|
||||
barcode: 'barcode',
|
||||
imageUrl: 'imageUrl',
|
||||
attachmentId: 'attachmentId',
|
||||
unit: 'unit',
|
||||
discount: 'discount',
|
||||
quantity: 'quantity',
|
||||
alertQuantity: 'alertQuantity',
|
||||
isActive: 'isActive',
|
||||
@@ -1154,27 +1153,26 @@ export const ProductScalarFieldEnum = {
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
deletedAt: 'deletedAt',
|
||||
productInfoId: 'productInfoId'
|
||||
productId: 'productId'
|
||||
} as const
|
||||
|
||||
export type ProductScalarFieldEnum = (typeof ProductScalarFieldEnum)[keyof typeof ProductScalarFieldEnum]
|
||||
export type ProductVariantScalarFieldEnum = (typeof ProductVariantScalarFieldEnum)[keyof typeof ProductVariantScalarFieldEnum]
|
||||
|
||||
|
||||
export const ProductInfoScalarFieldEnum = {
|
||||
export const ProductScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
barcode: 'barcode',
|
||||
sku: 'sku',
|
||||
description: 'description',
|
||||
productType: 'productType',
|
||||
metaData: 'metaData',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
deletedAt: 'deletedAt',
|
||||
brandId: 'brandId',
|
||||
categoryId: 'categoryId',
|
||||
supplierId: 'supplierId'
|
||||
categoryId: 'categoryId'
|
||||
} as const
|
||||
|
||||
export type ProductInfoScalarFieldEnum = (typeof ProductInfoScalarFieldEnum)[keyof typeof ProductInfoScalarFieldEnum]
|
||||
export type ProductScalarFieldEnum = (typeof ProductScalarFieldEnum)[keyof typeof ProductScalarFieldEnum]
|
||||
|
||||
|
||||
export const ProductBrandScalarFieldEnum = {
|
||||
@@ -1324,25 +1322,25 @@ export const RoleOrderByRelevanceFieldEnum = {
|
||||
export type RoleOrderByRelevanceFieldEnum = (typeof RoleOrderByRelevanceFieldEnum)[keyof typeof RoleOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const ProductOrderByRelevanceFieldEnum = {
|
||||
export const ProductVariantOrderByRelevanceFieldEnum = {
|
||||
name: 'name',
|
||||
description: 'description',
|
||||
sku: 'sku',
|
||||
barcode: 'barcode',
|
||||
imageUrl: 'imageUrl',
|
||||
unit: 'unit'
|
||||
} as const
|
||||
|
||||
export type ProductOrderByRelevanceFieldEnum = (typeof ProductOrderByRelevanceFieldEnum)[keyof typeof ProductOrderByRelevanceFieldEnum]
|
||||
export type ProductVariantOrderByRelevanceFieldEnum = (typeof ProductVariantOrderByRelevanceFieldEnum)[keyof typeof ProductVariantOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const ProductInfoOrderByRelevanceFieldEnum = {
|
||||
export const ProductOrderByRelevanceFieldEnum = {
|
||||
name: 'name',
|
||||
description: 'description',
|
||||
productType: 'productType'
|
||||
barcode: 'barcode',
|
||||
sku: 'sku',
|
||||
description: 'description'
|
||||
} as const
|
||||
|
||||
export type ProductInfoOrderByRelevanceFieldEnum = (typeof ProductInfoOrderByRelevanceFieldEnum)[keyof typeof ProductInfoOrderByRelevanceFieldEnum]
|
||||
export type ProductOrderByRelevanceFieldEnum = (typeof ProductOrderByRelevanceFieldEnum)[keyof typeof ProductOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const ProductBrandOrderByRelevanceFieldEnum = {
|
||||
@@ -1448,13 +1446,6 @@ export type DateTimeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'BigInt'
|
||||
*/
|
||||
export type BigIntFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'BigInt'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'Decimal'
|
||||
*/
|
||||
@@ -1572,8 +1563,8 @@ export type PrismaClientOptions = ({
|
||||
export type GlobalOmitConfig = {
|
||||
user?: Prisma.UserOmit
|
||||
role?: Prisma.RoleOmit
|
||||
productVariant?: Prisma.ProductVariantOmit
|
||||
product?: Prisma.ProductOmit
|
||||
productInfo?: Prisma.ProductInfoOmit
|
||||
productBrand?: Prisma.ProductBrandOmit
|
||||
productCategory?: Prisma.ProductCategoryOmit
|
||||
supplier?: Prisma.SupplierOmit
|
||||
|
||||
@@ -53,8 +53,8 @@ export const AnyNull = runtime.AnyNull
|
||||
export const ModelName = {
|
||||
User: 'User',
|
||||
Role: 'Role',
|
||||
ProductVariant: 'ProductVariant',
|
||||
Product: 'Product',
|
||||
ProductInfo: 'ProductInfo',
|
||||
ProductBrand: 'ProductBrand',
|
||||
ProductCategory: 'ProductCategory',
|
||||
Supplier: 'Supplier',
|
||||
@@ -104,16 +104,15 @@ export const RoleScalarFieldEnum = {
|
||||
export type RoleScalarFieldEnum = (typeof RoleScalarFieldEnum)[keyof typeof RoleScalarFieldEnum]
|
||||
|
||||
|
||||
export const ProductScalarFieldEnum = {
|
||||
export const ProductVariantScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
basePrice: 'basePrice',
|
||||
salePrice: 'salePrice',
|
||||
description: 'description',
|
||||
sku: 'sku',
|
||||
barcode: 'barcode',
|
||||
imageUrl: 'imageUrl',
|
||||
attachmentId: 'attachmentId',
|
||||
unit: 'unit',
|
||||
discount: 'discount',
|
||||
quantity: 'quantity',
|
||||
alertQuantity: 'alertQuantity',
|
||||
isActive: 'isActive',
|
||||
@@ -121,27 +120,26 @@ export const ProductScalarFieldEnum = {
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
deletedAt: 'deletedAt',
|
||||
productInfoId: 'productInfoId'
|
||||
productId: 'productId'
|
||||
} as const
|
||||
|
||||
export type ProductScalarFieldEnum = (typeof ProductScalarFieldEnum)[keyof typeof ProductScalarFieldEnum]
|
||||
export type ProductVariantScalarFieldEnum = (typeof ProductVariantScalarFieldEnum)[keyof typeof ProductVariantScalarFieldEnum]
|
||||
|
||||
|
||||
export const ProductInfoScalarFieldEnum = {
|
||||
export const ProductScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
barcode: 'barcode',
|
||||
sku: 'sku',
|
||||
description: 'description',
|
||||
productType: 'productType',
|
||||
metaData: 'metaData',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
deletedAt: 'deletedAt',
|
||||
brandId: 'brandId',
|
||||
categoryId: 'categoryId',
|
||||
supplierId: 'supplierId'
|
||||
categoryId: 'categoryId'
|
||||
} as const
|
||||
|
||||
export type ProductInfoScalarFieldEnum = (typeof ProductInfoScalarFieldEnum)[keyof typeof ProductInfoScalarFieldEnum]
|
||||
export type ProductScalarFieldEnum = (typeof ProductScalarFieldEnum)[keyof typeof ProductScalarFieldEnum]
|
||||
|
||||
|
||||
export const ProductBrandScalarFieldEnum = {
|
||||
@@ -291,25 +289,25 @@ export const RoleOrderByRelevanceFieldEnum = {
|
||||
export type RoleOrderByRelevanceFieldEnum = (typeof RoleOrderByRelevanceFieldEnum)[keyof typeof RoleOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const ProductOrderByRelevanceFieldEnum = {
|
||||
export const ProductVariantOrderByRelevanceFieldEnum = {
|
||||
name: 'name',
|
||||
description: 'description',
|
||||
sku: 'sku',
|
||||
barcode: 'barcode',
|
||||
imageUrl: 'imageUrl',
|
||||
unit: 'unit'
|
||||
} as const
|
||||
|
||||
export type ProductOrderByRelevanceFieldEnum = (typeof ProductOrderByRelevanceFieldEnum)[keyof typeof ProductOrderByRelevanceFieldEnum]
|
||||
export type ProductVariantOrderByRelevanceFieldEnum = (typeof ProductVariantOrderByRelevanceFieldEnum)[keyof typeof ProductVariantOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const ProductInfoOrderByRelevanceFieldEnum = {
|
||||
export const ProductOrderByRelevanceFieldEnum = {
|
||||
name: 'name',
|
||||
description: 'description',
|
||||
productType: 'productType'
|
||||
barcode: 'barcode',
|
||||
sku: 'sku',
|
||||
description: 'description'
|
||||
} as const
|
||||
|
||||
export type ProductInfoOrderByRelevanceFieldEnum = (typeof ProductInfoOrderByRelevanceFieldEnum)[keyof typeof ProductInfoOrderByRelevanceFieldEnum]
|
||||
export type ProductOrderByRelevanceFieldEnum = (typeof ProductOrderByRelevanceFieldEnum)[keyof typeof ProductOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const ProductBrandOrderByRelevanceFieldEnum = {
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
*/
|
||||
export type * from './models/User.js'
|
||||
export type * from './models/Role.js'
|
||||
export type * from './models/ProductVariant.js'
|
||||
export type * from './models/Product.js'
|
||||
export type * from './models/ProductInfo.js'
|
||||
export type * from './models/ProductBrand.js'
|
||||
export type * from './models/ProductCategory.js'
|
||||
export type * from './models/Supplier.js'
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -232,7 +232,7 @@ export type ProductBrandWhereInput = {
|
||||
createdAt?: Prisma.DateTimeFilter<"ProductBrand"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<"ProductBrand"> | Date | string
|
||||
deletedAt?: Prisma.DateTimeNullableFilter<"ProductBrand"> | Date | string | null
|
||||
productInfo?: Prisma.ProductInfoListRelationFilter
|
||||
products?: Prisma.ProductListRelationFilter
|
||||
}
|
||||
|
||||
export type ProductBrandOrderByWithRelationInput = {
|
||||
@@ -243,7 +243,7 @@ export type ProductBrandOrderByWithRelationInput = {
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
productInfo?: Prisma.ProductInfoOrderByRelationAggregateInput
|
||||
products?: Prisma.ProductOrderByRelationAggregateInput
|
||||
_relevance?: Prisma.ProductBrandOrderByRelevanceInput
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ export type ProductBrandWhereUniqueInput = Prisma.AtLeast<{
|
||||
createdAt?: Prisma.DateTimeFilter<"ProductBrand"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<"ProductBrand"> | Date | string
|
||||
deletedAt?: Prisma.DateTimeNullableFilter<"ProductBrand"> | Date | string | null
|
||||
productInfo?: Prisma.ProductInfoListRelationFilter
|
||||
products?: Prisma.ProductListRelationFilter
|
||||
}, "id">
|
||||
|
||||
export type ProductBrandOrderByWithAggregationInput = {
|
||||
@@ -296,7 +296,7 @@ export type ProductBrandCreateInput = {
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
deletedAt?: Date | string | null
|
||||
productInfo?: Prisma.ProductInfoCreateNestedManyWithoutBrandInput
|
||||
products?: Prisma.ProductCreateNestedManyWithoutBrandInput
|
||||
}
|
||||
|
||||
export type ProductBrandUncheckedCreateInput = {
|
||||
@@ -307,7 +307,7 @@ export type ProductBrandUncheckedCreateInput = {
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
deletedAt?: Date | string | null
|
||||
productInfo?: Prisma.ProductInfoUncheckedCreateNestedManyWithoutBrandInput
|
||||
products?: Prisma.ProductUncheckedCreateNestedManyWithoutBrandInput
|
||||
}
|
||||
|
||||
export type ProductBrandUpdateInput = {
|
||||
@@ -317,7 +317,7 @@ export type ProductBrandUpdateInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
productInfo?: Prisma.ProductInfoUpdateManyWithoutBrandNestedInput
|
||||
products?: Prisma.ProductUpdateManyWithoutBrandNestedInput
|
||||
}
|
||||
|
||||
export type ProductBrandUncheckedUpdateInput = {
|
||||
@@ -328,7 +328,7 @@ export type ProductBrandUncheckedUpdateInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
productInfo?: Prisma.ProductInfoUncheckedUpdateManyWithoutBrandNestedInput
|
||||
products?: Prisma.ProductUncheckedUpdateManyWithoutBrandNestedInput
|
||||
}
|
||||
|
||||
export type ProductBrandCreateManyInput = {
|
||||
@@ -409,23 +409,23 @@ export type ProductBrandSumOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type ProductBrandCreateNestedOneWithoutProductInfoInput = {
|
||||
create?: Prisma.XOR<Prisma.ProductBrandCreateWithoutProductInfoInput, Prisma.ProductBrandUncheckedCreateWithoutProductInfoInput>
|
||||
connectOrCreate?: Prisma.ProductBrandCreateOrConnectWithoutProductInfoInput
|
||||
export type ProductBrandCreateNestedOneWithoutProductsInput = {
|
||||
create?: Prisma.XOR<Prisma.ProductBrandCreateWithoutProductsInput, Prisma.ProductBrandUncheckedCreateWithoutProductsInput>
|
||||
connectOrCreate?: Prisma.ProductBrandCreateOrConnectWithoutProductsInput
|
||||
connect?: Prisma.ProductBrandWhereUniqueInput
|
||||
}
|
||||
|
||||
export type ProductBrandUpdateOneWithoutProductInfoNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.ProductBrandCreateWithoutProductInfoInput, Prisma.ProductBrandUncheckedCreateWithoutProductInfoInput>
|
||||
connectOrCreate?: Prisma.ProductBrandCreateOrConnectWithoutProductInfoInput
|
||||
upsert?: Prisma.ProductBrandUpsertWithoutProductInfoInput
|
||||
export type ProductBrandUpdateOneWithoutProductsNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.ProductBrandCreateWithoutProductsInput, Prisma.ProductBrandUncheckedCreateWithoutProductsInput>
|
||||
connectOrCreate?: Prisma.ProductBrandCreateOrConnectWithoutProductsInput
|
||||
upsert?: Prisma.ProductBrandUpsertWithoutProductsInput
|
||||
disconnect?: Prisma.ProductBrandWhereInput | boolean
|
||||
delete?: Prisma.ProductBrandWhereInput | boolean
|
||||
connect?: Prisma.ProductBrandWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.ProductBrandUpdateToOneWithWhereWithoutProductInfoInput, Prisma.ProductBrandUpdateWithoutProductInfoInput>, Prisma.ProductBrandUncheckedUpdateWithoutProductInfoInput>
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.ProductBrandUpdateToOneWithWhereWithoutProductsInput, Prisma.ProductBrandUpdateWithoutProductsInput>, Prisma.ProductBrandUncheckedUpdateWithoutProductsInput>
|
||||
}
|
||||
|
||||
export type ProductBrandCreateWithoutProductInfoInput = {
|
||||
export type ProductBrandCreateWithoutProductsInput = {
|
||||
name: string
|
||||
description?: string | null
|
||||
imageUrl?: string | null
|
||||
@@ -434,7 +434,7 @@ export type ProductBrandCreateWithoutProductInfoInput = {
|
||||
deletedAt?: Date | string | null
|
||||
}
|
||||
|
||||
export type ProductBrandUncheckedCreateWithoutProductInfoInput = {
|
||||
export type ProductBrandUncheckedCreateWithoutProductsInput = {
|
||||
id?: number
|
||||
name: string
|
||||
description?: string | null
|
||||
@@ -444,23 +444,23 @@ export type ProductBrandUncheckedCreateWithoutProductInfoInput = {
|
||||
deletedAt?: Date | string | null
|
||||
}
|
||||
|
||||
export type ProductBrandCreateOrConnectWithoutProductInfoInput = {
|
||||
export type ProductBrandCreateOrConnectWithoutProductsInput = {
|
||||
where: Prisma.ProductBrandWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.ProductBrandCreateWithoutProductInfoInput, Prisma.ProductBrandUncheckedCreateWithoutProductInfoInput>
|
||||
create: Prisma.XOR<Prisma.ProductBrandCreateWithoutProductsInput, Prisma.ProductBrandUncheckedCreateWithoutProductsInput>
|
||||
}
|
||||
|
||||
export type ProductBrandUpsertWithoutProductInfoInput = {
|
||||
update: Prisma.XOR<Prisma.ProductBrandUpdateWithoutProductInfoInput, Prisma.ProductBrandUncheckedUpdateWithoutProductInfoInput>
|
||||
create: Prisma.XOR<Prisma.ProductBrandCreateWithoutProductInfoInput, Prisma.ProductBrandUncheckedCreateWithoutProductInfoInput>
|
||||
export type ProductBrandUpsertWithoutProductsInput = {
|
||||
update: Prisma.XOR<Prisma.ProductBrandUpdateWithoutProductsInput, Prisma.ProductBrandUncheckedUpdateWithoutProductsInput>
|
||||
create: Prisma.XOR<Prisma.ProductBrandCreateWithoutProductsInput, Prisma.ProductBrandUncheckedCreateWithoutProductsInput>
|
||||
where?: Prisma.ProductBrandWhereInput
|
||||
}
|
||||
|
||||
export type ProductBrandUpdateToOneWithWhereWithoutProductInfoInput = {
|
||||
export type ProductBrandUpdateToOneWithWhereWithoutProductsInput = {
|
||||
where?: Prisma.ProductBrandWhereInput
|
||||
data: Prisma.XOR<Prisma.ProductBrandUpdateWithoutProductInfoInput, Prisma.ProductBrandUncheckedUpdateWithoutProductInfoInput>
|
||||
data: Prisma.XOR<Prisma.ProductBrandUpdateWithoutProductsInput, Prisma.ProductBrandUncheckedUpdateWithoutProductsInput>
|
||||
}
|
||||
|
||||
export type ProductBrandUpdateWithoutProductInfoInput = {
|
||||
export type ProductBrandUpdateWithoutProductsInput = {
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
imageUrl?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -469,7 +469,7 @@ export type ProductBrandUpdateWithoutProductInfoInput = {
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
}
|
||||
|
||||
export type ProductBrandUncheckedUpdateWithoutProductInfoInput = {
|
||||
export type ProductBrandUncheckedUpdateWithoutProductsInput = {
|
||||
id?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -485,11 +485,11 @@ export type ProductBrandUncheckedUpdateWithoutProductInfoInput = {
|
||||
*/
|
||||
|
||||
export type ProductBrandCountOutputType = {
|
||||
productInfo: number
|
||||
products: number
|
||||
}
|
||||
|
||||
export type ProductBrandCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
productInfo?: boolean | ProductBrandCountOutputTypeCountProductInfoArgs
|
||||
products?: boolean | ProductBrandCountOutputTypeCountProductsArgs
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -505,8 +505,8 @@ export type ProductBrandCountOutputTypeDefaultArgs<ExtArgs extends runtime.Types
|
||||
/**
|
||||
* ProductBrandCountOutputType without action
|
||||
*/
|
||||
export type ProductBrandCountOutputTypeCountProductInfoArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
where?: Prisma.ProductInfoWhereInput
|
||||
export type ProductBrandCountOutputTypeCountProductsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
where?: Prisma.ProductWhereInput
|
||||
}
|
||||
|
||||
|
||||
@@ -518,7 +518,7 @@ export type ProductBrandSelect<ExtArgs extends runtime.Types.Extensions.Internal
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
deletedAt?: boolean
|
||||
productInfo?: boolean | Prisma.ProductBrand$productInfoArgs<ExtArgs>
|
||||
products?: boolean | Prisma.ProductBrand$productsArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.ProductBrandCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["productBrand"]>
|
||||
|
||||
@@ -536,14 +536,14 @@ export type ProductBrandSelectScalar = {
|
||||
|
||||
export type ProductBrandOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "name" | "description" | "imageUrl" | "createdAt" | "updatedAt" | "deletedAt", ExtArgs["result"]["productBrand"]>
|
||||
export type ProductBrandInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
productInfo?: boolean | Prisma.ProductBrand$productInfoArgs<ExtArgs>
|
||||
products?: boolean | Prisma.ProductBrand$productsArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.ProductBrandCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}
|
||||
|
||||
export type $ProductBrandPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
name: "ProductBrand"
|
||||
objects: {
|
||||
productInfo: Prisma.$ProductInfoPayload<ExtArgs>[]
|
||||
products: Prisma.$ProductPayload<ExtArgs>[]
|
||||
}
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||
id: number
|
||||
@@ -893,7 +893,7 @@ readonly fields: ProductBrandFieldRefs;
|
||||
*/
|
||||
export interface Prisma__ProductBrandClient<T, Null = never, ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> extends Prisma.PrismaPromise<T> {
|
||||
readonly [Symbol.toStringTag]: "PrismaPromise"
|
||||
productInfo<T extends Prisma.ProductBrand$productInfoArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.ProductBrand$productInfoArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ProductInfoPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
products<T extends Prisma.ProductBrand$productsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.ProductBrand$productsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ProductPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
@@ -1273,27 +1273,27 @@ export type ProductBrandDeleteManyArgs<ExtArgs extends runtime.Types.Extensions.
|
||||
}
|
||||
|
||||
/**
|
||||
* ProductBrand.productInfo
|
||||
* ProductBrand.products
|
||||
*/
|
||||
export type ProductBrand$productInfoArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
export type ProductBrand$productsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the ProductInfo
|
||||
* Select specific fields to fetch from the Product
|
||||
*/
|
||||
select?: Prisma.ProductInfoSelect<ExtArgs> | null
|
||||
select?: Prisma.ProductSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the ProductInfo
|
||||
* Omit specific fields from the Product
|
||||
*/
|
||||
omit?: Prisma.ProductInfoOmit<ExtArgs> | null
|
||||
omit?: Prisma.ProductOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.ProductInfoInclude<ExtArgs> | null
|
||||
where?: Prisma.ProductInfoWhereInput
|
||||
orderBy?: Prisma.ProductInfoOrderByWithRelationInput | Prisma.ProductInfoOrderByWithRelationInput[]
|
||||
cursor?: Prisma.ProductInfoWhereUniqueInput
|
||||
include?: Prisma.ProductInclude<ExtArgs> | null
|
||||
where?: Prisma.ProductWhereInput
|
||||
orderBy?: Prisma.ProductOrderByWithRelationInput | Prisma.ProductOrderByWithRelationInput[]
|
||||
cursor?: Prisma.ProductWhereUniqueInput
|
||||
take?: number
|
||||
skip?: number
|
||||
distinct?: Prisma.ProductInfoScalarFieldEnum | Prisma.ProductInfoScalarFieldEnum[]
|
||||
distinct?: Prisma.ProductScalarFieldEnum | Prisma.ProductScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -232,7 +232,7 @@ export type ProductCategoryWhereInput = {
|
||||
createdAt?: Prisma.DateTimeFilter<"ProductCategory"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<"ProductCategory"> | Date | string
|
||||
deletedAt?: Prisma.DateTimeNullableFilter<"ProductCategory"> | Date | string | null
|
||||
productInfo?: Prisma.ProductInfoListRelationFilter
|
||||
products?: Prisma.ProductListRelationFilter
|
||||
}
|
||||
|
||||
export type ProductCategoryOrderByWithRelationInput = {
|
||||
@@ -243,7 +243,7 @@ export type ProductCategoryOrderByWithRelationInput = {
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
productInfo?: Prisma.ProductInfoOrderByRelationAggregateInput
|
||||
products?: Prisma.ProductOrderByRelationAggregateInput
|
||||
_relevance?: Prisma.ProductCategoryOrderByRelevanceInput
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ export type ProductCategoryWhereUniqueInput = Prisma.AtLeast<{
|
||||
createdAt?: Prisma.DateTimeFilter<"ProductCategory"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<"ProductCategory"> | Date | string
|
||||
deletedAt?: Prisma.DateTimeNullableFilter<"ProductCategory"> | Date | string | null
|
||||
productInfo?: Prisma.ProductInfoListRelationFilter
|
||||
products?: Prisma.ProductListRelationFilter
|
||||
}, "id">
|
||||
|
||||
export type ProductCategoryOrderByWithAggregationInput = {
|
||||
@@ -296,7 +296,7 @@ export type ProductCategoryCreateInput = {
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
deletedAt?: Date | string | null
|
||||
productInfo?: Prisma.ProductInfoCreateNestedManyWithoutCategoryInput
|
||||
products?: Prisma.ProductCreateNestedManyWithoutCategoryInput
|
||||
}
|
||||
|
||||
export type ProductCategoryUncheckedCreateInput = {
|
||||
@@ -307,7 +307,7 @@ export type ProductCategoryUncheckedCreateInput = {
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
deletedAt?: Date | string | null
|
||||
productInfo?: Prisma.ProductInfoUncheckedCreateNestedManyWithoutCategoryInput
|
||||
products?: Prisma.ProductUncheckedCreateNestedManyWithoutCategoryInput
|
||||
}
|
||||
|
||||
export type ProductCategoryUpdateInput = {
|
||||
@@ -317,7 +317,7 @@ export type ProductCategoryUpdateInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
productInfo?: Prisma.ProductInfoUpdateManyWithoutCategoryNestedInput
|
||||
products?: Prisma.ProductUpdateManyWithoutCategoryNestedInput
|
||||
}
|
||||
|
||||
export type ProductCategoryUncheckedUpdateInput = {
|
||||
@@ -328,7 +328,7 @@ export type ProductCategoryUncheckedUpdateInput = {
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
productInfo?: Prisma.ProductInfoUncheckedUpdateManyWithoutCategoryNestedInput
|
||||
products?: Prisma.ProductUncheckedUpdateManyWithoutCategoryNestedInput
|
||||
}
|
||||
|
||||
export type ProductCategoryCreateManyInput = {
|
||||
@@ -409,23 +409,23 @@ export type ProductCategorySumOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type ProductCategoryCreateNestedOneWithoutProductInfoInput = {
|
||||
create?: Prisma.XOR<Prisma.ProductCategoryCreateWithoutProductInfoInput, Prisma.ProductCategoryUncheckedCreateWithoutProductInfoInput>
|
||||
connectOrCreate?: Prisma.ProductCategoryCreateOrConnectWithoutProductInfoInput
|
||||
export type ProductCategoryCreateNestedOneWithoutProductsInput = {
|
||||
create?: Prisma.XOR<Prisma.ProductCategoryCreateWithoutProductsInput, Prisma.ProductCategoryUncheckedCreateWithoutProductsInput>
|
||||
connectOrCreate?: Prisma.ProductCategoryCreateOrConnectWithoutProductsInput
|
||||
connect?: Prisma.ProductCategoryWhereUniqueInput
|
||||
}
|
||||
|
||||
export type ProductCategoryUpdateOneWithoutProductInfoNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.ProductCategoryCreateWithoutProductInfoInput, Prisma.ProductCategoryUncheckedCreateWithoutProductInfoInput>
|
||||
connectOrCreate?: Prisma.ProductCategoryCreateOrConnectWithoutProductInfoInput
|
||||
upsert?: Prisma.ProductCategoryUpsertWithoutProductInfoInput
|
||||
export type ProductCategoryUpdateOneWithoutProductsNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.ProductCategoryCreateWithoutProductsInput, Prisma.ProductCategoryUncheckedCreateWithoutProductsInput>
|
||||
connectOrCreate?: Prisma.ProductCategoryCreateOrConnectWithoutProductsInput
|
||||
upsert?: Prisma.ProductCategoryUpsertWithoutProductsInput
|
||||
disconnect?: Prisma.ProductCategoryWhereInput | boolean
|
||||
delete?: Prisma.ProductCategoryWhereInput | boolean
|
||||
connect?: Prisma.ProductCategoryWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.ProductCategoryUpdateToOneWithWhereWithoutProductInfoInput, Prisma.ProductCategoryUpdateWithoutProductInfoInput>, Prisma.ProductCategoryUncheckedUpdateWithoutProductInfoInput>
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.ProductCategoryUpdateToOneWithWhereWithoutProductsInput, Prisma.ProductCategoryUpdateWithoutProductsInput>, Prisma.ProductCategoryUncheckedUpdateWithoutProductsInput>
|
||||
}
|
||||
|
||||
export type ProductCategoryCreateWithoutProductInfoInput = {
|
||||
export type ProductCategoryCreateWithoutProductsInput = {
|
||||
name: string
|
||||
description?: string | null
|
||||
imageUrl?: string | null
|
||||
@@ -434,7 +434,7 @@ export type ProductCategoryCreateWithoutProductInfoInput = {
|
||||
deletedAt?: Date | string | null
|
||||
}
|
||||
|
||||
export type ProductCategoryUncheckedCreateWithoutProductInfoInput = {
|
||||
export type ProductCategoryUncheckedCreateWithoutProductsInput = {
|
||||
id?: number
|
||||
name: string
|
||||
description?: string | null
|
||||
@@ -444,23 +444,23 @@ export type ProductCategoryUncheckedCreateWithoutProductInfoInput = {
|
||||
deletedAt?: Date | string | null
|
||||
}
|
||||
|
||||
export type ProductCategoryCreateOrConnectWithoutProductInfoInput = {
|
||||
export type ProductCategoryCreateOrConnectWithoutProductsInput = {
|
||||
where: Prisma.ProductCategoryWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.ProductCategoryCreateWithoutProductInfoInput, Prisma.ProductCategoryUncheckedCreateWithoutProductInfoInput>
|
||||
create: Prisma.XOR<Prisma.ProductCategoryCreateWithoutProductsInput, Prisma.ProductCategoryUncheckedCreateWithoutProductsInput>
|
||||
}
|
||||
|
||||
export type ProductCategoryUpsertWithoutProductInfoInput = {
|
||||
update: Prisma.XOR<Prisma.ProductCategoryUpdateWithoutProductInfoInput, Prisma.ProductCategoryUncheckedUpdateWithoutProductInfoInput>
|
||||
create: Prisma.XOR<Prisma.ProductCategoryCreateWithoutProductInfoInput, Prisma.ProductCategoryUncheckedCreateWithoutProductInfoInput>
|
||||
export type ProductCategoryUpsertWithoutProductsInput = {
|
||||
update: Prisma.XOR<Prisma.ProductCategoryUpdateWithoutProductsInput, Prisma.ProductCategoryUncheckedUpdateWithoutProductsInput>
|
||||
create: Prisma.XOR<Prisma.ProductCategoryCreateWithoutProductsInput, Prisma.ProductCategoryUncheckedCreateWithoutProductsInput>
|
||||
where?: Prisma.ProductCategoryWhereInput
|
||||
}
|
||||
|
||||
export type ProductCategoryUpdateToOneWithWhereWithoutProductInfoInput = {
|
||||
export type ProductCategoryUpdateToOneWithWhereWithoutProductsInput = {
|
||||
where?: Prisma.ProductCategoryWhereInput
|
||||
data: Prisma.XOR<Prisma.ProductCategoryUpdateWithoutProductInfoInput, Prisma.ProductCategoryUncheckedUpdateWithoutProductInfoInput>
|
||||
data: Prisma.XOR<Prisma.ProductCategoryUpdateWithoutProductsInput, Prisma.ProductCategoryUncheckedUpdateWithoutProductsInput>
|
||||
}
|
||||
|
||||
export type ProductCategoryUpdateWithoutProductInfoInput = {
|
||||
export type ProductCategoryUpdateWithoutProductsInput = {
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
imageUrl?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -469,7 +469,7 @@ export type ProductCategoryUpdateWithoutProductInfoInput = {
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
}
|
||||
|
||||
export type ProductCategoryUncheckedUpdateWithoutProductInfoInput = {
|
||||
export type ProductCategoryUncheckedUpdateWithoutProductsInput = {
|
||||
id?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -485,11 +485,11 @@ export type ProductCategoryUncheckedUpdateWithoutProductInfoInput = {
|
||||
*/
|
||||
|
||||
export type ProductCategoryCountOutputType = {
|
||||
productInfo: number
|
||||
products: number
|
||||
}
|
||||
|
||||
export type ProductCategoryCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
productInfo?: boolean | ProductCategoryCountOutputTypeCountProductInfoArgs
|
||||
products?: boolean | ProductCategoryCountOutputTypeCountProductsArgs
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -505,8 +505,8 @@ export type ProductCategoryCountOutputTypeDefaultArgs<ExtArgs extends runtime.Ty
|
||||
/**
|
||||
* ProductCategoryCountOutputType without action
|
||||
*/
|
||||
export type ProductCategoryCountOutputTypeCountProductInfoArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
where?: Prisma.ProductInfoWhereInput
|
||||
export type ProductCategoryCountOutputTypeCountProductsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
where?: Prisma.ProductWhereInput
|
||||
}
|
||||
|
||||
|
||||
@@ -518,7 +518,7 @@ export type ProductCategorySelect<ExtArgs extends runtime.Types.Extensions.Inter
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
deletedAt?: boolean
|
||||
productInfo?: boolean | Prisma.ProductCategory$productInfoArgs<ExtArgs>
|
||||
products?: boolean | Prisma.ProductCategory$productsArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.ProductCategoryCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["productCategory"]>
|
||||
|
||||
@@ -536,14 +536,14 @@ export type ProductCategorySelectScalar = {
|
||||
|
||||
export type ProductCategoryOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "name" | "description" | "imageUrl" | "createdAt" | "updatedAt" | "deletedAt", ExtArgs["result"]["productCategory"]>
|
||||
export type ProductCategoryInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
productInfo?: boolean | Prisma.ProductCategory$productInfoArgs<ExtArgs>
|
||||
products?: boolean | Prisma.ProductCategory$productsArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.ProductCategoryCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}
|
||||
|
||||
export type $ProductCategoryPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
name: "ProductCategory"
|
||||
objects: {
|
||||
productInfo: Prisma.$ProductInfoPayload<ExtArgs>[]
|
||||
products: Prisma.$ProductPayload<ExtArgs>[]
|
||||
}
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||
id: number
|
||||
@@ -893,7 +893,7 @@ readonly fields: ProductCategoryFieldRefs;
|
||||
*/
|
||||
export interface Prisma__ProductCategoryClient<T, Null = never, ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> extends Prisma.PrismaPromise<T> {
|
||||
readonly [Symbol.toStringTag]: "PrismaPromise"
|
||||
productInfo<T extends Prisma.ProductCategory$productInfoArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.ProductCategory$productInfoArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ProductInfoPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
products<T extends Prisma.ProductCategory$productsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.ProductCategory$productsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ProductPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
@@ -1273,27 +1273,27 @@ export type ProductCategoryDeleteManyArgs<ExtArgs extends runtime.Types.Extensio
|
||||
}
|
||||
|
||||
/**
|
||||
* ProductCategory.productInfo
|
||||
* ProductCategory.products
|
||||
*/
|
||||
export type ProductCategory$productInfoArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
export type ProductCategory$productsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the ProductInfo
|
||||
* Select specific fields to fetch from the Product
|
||||
*/
|
||||
select?: Prisma.ProductInfoSelect<ExtArgs> | null
|
||||
select?: Prisma.ProductSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the ProductInfo
|
||||
* Omit specific fields from the Product
|
||||
*/
|
||||
omit?: Prisma.ProductInfoOmit<ExtArgs> | null
|
||||
omit?: Prisma.ProductOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.ProductInfoInclude<ExtArgs> | null
|
||||
where?: Prisma.ProductInfoWhereInput
|
||||
orderBy?: Prisma.ProductInfoOrderByWithRelationInput | Prisma.ProductInfoOrderByWithRelationInput[]
|
||||
cursor?: Prisma.ProductInfoWhereUniqueInput
|
||||
include?: Prisma.ProductInclude<ExtArgs> | null
|
||||
where?: Prisma.ProductWhereInput
|
||||
orderBy?: Prisma.ProductOrderByWithRelationInput | Prisma.ProductOrderByWithRelationInput[]
|
||||
cursor?: Prisma.ProductWhereUniqueInput
|
||||
take?: number
|
||||
skip?: number
|
||||
distinct?: Prisma.ProductInfoScalarFieldEnum | Prisma.ProductInfoScalarFieldEnum[]
|
||||
distinct?: Prisma.ProductScalarFieldEnum | Prisma.ProductScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -280,7 +280,6 @@ export type SupplierWhereInput = {
|
||||
createdAt?: Prisma.DateTimeNullableFilter<"Supplier"> | Date | string | null
|
||||
updatedAt?: Prisma.DateTimeNullableFilter<"Supplier"> | Date | string | null
|
||||
deletedAt?: Prisma.DateTimeNullableFilter<"Supplier"> | Date | string | null
|
||||
productInfo?: Prisma.ProductInfoListRelationFilter
|
||||
}
|
||||
|
||||
export type SupplierOrderByWithRelationInput = {
|
||||
@@ -297,7 +296,6 @@ export type SupplierOrderByWithRelationInput = {
|
||||
createdAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
productInfo?: Prisma.ProductInfoOrderByRelationAggregateInput
|
||||
_relevance?: Prisma.SupplierOrderByRelevanceInput
|
||||
}
|
||||
|
||||
@@ -318,7 +316,6 @@ export type SupplierWhereUniqueInput = Prisma.AtLeast<{
|
||||
createdAt?: Prisma.DateTimeNullableFilter<"Supplier"> | Date | string | null
|
||||
updatedAt?: Prisma.DateTimeNullableFilter<"Supplier"> | Date | string | null
|
||||
deletedAt?: Prisma.DateTimeNullableFilter<"Supplier"> | Date | string | null
|
||||
productInfo?: Prisma.ProductInfoListRelationFilter
|
||||
}, "id" | "mobileNumber">
|
||||
|
||||
export type SupplierOrderByWithAggregationInput = {
|
||||
@@ -374,7 +371,6 @@ export type SupplierCreateInput = {
|
||||
createdAt?: Date | string | null
|
||||
updatedAt?: Date | string | null
|
||||
deletedAt?: Date | string | null
|
||||
productInfo?: Prisma.ProductInfoCreateNestedManyWithoutSupplierInput
|
||||
}
|
||||
|
||||
export type SupplierUncheckedCreateInput = {
|
||||
@@ -391,7 +387,6 @@ export type SupplierUncheckedCreateInput = {
|
||||
createdAt?: Date | string | null
|
||||
updatedAt?: Date | string | null
|
||||
deletedAt?: Date | string | null
|
||||
productInfo?: Prisma.ProductInfoUncheckedCreateNestedManyWithoutSupplierInput
|
||||
}
|
||||
|
||||
export type SupplierUpdateInput = {
|
||||
@@ -407,7 +402,6 @@ export type SupplierUpdateInput = {
|
||||
createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
productInfo?: Prisma.ProductInfoUpdateManyWithoutSupplierNestedInput
|
||||
}
|
||||
|
||||
export type SupplierUncheckedUpdateInput = {
|
||||
@@ -424,7 +418,6 @@ export type SupplierUncheckedUpdateInput = {
|
||||
createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
productInfo?: Prisma.ProductInfoUncheckedUpdateManyWithoutSupplierNestedInput
|
||||
}
|
||||
|
||||
export type SupplierCreateManyInput = {
|
||||
@@ -474,11 +467,6 @@ export type SupplierUncheckedUpdateManyInput = {
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
}
|
||||
|
||||
export type SupplierScalarRelationFilter = {
|
||||
is?: Prisma.SupplierWhereInput
|
||||
isNot?: Prisma.SupplierWhereInput
|
||||
}
|
||||
|
||||
export type SupplierOrderByRelevanceInput = {
|
||||
fields: Prisma.SupplierOrderByRelevanceFieldEnum | Prisma.SupplierOrderByRelevanceFieldEnum[]
|
||||
sort: Prisma.SortOrder
|
||||
@@ -541,127 +529,6 @@ export type SupplierSumOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type SupplierCreateNestedOneWithoutProductInfoInput = {
|
||||
create?: Prisma.XOR<Prisma.SupplierCreateWithoutProductInfoInput, Prisma.SupplierUncheckedCreateWithoutProductInfoInput>
|
||||
connectOrCreate?: Prisma.SupplierCreateOrConnectWithoutProductInfoInput
|
||||
connect?: Prisma.SupplierWhereUniqueInput
|
||||
}
|
||||
|
||||
export type SupplierUpdateOneRequiredWithoutProductInfoNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.SupplierCreateWithoutProductInfoInput, Prisma.SupplierUncheckedCreateWithoutProductInfoInput>
|
||||
connectOrCreate?: Prisma.SupplierCreateOrConnectWithoutProductInfoInput
|
||||
upsert?: Prisma.SupplierUpsertWithoutProductInfoInput
|
||||
connect?: Prisma.SupplierWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.SupplierUpdateToOneWithWhereWithoutProductInfoInput, Prisma.SupplierUpdateWithoutProductInfoInput>, Prisma.SupplierUncheckedUpdateWithoutProductInfoInput>
|
||||
}
|
||||
|
||||
export type SupplierCreateWithoutProductInfoInput = {
|
||||
firstName: string
|
||||
lastName: string
|
||||
email?: string | null
|
||||
mobileNumber: string
|
||||
address?: string | null
|
||||
city?: string | null
|
||||
state?: string | null
|
||||
country?: string | null
|
||||
isActive?: boolean
|
||||
createdAt?: Date | string | null
|
||||
updatedAt?: Date | string | null
|
||||
deletedAt?: Date | string | null
|
||||
}
|
||||
|
||||
export type SupplierUncheckedCreateWithoutProductInfoInput = {
|
||||
id?: number
|
||||
firstName: string
|
||||
lastName: string
|
||||
email?: string | null
|
||||
mobileNumber: string
|
||||
address?: string | null
|
||||
city?: string | null
|
||||
state?: string | null
|
||||
country?: string | null
|
||||
isActive?: boolean
|
||||
createdAt?: Date | string | null
|
||||
updatedAt?: Date | string | null
|
||||
deletedAt?: Date | string | null
|
||||
}
|
||||
|
||||
export type SupplierCreateOrConnectWithoutProductInfoInput = {
|
||||
where: Prisma.SupplierWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.SupplierCreateWithoutProductInfoInput, Prisma.SupplierUncheckedCreateWithoutProductInfoInput>
|
||||
}
|
||||
|
||||
export type SupplierUpsertWithoutProductInfoInput = {
|
||||
update: Prisma.XOR<Prisma.SupplierUpdateWithoutProductInfoInput, Prisma.SupplierUncheckedUpdateWithoutProductInfoInput>
|
||||
create: Prisma.XOR<Prisma.SupplierCreateWithoutProductInfoInput, Prisma.SupplierUncheckedCreateWithoutProductInfoInput>
|
||||
where?: Prisma.SupplierWhereInput
|
||||
}
|
||||
|
||||
export type SupplierUpdateToOneWithWhereWithoutProductInfoInput = {
|
||||
where?: Prisma.SupplierWhereInput
|
||||
data: Prisma.XOR<Prisma.SupplierUpdateWithoutProductInfoInput, Prisma.SupplierUncheckedUpdateWithoutProductInfoInput>
|
||||
}
|
||||
|
||||
export type SupplierUpdateWithoutProductInfoInput = {
|
||||
firstName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
lastName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
mobileNumber?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
address?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
}
|
||||
|
||||
export type SupplierUncheckedUpdateWithoutProductInfoInput = {
|
||||
id?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
firstName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
lastName?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
mobileNumber?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
address?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
city?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
state?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
country?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Count Type SupplierCountOutputType
|
||||
*/
|
||||
|
||||
export type SupplierCountOutputType = {
|
||||
productInfo: number
|
||||
}
|
||||
|
||||
export type SupplierCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
productInfo?: boolean | SupplierCountOutputTypeCountProductInfoArgs
|
||||
}
|
||||
|
||||
/**
|
||||
* SupplierCountOutputType without action
|
||||
*/
|
||||
export type SupplierCountOutputTypeDefaultArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the SupplierCountOutputType
|
||||
*/
|
||||
select?: Prisma.SupplierCountOutputTypeSelect<ExtArgs> | null
|
||||
}
|
||||
|
||||
/**
|
||||
* SupplierCountOutputType without action
|
||||
*/
|
||||
export type SupplierCountOutputTypeCountProductInfoArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
where?: Prisma.ProductInfoWhereInput
|
||||
}
|
||||
|
||||
|
||||
export type SupplierSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
@@ -678,8 +545,6 @@ export type SupplierSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
deletedAt?: boolean
|
||||
productInfo?: boolean | Prisma.Supplier$productInfoArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.SupplierCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["supplier"]>
|
||||
|
||||
|
||||
@@ -701,16 +566,10 @@ export type SupplierSelectScalar = {
|
||||
}
|
||||
|
||||
export type SupplierOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "firstName" | "lastName" | "email" | "mobileNumber" | "address" | "city" | "state" | "country" | "isActive" | "createdAt" | "updatedAt" | "deletedAt", ExtArgs["result"]["supplier"]>
|
||||
export type SupplierInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
productInfo?: boolean | Prisma.Supplier$productInfoArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.SupplierCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}
|
||||
|
||||
export type $SupplierPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
name: "Supplier"
|
||||
objects: {
|
||||
productInfo: Prisma.$ProductInfoPayload<ExtArgs>[]
|
||||
}
|
||||
objects: {}
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||
id: number
|
||||
firstName: string
|
||||
@@ -1065,7 +924,6 @@ readonly fields: SupplierFieldRefs;
|
||||
*/
|
||||
export interface Prisma__SupplierClient<T, Null = never, ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> extends Prisma.PrismaPromise<T> {
|
||||
readonly [Symbol.toStringTag]: "PrismaPromise"
|
||||
productInfo<T extends Prisma.Supplier$productInfoArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Supplier$productInfoArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ProductInfoPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
@@ -1124,10 +982,6 @@ export type SupplierFindUniqueArgs<ExtArgs extends runtime.Types.Extensions.Inte
|
||||
* Omit specific fields from the Supplier
|
||||
*/
|
||||
omit?: Prisma.SupplierOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.SupplierInclude<ExtArgs> | null
|
||||
/**
|
||||
* Filter, which Supplier to fetch.
|
||||
*/
|
||||
@@ -1146,10 +1000,6 @@ export type SupplierFindUniqueOrThrowArgs<ExtArgs extends runtime.Types.Extensio
|
||||
* Omit specific fields from the Supplier
|
||||
*/
|
||||
omit?: Prisma.SupplierOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.SupplierInclude<ExtArgs> | null
|
||||
/**
|
||||
* Filter, which Supplier to fetch.
|
||||
*/
|
||||
@@ -1168,10 +1018,6 @@ export type SupplierFindFirstArgs<ExtArgs extends runtime.Types.Extensions.Inter
|
||||
* Omit specific fields from the Supplier
|
||||
*/
|
||||
omit?: Prisma.SupplierOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.SupplierInclude<ExtArgs> | null
|
||||
/**
|
||||
* Filter, which Supplier to fetch.
|
||||
*/
|
||||
@@ -1220,10 +1066,6 @@ export type SupplierFindFirstOrThrowArgs<ExtArgs extends runtime.Types.Extension
|
||||
* Omit specific fields from the Supplier
|
||||
*/
|
||||
omit?: Prisma.SupplierOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.SupplierInclude<ExtArgs> | null
|
||||
/**
|
||||
* Filter, which Supplier to fetch.
|
||||
*/
|
||||
@@ -1272,10 +1114,6 @@ export type SupplierFindManyArgs<ExtArgs extends runtime.Types.Extensions.Intern
|
||||
* Omit specific fields from the Supplier
|
||||
*/
|
||||
omit?: Prisma.SupplierOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.SupplierInclude<ExtArgs> | null
|
||||
/**
|
||||
* Filter, which Suppliers to fetch.
|
||||
*/
|
||||
@@ -1319,10 +1157,6 @@ export type SupplierCreateArgs<ExtArgs extends runtime.Types.Extensions.Internal
|
||||
* Omit specific fields from the Supplier
|
||||
*/
|
||||
omit?: Prisma.SupplierOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.SupplierInclude<ExtArgs> | null
|
||||
/**
|
||||
* The data needed to create a Supplier.
|
||||
*/
|
||||
@@ -1352,10 +1186,6 @@ export type SupplierUpdateArgs<ExtArgs extends runtime.Types.Extensions.Internal
|
||||
* Omit specific fields from the Supplier
|
||||
*/
|
||||
omit?: Prisma.SupplierOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.SupplierInclude<ExtArgs> | null
|
||||
/**
|
||||
* The data needed to update a Supplier.
|
||||
*/
|
||||
@@ -1396,10 +1226,6 @@ export type SupplierUpsertArgs<ExtArgs extends runtime.Types.Extensions.Internal
|
||||
* Omit specific fields from the Supplier
|
||||
*/
|
||||
omit?: Prisma.SupplierOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.SupplierInclude<ExtArgs> | null
|
||||
/**
|
||||
* The filter to search for the Supplier to update in case it exists.
|
||||
*/
|
||||
@@ -1426,10 +1252,6 @@ export type SupplierDeleteArgs<ExtArgs extends runtime.Types.Extensions.Internal
|
||||
* Omit specific fields from the Supplier
|
||||
*/
|
||||
omit?: Prisma.SupplierOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.SupplierInclude<ExtArgs> | null
|
||||
/**
|
||||
* Filter which Supplier to delete.
|
||||
*/
|
||||
@@ -1450,30 +1272,6 @@ export type SupplierDeleteManyArgs<ExtArgs extends runtime.Types.Extensions.Inte
|
||||
limit?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Supplier.productInfo
|
||||
*/
|
||||
export type Supplier$productInfoArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the ProductInfo
|
||||
*/
|
||||
select?: Prisma.ProductInfoSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the ProductInfo
|
||||
*/
|
||||
omit?: Prisma.ProductInfoOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.ProductInfoInclude<ExtArgs> | null
|
||||
where?: Prisma.ProductInfoWhereInput
|
||||
orderBy?: Prisma.ProductInfoOrderByWithRelationInput | Prisma.ProductInfoOrderByWithRelationInput[]
|
||||
cursor?: Prisma.ProductInfoWhereUniqueInput
|
||||
take?: number
|
||||
skip?: number
|
||||
distinct?: Prisma.ProductInfoScalarFieldEnum | Prisma.ProductInfoScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Supplier without action
|
||||
*/
|
||||
@@ -1486,8 +1284,4 @@ export type SupplierDefaultArgs<ExtArgs extends runtime.Types.Extensions.Interna
|
||||
* Omit specific fields from the Supplier
|
||||
*/
|
||||
omit?: Prisma.SupplierOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.SupplierInclude<ExtArgs> | null
|
||||
}
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import { IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class CreateInventoryDto {
|
||||
@IsString()
|
||||
name: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
location?: string
|
||||
}
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
import { Type } from 'class-transformer'
|
||||
import { IsBoolean, IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class UpdateInventoryDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
name?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
location?: string
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Boolean)
|
||||
@IsBoolean()
|
||||
isActive?: boolean
|
||||
}
|
||||
|
||||
@@ -1,27 +1,33 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from '../common/response/response-mapper'
|
||||
import { PrismaService } from '../prisma/prisma.service'
|
||||
|
||||
@Injectable()
|
||||
export class InventoriesService {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
|
||||
create(data: any) {
|
||||
return this.prisma.inventory.create({ data })
|
||||
async create(data: any) {
|
||||
const item = await this.prisma.inventory.create({ data })
|
||||
return ResponseMapper.create(item)
|
||||
}
|
||||
|
||||
findAll() {
|
||||
return this.prisma.inventory.findMany()
|
||||
async findAll() {
|
||||
const items = await this.prisma.inventory.findMany()
|
||||
return ResponseMapper.list(items)
|
||||
}
|
||||
|
||||
findOne(id: number) {
|
||||
return this.prisma.inventory.findUnique({ where: { id } })
|
||||
async findOne(id: number) {
|
||||
const item = await this.prisma.inventory.findUnique({ where: { id } })
|
||||
if (!item) return null
|
||||
return ResponseMapper.single(item)
|
||||
}
|
||||
|
||||
update(id: number, data: any) {
|
||||
return this.prisma.inventory.update({ where: { id }, data })
|
||||
async update(id: number, data: any) {
|
||||
const item = await this.prisma.inventory.update({ where: { id }, data })
|
||||
return ResponseMapper.update(item)
|
||||
}
|
||||
|
||||
remove(id: number) {
|
||||
return this.prisma.inventory.delete({ where: { id } })
|
||||
async remove(id: number) {
|
||||
const item = await this.prisma.inventory.delete({ where: { id } })
|
||||
return ResponseMapper.single(item)
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -1,17 +1,17 @@
|
||||
import { PrismaMariaDb } from '@prisma/adapter-mariadb'
|
||||
// import 'dotenv/config'
|
||||
import 'dotenv/config'
|
||||
import { env } from 'prisma/config'
|
||||
|
||||
import { PrismaClient } from '../generated/prisma/client'
|
||||
|
||||
console.log('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@')
|
||||
console.log(process.env.DATABASE_HOST)
|
||||
|
||||
const adapter = new PrismaMariaDb({
|
||||
host: process.env.DATABASE_HOST,
|
||||
user: process.env.DATABASE_USER,
|
||||
password: process.env.DATABASE_PASSWORD,
|
||||
database: process.env.DATABASE_NAME,
|
||||
host: env('DATABASE_HOST'),
|
||||
user: env('DATABASE_USER'),
|
||||
password: env('DATABASE_PASSWORD'),
|
||||
database: env('DATABASE_NAME'),
|
||||
connectionLimit: 5,
|
||||
})
|
||||
|
||||
const prisma = new PrismaClient({ adapter })
|
||||
|
||||
export { prisma }
|
||||
|
||||
+8
-1
@@ -1,7 +1,8 @@
|
||||
import { VersioningType } from '@nestjs/common'
|
||||
import { ValidationPipe, VersioningType } from '@nestjs/common'
|
||||
import { NestFactory } from '@nestjs/core'
|
||||
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'
|
||||
import { AppModule } from './app.module'
|
||||
import { PrismaExceptionFilter } from './common/filters/prisma-exception.filter'
|
||||
import { LoggingInterceptor } from './common/interceptors/logging.interceptor'
|
||||
import { ResponseMappingInterceptor } from './common/interceptors/response-mapping.interceptor'
|
||||
|
||||
@@ -43,6 +44,12 @@ async function bootstrap() {
|
||||
// Register global logging and response mapping interceptors
|
||||
app.useGlobalInterceptors(new LoggingInterceptor(), new ResponseMappingInterceptor())
|
||||
|
||||
// Enable request validation and transformation globally
|
||||
app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true }))
|
||||
|
||||
// Register global exception filter to map Prisma and validation errors to proper HTTP codes
|
||||
app.useGlobalFilters(new PrismaExceptionFilter())
|
||||
|
||||
await app.listen(process.env.PORT ?? 3000)
|
||||
}
|
||||
bootstrap()
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
import { IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class CreateProductBrandDto {
|
||||
@IsString()
|
||||
name: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
imageUrl?: string
|
||||
}
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
import { IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class UpdateProductBrandDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
name?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
imageUrl?: string
|
||||
}
|
||||
|
||||
@@ -1,27 +1,33 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from '../common/response/response-mapper'
|
||||
import { PrismaService } from '../prisma/prisma.service'
|
||||
|
||||
@Injectable()
|
||||
export class ProductBrandsService {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
|
||||
create(data: any) {
|
||||
return this.prisma.productBrand.create({ data })
|
||||
async create(data: any) {
|
||||
const item = await this.prisma.productBrand.create({ data })
|
||||
return ResponseMapper.create(item)
|
||||
}
|
||||
|
||||
findAll() {
|
||||
return this.prisma.productBrand.findMany()
|
||||
async findAll() {
|
||||
const items = await this.prisma.productBrand.findMany()
|
||||
return ResponseMapper.list(items)
|
||||
}
|
||||
|
||||
findOne(id: number) {
|
||||
return this.prisma.productBrand.findUnique({ where: { id } })
|
||||
async findOne(id: number) {
|
||||
const item = await this.prisma.productBrand.findUnique({ where: { id } })
|
||||
if (!item) return null
|
||||
return ResponseMapper.single(item)
|
||||
}
|
||||
|
||||
update(id: number, data: any) {
|
||||
return this.prisma.productBrand.update({ where: { id }, data })
|
||||
async update(id: number, data: any) {
|
||||
const item = await this.prisma.productBrand.update({ where: { id }, data })
|
||||
return ResponseMapper.update(item)
|
||||
}
|
||||
|
||||
remove(id: number) {
|
||||
return this.prisma.productBrand.delete({ where: { id } })
|
||||
async remove(id: number) {
|
||||
const item = await this.prisma.productBrand.delete({ where: { id } })
|
||||
return ResponseMapper.single(item)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
import { IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class CreateProductCategoryDto {
|
||||
@IsString()
|
||||
name: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
imageUrl?: string
|
||||
}
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
import { IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class UpdateProductCategoryDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
name?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
imageUrl?: string
|
||||
}
|
||||
|
||||
@@ -1,27 +1,33 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from '../common/response/response-mapper'
|
||||
import { PrismaService } from '../prisma/prisma.service'
|
||||
|
||||
@Injectable()
|
||||
export class ProductCategoriesService {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
|
||||
create(data: any) {
|
||||
return this.prisma.productCategory.create({ data })
|
||||
async create(data: any) {
|
||||
const item = await this.prisma.productCategory.create({ data })
|
||||
return ResponseMapper.create(item)
|
||||
}
|
||||
|
||||
findAll() {
|
||||
return this.prisma.productCategory.findMany()
|
||||
async findAll() {
|
||||
const items = await this.prisma.productCategory.findMany()
|
||||
return ResponseMapper.list(items)
|
||||
}
|
||||
|
||||
findOne(id: number) {
|
||||
return this.prisma.productCategory.findUnique({ where: { id } })
|
||||
async findOne(id: number) {
|
||||
const item = await this.prisma.productCategory.findUnique({ where: { id } })
|
||||
if (!item) return null
|
||||
return ResponseMapper.single(item)
|
||||
}
|
||||
|
||||
update(id: number, data: any) {
|
||||
return this.prisma.productCategory.update({ where: { id }, data })
|
||||
async update(id: number, data: any) {
|
||||
const item = await this.prisma.productCategory.update({ where: { id }, data })
|
||||
return ResponseMapper.update(item)
|
||||
}
|
||||
|
||||
remove(id: number) {
|
||||
return this.prisma.productCategory.delete({ where: { id } })
|
||||
async remove(id: number) {
|
||||
const item = await this.prisma.productCategory.delete({ where: { id } })
|
||||
return ResponseMapper.single(item)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
export class CreateProductInfoDto {
|
||||
name: string
|
||||
description?: string
|
||||
productType?: string
|
||||
metaData?: any
|
||||
brandId?: number
|
||||
categoryId?: number
|
||||
vendorId: number
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
export class UpdateProductInfoDto {
|
||||
name?: string
|
||||
description?: string
|
||||
productType?: string
|
||||
metaData?: any
|
||||
brandId?: number
|
||||
categoryId?: number
|
||||
vendorId?: number
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common'
|
||||
import { CreateProductInfoDto } from './dto/create-product-info.dto'
|
||||
import { UpdateProductInfoDto } from './dto/update-product-info.dto'
|
||||
import { ProductInfoService } from './product-info.service'
|
||||
|
||||
@Controller('product-info')
|
||||
export class ProductInfoController {
|
||||
constructor(private readonly productInfoService: ProductInfoService) {}
|
||||
|
||||
@Post()
|
||||
create(@Body() dto: CreateProductInfoDto) {
|
||||
return this.productInfoService.create(dto)
|
||||
}
|
||||
|
||||
@Get()
|
||||
findAll() {
|
||||
return this.productInfoService.findAll()
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
findOne(@Param('id') id: string) {
|
||||
return this.productInfoService.findOne(Number(id))
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
update(@Param('id') id: string, @Body() dto: UpdateProductInfoDto) {
|
||||
return this.productInfoService.update(Number(id), dto)
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
remove(@Param('id') id: string) {
|
||||
return this.productInfoService.remove(Number(id))
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import { Module } from '@nestjs/common'
|
||||
import { PrismaModule } from '../prisma/prisma.module'
|
||||
import { ProductInfoController } from './product-info.controller'
|
||||
import { ProductInfoService } from './product-info.service'
|
||||
|
||||
@Module({
|
||||
imports: [PrismaModule],
|
||||
controllers: [ProductInfoController],
|
||||
providers: [ProductInfoService],
|
||||
})
|
||||
export class ProductInfoModule {}
|
||||
@@ -1,27 +0,0 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { PrismaService } from '../prisma/prisma.service'
|
||||
|
||||
@Injectable()
|
||||
export class ProductInfoService {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
|
||||
create(data: any) {
|
||||
return this.prisma.productInfo.create({ data })
|
||||
}
|
||||
|
||||
findAll() {
|
||||
return this.prisma.productInfo.findMany()
|
||||
}
|
||||
|
||||
findOne(id: number) {
|
||||
return this.prisma.productInfo.findUnique({ where: { id } })
|
||||
}
|
||||
|
||||
update(id: number, data: any) {
|
||||
return this.prisma.productInfo.update({ where: { id }, data })
|
||||
}
|
||||
|
||||
remove(id: number) {
|
||||
return this.prisma.productInfo.delete({ where: { id } })
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import { Type } from 'class-transformer'
|
||||
import { IsBoolean, IsInt, IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class CreateProductVariantDto {
|
||||
@IsString()
|
||||
name: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
sku?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
barcode?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
imageUrl?: string
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
attachmentId?: number
|
||||
|
||||
@IsString()
|
||||
unit: string
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
alertQuantity?: number
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Boolean)
|
||||
@IsBoolean()
|
||||
isActive?: boolean
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Boolean)
|
||||
@IsBoolean()
|
||||
isFeatured?: boolean
|
||||
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
productId: number
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import { Type } from 'class-transformer'
|
||||
import { IsBoolean, IsInt, IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class UpdateProductVariantDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
name?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
sku?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
barcode?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
imageUrl?: string
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
attachmentId?: number
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
unit?: string
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
discount?: number
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
quantity?: number
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
alertQuantity?: number
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Boolean)
|
||||
@IsBoolean()
|
||||
isActive?: boolean
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Boolean)
|
||||
@IsBoolean()
|
||||
isFeatured?: boolean
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
productId?: number
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common'
|
||||
import { CreateProductVariantDto } from './dto/create-product-variant.dto'
|
||||
import { UpdateProductVariantDto } from './dto/update-product-variant.dto'
|
||||
import { ProductVariantsService } from './product-variants.service'
|
||||
|
||||
@Controller('product-variants')
|
||||
export class ProductVariantsController {
|
||||
constructor(private readonly productVariantsService: ProductVariantsService) {}
|
||||
|
||||
@Post()
|
||||
create(@Body() dto: CreateProductVariantDto) {
|
||||
return this.productVariantsService.create(dto)
|
||||
}
|
||||
|
||||
@Get()
|
||||
findAll() {
|
||||
return this.productVariantsService.findAll()
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
findOne(@Param('id') id: string) {
|
||||
return this.productVariantsService.findOne(Number(id))
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
update(@Param('id') id: string, @Body() dto: UpdateProductVariantDto) {
|
||||
return this.productVariantsService.update(Number(id), dto)
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
remove(@Param('id') id: string) {
|
||||
return this.productVariantsService.remove(Number(id))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { Module } from '@nestjs/common'
|
||||
import { PrismaModule } from '../prisma/prisma.module'
|
||||
import { ProductVariantsController } from './product-variants.controller'
|
||||
import { ProductVariantsService } from './product-variants.service'
|
||||
|
||||
@Module({
|
||||
imports: [PrismaModule],
|
||||
controllers: [ProductVariantsController],
|
||||
providers: [ProductVariantsService],
|
||||
})
|
||||
export class ProductVariantsModule {}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from '../common/response/response-mapper'
|
||||
import { PrismaService } from '../prisma/prisma.service'
|
||||
|
||||
@Injectable()
|
||||
export class ProductVariantsService {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
async create(data: any) {
|
||||
const item = await this.prisma.productVariant.create({ data })
|
||||
return ResponseMapper.create(item)
|
||||
}
|
||||
|
||||
async findAll() {
|
||||
const items = await this.prisma.productVariant.findMany({
|
||||
include: { product: true },
|
||||
})
|
||||
const mapped = items.map(p => {
|
||||
const { productId, ...rest } = p as any
|
||||
return { ...rest, product: p.product }
|
||||
})
|
||||
return ResponseMapper.list(mapped)
|
||||
}
|
||||
|
||||
async findOne(id: number) {
|
||||
const p = await this.prisma.productVariant.findUnique({
|
||||
where: { id },
|
||||
include: { product: true },
|
||||
})
|
||||
if (!p) return null
|
||||
const { productId, ...rest } = p as any
|
||||
return ResponseMapper.single({ ...rest, product: p.product })
|
||||
}
|
||||
|
||||
async update(id: number, data: any) {
|
||||
const item = await this.prisma.productVariant.update({ where: { id }, data })
|
||||
return ResponseMapper.update(item)
|
||||
}
|
||||
|
||||
async remove(id: number) {
|
||||
const item = await this.prisma.productVariant.delete({ where: { id } })
|
||||
return ResponseMapper.single(item)
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,29 @@
|
||||
import { Type } from 'class-transformer'
|
||||
import { IsInt, IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class CreateProductDto {
|
||||
@IsString()
|
||||
name: string
|
||||
description?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
sku?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
barcode?: string
|
||||
imageUrl?: string
|
||||
attachmentId?: number
|
||||
unit: string
|
||||
discount?: number
|
||||
quantity?: number
|
||||
alertQuantity?: number
|
||||
isActive?: boolean
|
||||
isFeatured?: boolean
|
||||
productInfoId: number
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
brandId?: number
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
categoryId?: number
|
||||
}
|
||||
|
||||
@@ -1,15 +1,30 @@
|
||||
import { Type } from 'class-transformer'
|
||||
import { IsInt, IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class UpdateProductDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
name?: string
|
||||
description?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
sku?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
barcode?: string
|
||||
imageUrl?: string
|
||||
attachmentId?: number
|
||||
unit?: string
|
||||
discount?: number
|
||||
quantity?: number
|
||||
alertQuantity?: number
|
||||
isActive?: boolean
|
||||
isFeatured?: boolean
|
||||
productInfoId?: number
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
brandId?: number
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
categoryId?: number
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ export class ProductsController {
|
||||
|
||||
@Post()
|
||||
create(@Body() dto: CreateProductDto) {
|
||||
console.log('[ProductController] create called', dto)
|
||||
return this.productsService.create(dto)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +1,86 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from '../common/response/response-mapper'
|
||||
import { PrismaService } from '../prisma/prisma.service'
|
||||
import { CreateProductDto } from './dto/create-product.dto'
|
||||
|
||||
@Injectable()
|
||||
export class ProductsService {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
|
||||
create(data: any) {
|
||||
return this.prisma.product.create({ data })
|
||||
async create(data: CreateProductDto) {
|
||||
console.log(data)
|
||||
|
||||
// Transform incoming DTO so relation ids are passed as `connect` objects
|
||||
const payload: any = { ...data }
|
||||
// If the client supplied brandId/categoryId (even null), remove the scalar
|
||||
// Prisma expects nested relation objects, so only add `connect` when an id is present.
|
||||
if (Object.prototype.hasOwnProperty.call(payload, 'brandId')) {
|
||||
if (payload.brandId !== undefined && payload.brandId !== null) {
|
||||
payload.brand = { connect: { id: Number(payload.brandId) } }
|
||||
}
|
||||
delete payload.brandId
|
||||
}
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(payload, 'categoryId')) {
|
||||
if (payload.categoryId !== undefined && payload.categoryId !== null) {
|
||||
payload.category = { connect: { id: Number(payload.categoryId) } }
|
||||
}
|
||||
delete payload.categoryId
|
||||
}
|
||||
|
||||
const item = await this.prisma.product.create({ data: payload })
|
||||
return ResponseMapper.create(item)
|
||||
}
|
||||
|
||||
findAll() {
|
||||
return this.prisma.product.findMany()
|
||||
async findAll() {
|
||||
const items = await this.prisma.product.findMany({
|
||||
include: { brand: true, category: true },
|
||||
})
|
||||
const mapped = items.map(p => {
|
||||
const { brandId, categoryId, ...rest } = p as any
|
||||
return { ...rest, brand: p.brand, category: p.category }
|
||||
})
|
||||
return ResponseMapper.list(mapped)
|
||||
}
|
||||
|
||||
findOne(id: number) {
|
||||
return this.prisma.product.findUnique({ where: { id } })
|
||||
async findOne(id: number) {
|
||||
const p = await this.prisma.product.findUnique({
|
||||
where: { id },
|
||||
include: { brand: true, category: true },
|
||||
})
|
||||
if (!p) return null
|
||||
|
||||
console.log('first')
|
||||
|
||||
const { brandId, categoryId, ...rest } = p as any
|
||||
return ResponseMapper.single({ ...rest, brand: p.brand, category: p.category })
|
||||
}
|
||||
|
||||
update(id: number, data: any) {
|
||||
return this.prisma.product.update({ where: { id }, data })
|
||||
async update(id: number, data: any) {
|
||||
const payload: any = { ...data }
|
||||
if (Object.prototype.hasOwnProperty.call(payload, 'brandId')) {
|
||||
if (payload.brandId === null) {
|
||||
payload.brand = { disconnect: true }
|
||||
} else {
|
||||
payload.brand = { connect: { id: Number(payload.brandId) } }
|
||||
}
|
||||
delete payload.brandId
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(payload, 'categoryId')) {
|
||||
if (payload.categoryId === null) {
|
||||
payload.category = { disconnect: true }
|
||||
} else {
|
||||
payload.category = { connect: { id: Number(payload.categoryId) } }
|
||||
}
|
||||
delete payload.categoryId
|
||||
}
|
||||
|
||||
const item = await this.prisma.product.update({ where: { id }, data: payload })
|
||||
return ResponseMapper.update(item)
|
||||
}
|
||||
|
||||
remove(id: number) {
|
||||
return this.prisma.product.delete({ where: { id } })
|
||||
async remove(id: number) {
|
||||
const item = await this.prisma.product.delete({ where: { id } })
|
||||
return ResponseMapper.single(item)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
import { IsObject, IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class CreateRoleDto {
|
||||
@IsString()
|
||||
name: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
permissions?: any
|
||||
}
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
import { IsObject, IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class UpdateRoleDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
name?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
permissions?: any
|
||||
}
|
||||
|
||||
+17
-11
@@ -1,27 +1,33 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from '../common/response/response-mapper'
|
||||
import { PrismaService } from '../prisma/prisma.service'
|
||||
|
||||
@Injectable()
|
||||
export class RolesService {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
|
||||
create(data: any) {
|
||||
return this.prisma.role.create({ data })
|
||||
async create(data: any) {
|
||||
const item = await this.prisma.role.create({ data })
|
||||
return ResponseMapper.create(item)
|
||||
}
|
||||
|
||||
findAll() {
|
||||
return this.prisma.role.findMany()
|
||||
async findAll() {
|
||||
const items = await this.prisma.role.findMany()
|
||||
return ResponseMapper.list(items)
|
||||
}
|
||||
|
||||
findOne(id: number) {
|
||||
return this.prisma.role.findUnique({ where: { id } })
|
||||
async findOne(id: number) {
|
||||
const item = await this.prisma.role.findUnique({ where: { id } })
|
||||
if (!item) return null
|
||||
return ResponseMapper.single(item)
|
||||
}
|
||||
|
||||
update(id: number, data: any) {
|
||||
return this.prisma.role.update({ where: { id }, data })
|
||||
async update(id: number, data: any) {
|
||||
const item = await this.prisma.role.update({ where: { id }, data })
|
||||
return ResponseMapper.update(item)
|
||||
}
|
||||
|
||||
remove(id: number) {
|
||||
return this.prisma.role.delete({ where: { id } })
|
||||
async remove(id: number) {
|
||||
const item = await this.prisma.role.delete({ where: { id } })
|
||||
return ResponseMapper.single(item)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import { IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class CreateStoreDto {
|
||||
@IsString()
|
||||
name: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
location?: string
|
||||
}
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
import { Type } from 'class-transformer'
|
||||
import { IsBoolean, IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class UpdateStoreDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
name?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
location?: string
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Boolean)
|
||||
@IsBoolean()
|
||||
isActive?: boolean
|
||||
}
|
||||
|
||||
@@ -1,27 +1,33 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from '../common/response/response-mapper'
|
||||
import { PrismaService } from '../prisma/prisma.service'
|
||||
|
||||
@Injectable()
|
||||
export class StoresService {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
|
||||
create(data: any) {
|
||||
return this.prisma.store.create({ data })
|
||||
async create(data: any) {
|
||||
const item = await this.prisma.store.create({ data })
|
||||
return ResponseMapper.create(item)
|
||||
}
|
||||
|
||||
findAll() {
|
||||
return this.prisma.store.findMany()
|
||||
async findAll() {
|
||||
const items = await this.prisma.store.findMany()
|
||||
return ResponseMapper.list(items)
|
||||
}
|
||||
|
||||
findOne(id: number) {
|
||||
return this.prisma.store.findUnique({ where: { id } })
|
||||
async findOne(id: number) {
|
||||
const item = await this.prisma.store.findUnique({ where: { id } })
|
||||
if (!item) return null
|
||||
return ResponseMapper.single(item)
|
||||
}
|
||||
|
||||
update(id: number, data: any) {
|
||||
return this.prisma.store.update({ where: { id }, data })
|
||||
async update(id: number, data: any) {
|
||||
const item = await this.prisma.store.update({ where: { id }, data })
|
||||
return ResponseMapper.update(item)
|
||||
}
|
||||
|
||||
remove(id: number) {
|
||||
return this.prisma.store.delete({ where: { id } })
|
||||
async remove(id: number) {
|
||||
const item = await this.prisma.store.delete({ where: { id } })
|
||||
return ResponseMapper.single(item)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,33 @@
|
||||
import { IsEmail, IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class CreateSupplierDto {
|
||||
@IsString()
|
||||
firstName: string
|
||||
|
||||
@IsString()
|
||||
lastName: string
|
||||
|
||||
@IsOptional()
|
||||
@IsEmail()
|
||||
email?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
mobileNumber?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
address?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
city?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
state?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
country?: string
|
||||
}
|
||||
|
||||
@@ -1,11 +1,41 @@
|
||||
import { Type } from 'class-transformer'
|
||||
import { IsBoolean, IsEmail, IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class UpdateSupplierDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
firstName?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
lastName?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsEmail()
|
||||
email?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
mobileNumber?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
address?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
city?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
state?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
country?: string
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Boolean)
|
||||
@IsBoolean()
|
||||
isActive?: boolean
|
||||
}
|
||||
|
||||
@@ -1,27 +1,33 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from '../common/response/response-mapper'
|
||||
import { PrismaService } from '../prisma/prisma.service'
|
||||
|
||||
@Injectable()
|
||||
export class SuppliersService {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
|
||||
create(data: any) {
|
||||
return this.prisma.supplier.create({ data })
|
||||
async create(data: any) {
|
||||
const item = await this.prisma.supplier.create({ data })
|
||||
return ResponseMapper.create(item)
|
||||
}
|
||||
|
||||
findAll() {
|
||||
return this.prisma.supplier.findMany()
|
||||
async findAll() {
|
||||
const items = await this.prisma.supplier.findMany()
|
||||
return ResponseMapper.list(items)
|
||||
}
|
||||
|
||||
findOne(id: number) {
|
||||
return this.prisma.supplier.findUnique({ where: { id } })
|
||||
async findOne(id: number) {
|
||||
const item = await this.prisma.supplier.findUnique({ where: { id } })
|
||||
if (!item) return null
|
||||
return ResponseMapper.single(item)
|
||||
}
|
||||
|
||||
update(id: number, data: any) {
|
||||
return this.prisma.supplier.update({ where: { id }, data })
|
||||
async update(id: number, data: any) {
|
||||
const item = await this.prisma.supplier.update({ where: { id }, data })
|
||||
return ResponseMapper.update(item)
|
||||
}
|
||||
|
||||
remove(id: number) {
|
||||
return this.prisma.supplier.delete({ where: { id } })
|
||||
async remove(id: number) {
|
||||
const item = await this.prisma.supplier.delete({ where: { id } })
|
||||
return ResponseMapper.single(item)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,20 @@
|
||||
import { Type } from 'class-transformer'
|
||||
import { IsInt, IsString } from 'class-validator'
|
||||
|
||||
export class CreateUserDto {
|
||||
@IsString()
|
||||
mobileNumber: string
|
||||
|
||||
@IsString()
|
||||
password: string
|
||||
|
||||
@IsString()
|
||||
firstName: string
|
||||
|
||||
@IsString()
|
||||
lastName: string
|
||||
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
roleId: number
|
||||
}
|
||||
|
||||
@@ -1,8 +1,30 @@
|
||||
import { Type } from 'class-transformer'
|
||||
import { IsBoolean, IsInt, IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class UpdateUserDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
mobileNumber?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
password?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
firstName?: string
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
lastName?: string
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
roleId?: number
|
||||
|
||||
@IsOptional()
|
||||
@Type(() => Boolean)
|
||||
@IsBoolean()
|
||||
isActive?: boolean
|
||||
}
|
||||
|
||||
+25
-11
@@ -1,27 +1,41 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from '../common/response/response-mapper'
|
||||
import { PrismaService } from '../prisma/prisma.service'
|
||||
|
||||
@Injectable()
|
||||
export class UsersService {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
|
||||
create(data: any) {
|
||||
return this.prisma.user.create({ data })
|
||||
async create(data: any) {
|
||||
const item = await this.prisma.user.create({ data })
|
||||
return ResponseMapper.create(item)
|
||||
}
|
||||
|
||||
findAll() {
|
||||
return this.prisma.user.findMany()
|
||||
async findAll() {
|
||||
const users = await this.prisma.user.findMany({ include: { role: true } })
|
||||
const mapped = users.map(u => {
|
||||
const { roleId, ...rest } = u as any
|
||||
return { ...rest, role: u.role }
|
||||
})
|
||||
return ResponseMapper.list(mapped)
|
||||
}
|
||||
|
||||
findOne(id: number) {
|
||||
return this.prisma.user.findUnique({ where: { id } })
|
||||
async findOne(id: number) {
|
||||
const user = await this.prisma.user.findUnique({
|
||||
where: { id },
|
||||
include: { role: true },
|
||||
})
|
||||
if (!user) return null
|
||||
const { roleId, ...rest } = user as any
|
||||
return ResponseMapper.single({ ...rest, role: user.role })
|
||||
}
|
||||
|
||||
update(id: number, data: any) {
|
||||
return this.prisma.user.update({ where: { id }, data })
|
||||
async update(id: number, data: any) {
|
||||
const item = await this.prisma.user.update({ where: { id }, data })
|
||||
return ResponseMapper.update(item)
|
||||
}
|
||||
|
||||
remove(id: number) {
|
||||
return this.prisma.user.delete({ where: { id } })
|
||||
async remove(id: number) {
|
||||
const item = await this.prisma.user.delete({ where: { id } })
|
||||
return ResponseMapper.single(item)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user