diff --git a/package.json b/package.json index 8663c73..36f315c 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0c2334b..0d5f5e2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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: diff --git a/prisma.config.js b/prisma.config.js deleted file mode 100644 index 18b38c2..0000000 --- a/prisma.config.js +++ /dev/null @@ -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"), - }, -}); diff --git a/prisma.config.ts b/prisma.config.ts index 9c5e959..2980f15 100644 --- a/prisma.config.ts +++ b/prisma.config.ts @@ -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'), }, -}); +}) diff --git a/prisma/migrations/20251206102502_init/migration.sql b/prisma/migrations/20251206102502_init/migration.sql new file mode 100644 index 0000000..032a632 --- /dev/null +++ b/prisma/migrations/20251206102502_init/migration.sql @@ -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; diff --git a/prisma/migrations/20251206102601_init/migration.sql b/prisma/migrations/20251206102601_init/migration.sql new file mode 100644 index 0000000..4b1c315 --- /dev/null +++ b/prisma/migrations/20251206102601_init/migration.sql @@ -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`; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index e137df2..de193e4 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -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") } diff --git a/prisma/seed.ts b/prisma/seed.ts new file mode 100644 index 0000000..a53829e --- /dev/null +++ b/prisma/seed.ts @@ -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) + }) diff --git a/scripts/generate-permissions.ts b/scripts/generate-permissions.ts new file mode 100644 index 0000000..1b729e1 --- /dev/null +++ b/scripts/generate-permissions.ts @@ -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 = {} + 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 = (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) +}) diff --git a/src/app.module.ts b/src/app.module.ts index f61849f..5b4bd71 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -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, diff --git a/src/common/filters/prisma-exception.filter.ts b/src/common/filters/prisma-exception.filter.ts new file mode 100644 index 0000000..ab2f810 --- /dev/null +++ b/src/common/filters/prisma-exception.filter.ts @@ -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() + const request = ctx.getRequest() + 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) + } +} diff --git a/src/common/interceptors/response-mapping.interceptor.ts b/src/common/interceptors/response-mapping.interceptor.ts index 4844e6a..134dbe2 100644 --- a/src/common/interceptors/response-mapping.interceptor.ts +++ b/src/common/interceptors/response-mapping.interceptor.ts @@ -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 }), ) } diff --git a/src/common/response/response-mapper.ts b/src/common/response/response-mapper.ts new file mode 100644 index 0000000..0519fdd --- /dev/null +++ b/src/common/response/response-mapper.ts @@ -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 = + | { __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(item: T): MapperWrapper { + return { __mapped: 'create', data: item } + }, + + update(item: T): MapperWrapper { + return { __mapped: 'update', data: item } + }, + + single(item: T): MapperWrapper { + return { __mapped: 'single', data: item } + }, + + list(items: T[]): MapperWrapper { + return { __mapped: 'list', items } + }, + + paginate(items: T[], total: number, page = 1, perPage = items.length) { + return { __mapped: 'paginate', items, total, page, perPage } + }, + + sequelizePaginate(rows: T[], count: number, page = 1, perPage = rows.length) { + return { __mapped: 'sequelize', rows, count, page, perPage } + }, +} + +export type Paginated = ReturnType diff --git a/src/customers/customers.service.ts b/src/customers/customers.service.ts index f8b01ed..81e4f8c 100644 --- a/src/customers/customers.service.ts +++ b/src/customers/customers.service.ts @@ -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) } } diff --git a/src/customers/dto/create-customer.dto.ts b/src/customers/dto/create-customer.dto.ts index d671d24..fa7fa02 100644 --- a/src/customers/dto/create-customer.dto.ts +++ b/src/customers/dto/create-customer.dto.ts @@ -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 } diff --git a/src/customers/dto/update-customer.dto.ts b/src/customers/dto/update-customer.dto.ts index ee1d43f..c779936 100644 --- a/src/customers/dto/update-customer.dto.ts +++ b/src/customers/dto/update-customer.dto.ts @@ -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 } diff --git a/src/generated/prisma/browser.ts b/src/generated/prisma/browser.ts index 50b5050..ab7af45 100644 --- a/src/generated/prisma/browser.ts +++ b/src/generated/prisma/browser.ts @@ -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 * diff --git a/src/generated/prisma/client.ts b/src/generated/prisma/client.ts index a62336a..3fd96d0 100644 --- a/src/generated/prisma/client.ts +++ b/src/generated/prisma/client.ts @@ -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 * diff --git a/src/generated/prisma/commonInputTypes.ts b/src/generated/prisma/commonInputTypes.ts index 1269737..2fd2cb8 100644 --- a/src/generated/prisma/commonInputTypes.ts +++ b/src/generated/prisma/commonInputTypes.ts @@ -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 +} + diff --git a/src/generated/prisma/internal/class.ts b/src/generated/prisma/internal/class.ts index dcea838..67dad5f 100644 --- a/src/generated/prisma/internal/class.ts +++ b/src/generated/prisma/internal/class.ts @@ -20,7 +20,7 @@ const config: runtime.GetPrismaClientConfig = { "clientVersion": "7.1.0", "engineVersion": "ab635e6b9d606fa5c8fb8b1a7f909c3c3c1c98ba", "activeProvider": "mysql", - "inlineSchema": "datasource db {\n provider = \"mysql\"\n}\n\ngenerator client {\n provider = \"prisma-client\"\n output = \"../src/generated/prisma\"\n moduleFormat = \"cjs\"\n}\n\nmodel User {\n id Int @id @default(autoincrement())\n mobileNumber String @unique @db.Char(11)\n password String\n firstName String\n lastName String\n\n roleId Int\n role Role @relation(\"User_Role\", fields: [roleId], references: [id], onUpdate: NoAction)\n\n @@map(\"Users\")\n}\n\nmodel Role {\n id Int @id @default(autoincrement())\n name String @db.VarChar(100)\n description String? @db.Text\n permissions Json?\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n users User[] @relation(\"User_Role\")\n\n @@map(\"Roles\")\n}\n\nmodel Product {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n description String? @db.Text\n sku String? @unique(map: \"products_sku_unique\") @db.VarChar(100)\n barcode String? @unique(map: \"products_barcode_unique\") @db.VarChar(100)\n imageUrl String? @db.VarChar(255)\n attachmentId BigInt? @db.UnsignedBigInt\n unit String @db.VarChar(10)\n discount Decimal @default(0.00) @db.Decimal(10, 2)\n quantity Decimal @default(0.00) @db.Decimal(10, 2)\n alertQuantity Decimal @default(5.00) @db.Decimal(10, 2)\n isActive Boolean @default(true)\n isFeatured Boolean @default(false)\n createdAt DateTime? @db.Timestamp(0)\n updatedAt DateTime? @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n productInfo ProductInfo @relation(\"Product_ProductInfo\", fields: [productInfoId], references: [id], onUpdate: NoAction)\n productInfoId Int\n // is_stock_managed Boolean @default(true)\n // created_by Int?\n // collection_product collection_product[]\n // product_batches product_batches[]\n // product_stocks product_stocks[]\n // attachments attachments? @relation(fields: [attachment_id], references: [id], onUpdate: NoAction, map: \"products_attachment_id_foreign\")\n // purchase_items purchase_items[]\n // sale_items sale_items[]\n\n // @@index([attachment_id], map: \"products_attachment_id_foreign\")\n @@map(\"Products\")\n}\n\nmodel ProductInfo {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n description String? @db.Text\n productType String? @default(\"simple\") @db.VarChar(50)\n metaData Json?\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n products Product[] @relation(\"Product_ProductInfo\")\n\n brand ProductBrand? @relation(\"ProductInfo_Brand\", fields: [brandId], references: [id], onUpdate: NoAction)\n brandId Int?\n\n category ProductCategory? @relation(\"ProductInfo_Category\", fields: [categoryId], references: [id], onUpdate: NoAction)\n categoryId Int?\n\n supplier Supplier @relation(\"ProductInfo_Supplier\", fields: [supplierId], references: [id], onUpdate: NoAction)\n supplierId Int\n\n @@map(\"Product_info\")\n}\n\nmodel ProductBrand {\n id Int @id @default(autoincrement())\n name String @db.VarChar(100)\n description String? @db.Text\n imageUrl String? @db.VarChar(255)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n productInfo ProductInfo[] @relation(\"ProductInfo_Brand\")\n\n @@map(\"Product_brands\")\n}\n\nmodel ProductCategory {\n id Int @id @default(autoincrement())\n name String @db.VarChar(100)\n description String? @db.Text\n imageUrl String? @db.VarChar(255)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n productInfo ProductInfo[] @relation(\"ProductInfo_Category\")\n\n @@map(\"Product_categories\")\n}\n\nmodel Supplier {\n id Int @id @default(autoincrement())\n firstName String @db.VarChar(255)\n lastName String @db.VarChar(255)\n email String? @db.VarChar(255)\n mobileNumber String @unique @db.Char(11)\n address String? @db.Text\n city String? @db.VarChar(100)\n state String? @db.VarChar(100)\n country String? @db.VarChar(100)\n isActive Boolean @default(true)\n createdAt DateTime? @db.Timestamp(0)\n updatedAt DateTime? @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n productInfo ProductInfo[] @relation(\"ProductInfo_Supplier\")\n\n @@map(\"Suppliers\")\n}\n\nmodel Customer {\n id Int @id @default(autoincrement())\n firstName String @db.VarChar(255)\n lastName String @db.VarChar(255)\n email String? @db.VarChar(255)\n mobileNumber String @unique @db.Char(11)\n address String? @db.Text\n city String? @db.VarChar(100)\n state String? @db.VarChar(100)\n country String? @db.VarChar(100)\n isActive Boolean @default(true)\n createdAt DateTime? @db.Timestamp(0)\n updatedAt DateTime? @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n @@map(\"Customers\")\n}\n\nmodel Inventory {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n location String? @db.VarChar(255)\n isActive Boolean @default(true)\n createdAt DateTime @db.Timestamp(0)\n updatedAt DateTime @db.Timestamp(0)\n\n @@map(\"Inventories\")\n}\n\nmodel Store {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n location String? @db.VarChar(255)\n isActive Boolean @default(true)\n createdAt DateTime @db.Timestamp(0)\n updatedAt DateTime @db.Timestamp(0)\n\n @@map(\"Stores\")\n}\n", + "inlineSchema": "datasource db {\n provider = \"mysql\"\n}\n\ngenerator client {\n provider = \"prisma-client\"\n output = \"../src/generated/prisma\"\n moduleFormat = \"cjs\"\n}\n\nmodel User {\n id Int @id @default(autoincrement())\n mobileNumber String @unique @db.Char(11)\n password String\n firstName String\n lastName String\n\n roleId Int\n role Role @relation(\"User_Role\", fields: [roleId], references: [id], onUpdate: NoAction)\n\n @@map(\"Users\")\n}\n\nmodel Role {\n id Int @id @default(autoincrement())\n name String @db.VarChar(100)\n description String? @db.Text\n permissions Json?\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n users User[] @relation(\"User_Role\")\n\n @@map(\"Roles\")\n}\n\nmodel ProductVariant {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n basePrice Decimal @db.Decimal(10, 2)\n salePrice Decimal @db.Decimal(10, 2)\n description String? @db.Text\n barcode String? @unique(map: \"products_barcode_unique\") @db.VarChar(100)\n imageUrl String? @db.VarChar(255)\n unit String? @db.VarChar(10)\n quantity Decimal? @default(0.00) @db.Decimal(10, 2)\n alertQuantity Decimal? @default(5.00) @db.Decimal(10, 2)\n isActive Boolean @default(true)\n isFeatured Boolean @default(false)\n createdAt DateTime? @db.Timestamp(0)\n updatedAt DateTime? @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n product Product @relation(\"Product_Variant\", fields: [productId], references: [id], onUpdate: NoAction)\n productId Int\n // is_stock_managed Boolean @default(true)\n // created_by Int?\n // collection_product collection_product[]\n // product_batches product_batches[]\n // product_stocks product_stocks[]\n // attachments attachments? @relation(fields: [attachment_id], references: [id], onUpdate: NoAction, map: \"products_attachment_id_foreign\")\n // purchase_items purchase_items[]\n // sale_items sale_items[]\n\n @@map(\"Product_Variants\")\n}\n\nmodel Product {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n barcode String? @unique(map: \"products_barcode_unique\") @db.VarChar(100)\n sku String? @unique(map: \"products_sku_unique\") @db.VarChar(100)\n description String? @db.Text\n // productType String? @default(\"simple\") @db.VarChar(50)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n variants ProductVariant[] @relation(\"Product_Variant\")\n\n brand ProductBrand? @relation(\"Product_Brand\", fields: [brandId], references: [id], onUpdate: NoAction)\n brandId Int?\n\n category ProductCategory? @relation(\"Product_Category\", fields: [categoryId], references: [id], onUpdate: NoAction)\n categoryId Int?\n\n @@map(\"Products\")\n}\n\nmodel ProductBrand {\n id Int @id @default(autoincrement())\n name String @db.VarChar(100)\n description String? @db.Text\n imageUrl String? @db.VarChar(255)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n products Product[] @relation(\"Product_Brand\")\n\n @@map(\"Product_brands\")\n}\n\nmodel ProductCategory {\n id Int @id @default(autoincrement())\n name String @db.VarChar(100)\n description String? @db.Text\n imageUrl String? @db.VarChar(255)\n createdAt DateTime @default(now()) @db.Timestamp(0)\n updatedAt DateTime @updatedAt @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n products Product[] @relation(\"Product_Category\")\n\n @@map(\"Product_categories\")\n}\n\nmodel Supplier {\n id Int @id @default(autoincrement())\n firstName String @db.VarChar(255)\n lastName String @db.VarChar(255)\n email String? @db.VarChar(255)\n mobileNumber String @unique @db.Char(11)\n address String? @db.Text\n city String? @db.VarChar(100)\n state String? @db.VarChar(100)\n country String? @db.VarChar(100)\n isActive Boolean @default(true)\n createdAt DateTime? @db.Timestamp(0)\n updatedAt DateTime? @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n @@map(\"Suppliers\")\n}\n\nmodel Customer {\n id Int @id @default(autoincrement())\n firstName String @db.VarChar(255)\n lastName String @db.VarChar(255)\n email String? @db.VarChar(255)\n mobileNumber String @unique @db.Char(11)\n address String? @db.Text\n city String? @db.VarChar(100)\n state String? @db.VarChar(100)\n country String? @db.VarChar(100)\n isActive Boolean @default(true)\n createdAt DateTime? @db.Timestamp(0)\n updatedAt DateTime? @db.Timestamp(0)\n deletedAt DateTime? @db.Timestamp(0)\n\n @@map(\"Customers\")\n}\n\nmodel Inventory {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n location String? @db.VarChar(255)\n isActive Boolean @default(true)\n createdAt DateTime @db.Timestamp(0)\n updatedAt DateTime @db.Timestamp(0)\n\n @@map(\"Inventories\")\n}\n\nmodel Store {\n id Int @id @default(autoincrement())\n name String @db.VarChar(255)\n location String? @db.VarChar(255)\n isActive Boolean @default(true)\n createdAt DateTime @db.Timestamp(0)\n updatedAt DateTime @db.Timestamp(0)\n\n @@map(\"Stores\")\n}\n", "runtimeDataModel": { "models": {}, "enums": {}, @@ -28,7 +28,7 @@ const config: runtime.GetPrismaClientConfig = { } } -config.runtimeDataModel = JSON.parse("{\"models\":{\"User\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"mobileNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"firstName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"lastName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"roleId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"role\",\"kind\":\"object\",\"type\":\"Role\",\"relationName\":\"User_Role\"}],\"dbName\":\"Users\"},\"Role\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"permissions\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"users\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"User_Role\"}],\"dbName\":\"Roles\"},\"Product\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"sku\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"barcode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"imageUrl\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"attachmentId\",\"kind\":\"scalar\",\"type\":\"BigInt\"},{\"name\":\"unit\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"discount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"alertQuantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"isFeatured\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"productInfo\",\"kind\":\"object\",\"type\":\"ProductInfo\",\"relationName\":\"Product_ProductInfo\"},{\"name\":\"productInfoId\",\"kind\":\"scalar\",\"type\":\"Int\"}],\"dbName\":\"Products\"},\"ProductInfo\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"productType\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"metaData\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"products\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_ProductInfo\"},{\"name\":\"brand\",\"kind\":\"object\",\"type\":\"ProductBrand\",\"relationName\":\"ProductInfo_Brand\"},{\"name\":\"brandId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"category\",\"kind\":\"object\",\"type\":\"ProductCategory\",\"relationName\":\"ProductInfo_Category\"},{\"name\":\"categoryId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"supplier\",\"kind\":\"object\",\"type\":\"Supplier\",\"relationName\":\"ProductInfo_Supplier\"},{\"name\":\"supplierId\",\"kind\":\"scalar\",\"type\":\"Int\"}],\"dbName\":\"Product_info\"},\"ProductBrand\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"imageUrl\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"productInfo\",\"kind\":\"object\",\"type\":\"ProductInfo\",\"relationName\":\"ProductInfo_Brand\"}],\"dbName\":\"Product_brands\"},\"ProductCategory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"imageUrl\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"productInfo\",\"kind\":\"object\",\"type\":\"ProductInfo\",\"relationName\":\"ProductInfo_Category\"}],\"dbName\":\"Product_categories\"},\"Supplier\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"firstName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"lastName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"mobileNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"address\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"city\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"state\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"country\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"productInfo\",\"kind\":\"object\",\"type\":\"ProductInfo\",\"relationName\":\"ProductInfo_Supplier\"}],\"dbName\":\"Suppliers\"},\"Customer\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"firstName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"lastName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"mobileNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"address\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"city\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"state\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"country\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"Customers\"},\"Inventory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"location\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"Inventories\"},\"Store\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"location\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"Stores\"}},\"enums\":{},\"types\":{}}") +config.runtimeDataModel = JSON.parse("{\"models\":{\"User\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"mobileNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"firstName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"lastName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"roleId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"role\",\"kind\":\"object\",\"type\":\"Role\",\"relationName\":\"User_Role\"}],\"dbName\":\"Users\"},\"Role\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"permissions\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"users\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"User_Role\"}],\"dbName\":\"Roles\"},\"ProductVariant\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"basePrice\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"salePrice\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"barcode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"imageUrl\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"unit\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"alertQuantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"isFeatured\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"product\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_Variant\"},{\"name\":\"productId\",\"kind\":\"scalar\",\"type\":\"Int\"}],\"dbName\":\"Product_Variants\"},\"Product\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"barcode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"sku\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"variants\",\"kind\":\"object\",\"type\":\"ProductVariant\",\"relationName\":\"Product_Variant\"},{\"name\":\"brand\",\"kind\":\"object\",\"type\":\"ProductBrand\",\"relationName\":\"Product_Brand\"},{\"name\":\"brandId\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"category\",\"kind\":\"object\",\"type\":\"ProductCategory\",\"relationName\":\"Product_Category\"},{\"name\":\"categoryId\",\"kind\":\"scalar\",\"type\":\"Int\"}],\"dbName\":\"Products\"},\"ProductBrand\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"imageUrl\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"products\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_Brand\"}],\"dbName\":\"Product_brands\"},\"ProductCategory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"imageUrl\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"products\",\"kind\":\"object\",\"type\":\"Product\",\"relationName\":\"Product_Category\"}],\"dbName\":\"Product_categories\"},\"Supplier\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"firstName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"lastName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"mobileNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"address\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"city\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"state\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"country\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"Suppliers\"},\"Customer\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"firstName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"lastName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"mobileNumber\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"address\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"city\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"state\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"country\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"Customers\"},\"Inventory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"location\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"Inventories\"},\"Store\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"location\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"isActive\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"Stores\"}},\"enums\":{},\"types\":{}}") async function decodeBase64AsWasm(wasmBase64: string): Promise { const { Buffer } = await import('node:buffer') @@ -194,6 +194,16 @@ export interface PrismaClient< */ get role(): Prisma.RoleDelegate; + /** + * `prisma.productVariant`: Exposes CRUD operations for the **ProductVariant** model. + * Example usage: + * ```ts + * // Fetch zero or more ProductVariants + * const productVariants = await prisma.productVariant.findMany() + * ``` + */ + get productVariant(): Prisma.ProductVariantDelegate; + /** * `prisma.product`: Exposes CRUD operations for the **Product** model. * Example usage: @@ -204,16 +214,6 @@ export interface PrismaClient< */ get product(): Prisma.ProductDelegate; - /** - * `prisma.productInfo`: Exposes CRUD operations for the **ProductInfo** model. - * Example usage: - * ```ts - * // Fetch zero or more ProductInfos - * const productInfos = await prisma.productInfo.findMany() - * ``` - */ - get productInfo(): Prisma.ProductInfoDelegate; - /** * `prisma.productBrand`: Exposes CRUD operations for the **ProductBrand** model. * Example usage: diff --git a/src/generated/prisma/internal/prismaNamespace.ts b/src/generated/prisma/internal/prismaNamespace.ts index cab801e..1122910 100644 --- a/src/generated/prisma/internal/prismaNamespace.ts +++ b/src/generated/prisma/internal/prismaNamespace.ts @@ -386,8 +386,8 @@ type FieldRefInputType = 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 + fields: Prisma.ProductVariantFieldRefs + operations: { + findUnique: { + args: Prisma.ProductVariantFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.ProductVariantFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.ProductVariantFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.ProductVariantFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.ProductVariantFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.ProductVariantCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.ProductVariantCreateManyArgs + result: BatchPayload + } + delete: { + args: Prisma.ProductVariantDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.ProductVariantUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.ProductVariantDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.ProductVariantUpdateManyArgs + result: BatchPayload + } + upsert: { + args: Prisma.ProductVariantUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.ProductVariantAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.ProductVariantGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.ProductVariantCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } Product: { payload: Prisma.$ProductPayload fields: Prisma.ProductFieldRefs @@ -611,72 +677,6 @@ export type TypeMap - fields: Prisma.ProductInfoFieldRefs - operations: { - findUnique: { - args: Prisma.ProductInfoFindUniqueArgs - result: runtime.Types.Utils.PayloadToResult | null - } - findUniqueOrThrow: { - args: Prisma.ProductInfoFindUniqueOrThrowArgs - result: runtime.Types.Utils.PayloadToResult - } - findFirst: { - args: Prisma.ProductInfoFindFirstArgs - result: runtime.Types.Utils.PayloadToResult | null - } - findFirstOrThrow: { - args: Prisma.ProductInfoFindFirstOrThrowArgs - result: runtime.Types.Utils.PayloadToResult - } - findMany: { - args: Prisma.ProductInfoFindManyArgs - result: runtime.Types.Utils.PayloadToResult[] - } - create: { - args: Prisma.ProductInfoCreateArgs - result: runtime.Types.Utils.PayloadToResult - } - createMany: { - args: Prisma.ProductInfoCreateManyArgs - result: BatchPayload - } - delete: { - args: Prisma.ProductInfoDeleteArgs - result: runtime.Types.Utils.PayloadToResult - } - update: { - args: Prisma.ProductInfoUpdateArgs - result: runtime.Types.Utils.PayloadToResult - } - deleteMany: { - args: Prisma.ProductInfoDeleteManyArgs - result: BatchPayload - } - updateMany: { - args: Prisma.ProductInfoUpdateManyArgs - result: BatchPayload - } - upsert: { - args: Prisma.ProductInfoUpsertArgs - result: runtime.Types.Utils.PayloadToResult - } - aggregate: { - args: Prisma.ProductInfoAggregateArgs - result: runtime.Types.Utils.Optional - } - groupBy: { - args: Prisma.ProductInfoGroupByArgs - result: runtime.Types.Utils.Optional[] - } - count: { - args: Prisma.ProductInfoCountArgs - result: runtime.Types.Utils.Optional | number - } - } - } ProductBrand: { payload: Prisma.$ProductBrandPayload 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 diff --git a/src/generated/prisma/internal/prismaNamespaceBrowser.ts b/src/generated/prisma/internal/prismaNamespaceBrowser.ts index 2e9acfc..eb084ca 100644 --- a/src/generated/prisma/internal/prismaNamespaceBrowser.ts +++ b/src/generated/prisma/internal/prismaNamespaceBrowser.ts @@ -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 = { diff --git a/src/generated/prisma/models.ts b/src/generated/prisma/models.ts index dcddbb8..d38d0b0 100644 --- a/src/generated/prisma/models.ts +++ b/src/generated/prisma/models.ts @@ -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' diff --git a/src/generated/prisma/models/Product.ts b/src/generated/prisma/models/Product.ts index 9d348b2..e35c4a3 100644 --- a/src/generated/prisma/models/Product.ts +++ b/src/generated/prisma/models/Product.ts @@ -28,160 +28,106 @@ export type AggregateProduct = { export type ProductAvgAggregateOutputType = { id: number | null - attachmentId: number | null - discount: runtime.Decimal | null - quantity: runtime.Decimal | null - alertQuantity: runtime.Decimal | null - productInfoId: number | null + brandId: number | null + categoryId: number | null } export type ProductSumAggregateOutputType = { id: number | null - attachmentId: bigint | null - discount: runtime.Decimal | null - quantity: runtime.Decimal | null - alertQuantity: runtime.Decimal | null - productInfoId: number | null + brandId: number | null + categoryId: number | null } export type ProductMinAggregateOutputType = { id: number | null name: string | null - description: string | null - sku: string | null barcode: string | null - imageUrl: string | null - attachmentId: bigint | null - unit: string | null - discount: runtime.Decimal | null - quantity: runtime.Decimal | null - alertQuantity: runtime.Decimal | null - isActive: boolean | null - isFeatured: boolean | null + sku: string | null + description: string | null createdAt: Date | null updatedAt: Date | null deletedAt: Date | null - productInfoId: number | null + brandId: number | null + categoryId: number | null } export type ProductMaxAggregateOutputType = { id: number | null name: string | null - description: string | null - sku: string | null barcode: string | null - imageUrl: string | null - attachmentId: bigint | null - unit: string | null - discount: runtime.Decimal | null - quantity: runtime.Decimal | null - alertQuantity: runtime.Decimal | null - isActive: boolean | null - isFeatured: boolean | null + sku: string | null + description: string | null createdAt: Date | null updatedAt: Date | null deletedAt: Date | null - productInfoId: number | null + brandId: number | null + categoryId: number | null } export type ProductCountAggregateOutputType = { id: number name: number - description: number - sku: number barcode: number - imageUrl: number - attachmentId: number - unit: number - discount: number - quantity: number - alertQuantity: number - isActive: number - isFeatured: number + sku: number + description: number createdAt: number updatedAt: number deletedAt: number - productInfoId: number + brandId: number + categoryId: number _all: number } export type ProductAvgAggregateInputType = { id?: true - attachmentId?: true - discount?: true - quantity?: true - alertQuantity?: true - productInfoId?: true + brandId?: true + categoryId?: true } export type ProductSumAggregateInputType = { id?: true - attachmentId?: true - discount?: true - quantity?: true - alertQuantity?: true - productInfoId?: true + brandId?: true + categoryId?: true } export type ProductMinAggregateInputType = { id?: true name?: true - description?: true - sku?: true barcode?: true - imageUrl?: true - attachmentId?: true - unit?: true - discount?: true - quantity?: true - alertQuantity?: true - isActive?: true - isFeatured?: true + sku?: true + description?: true createdAt?: true updatedAt?: true deletedAt?: true - productInfoId?: true + brandId?: true + categoryId?: true } export type ProductMaxAggregateInputType = { id?: true name?: true - description?: true - sku?: true barcode?: true - imageUrl?: true - attachmentId?: true - unit?: true - discount?: true - quantity?: true - alertQuantity?: true - isActive?: true - isFeatured?: true + sku?: true + description?: true createdAt?: true updatedAt?: true deletedAt?: true - productInfoId?: true + brandId?: true + categoryId?: true } export type ProductCountAggregateInputType = { id?: true name?: true - description?: true - sku?: true barcode?: true - imageUrl?: true - attachmentId?: true - unit?: true - discount?: true - quantity?: true - alertQuantity?: true - isActive?: true - isFeatured?: true + sku?: true + description?: true createdAt?: true updatedAt?: true deletedAt?: true - productInfoId?: true + brandId?: true + categoryId?: true _all?: true } @@ -274,21 +220,14 @@ export type ProductGroupByArgs | number name?: Prisma.StringFilter<"Product"> | string - description?: Prisma.StringNullableFilter<"Product"> | string | null - sku?: Prisma.StringNullableFilter<"Product"> | string | null barcode?: Prisma.StringNullableFilter<"Product"> | string | null - imageUrl?: Prisma.StringNullableFilter<"Product"> | string | null - attachmentId?: Prisma.BigIntNullableFilter<"Product"> | bigint | number | null - unit?: Prisma.StringFilter<"Product"> | string - discount?: Prisma.DecimalFilter<"Product"> | runtime.Decimal | runtime.DecimalJsLike | number | string - quantity?: Prisma.DecimalFilter<"Product"> | runtime.Decimal | runtime.DecimalJsLike | number | string - alertQuantity?: Prisma.DecimalFilter<"Product"> | runtime.Decimal | runtime.DecimalJsLike | number | string - isActive?: Prisma.BoolFilter<"Product"> | boolean - isFeatured?: Prisma.BoolFilter<"Product"> | boolean - createdAt?: Prisma.DateTimeNullableFilter<"Product"> | Date | string | null - updatedAt?: Prisma.DateTimeNullableFilter<"Product"> | Date | string | null + sku?: Prisma.StringNullableFilter<"Product"> | string | null + description?: Prisma.StringNullableFilter<"Product"> | string | null + createdAt?: Prisma.DateTimeFilter<"Product"> | Date | string + updatedAt?: Prisma.DateTimeFilter<"Product"> | Date | string deletedAt?: Prisma.DateTimeNullableFilter<"Product"> | Date | string | null - productInfoId?: Prisma.IntFilter<"Product"> | number - productInfo?: Prisma.XOR + brandId?: Prisma.IntNullableFilter<"Product"> | number | null + categoryId?: Prisma.IntNullableFilter<"Product"> | number | null + variants?: Prisma.ProductVariantListRelationFilter + brand?: Prisma.XOR | null + category?: Prisma.XOR | null } export type ProductOrderByWithRelationInput = { id?: Prisma.SortOrder name?: Prisma.SortOrder - description?: Prisma.SortOrderInput | Prisma.SortOrder - sku?: Prisma.SortOrderInput | Prisma.SortOrder barcode?: Prisma.SortOrderInput | Prisma.SortOrder - imageUrl?: Prisma.SortOrderInput | Prisma.SortOrder - attachmentId?: Prisma.SortOrderInput | Prisma.SortOrder - unit?: Prisma.SortOrder - discount?: Prisma.SortOrder - quantity?: Prisma.SortOrder - alertQuantity?: Prisma.SortOrder - isActive?: Prisma.SortOrder - isFeatured?: Prisma.SortOrder - createdAt?: Prisma.SortOrderInput | Prisma.SortOrder - updatedAt?: Prisma.SortOrderInput | Prisma.SortOrder + sku?: Prisma.SortOrderInput | Prisma.SortOrder + description?: Prisma.SortOrderInput | Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder - productInfoId?: Prisma.SortOrder - productInfo?: Prisma.ProductInfoOrderByWithRelationInput + brandId?: Prisma.SortOrderInput | Prisma.SortOrder + categoryId?: Prisma.SortOrderInput | Prisma.SortOrder + variants?: Prisma.ProductVariantOrderByRelationAggregateInput + brand?: Prisma.ProductBrandOrderByWithRelationInput + category?: Prisma.ProductCategoryOrderByWithRelationInput _relevance?: Prisma.ProductOrderByRelevanceInput } export type ProductWhereUniqueInput = Prisma.AtLeast<{ id?: number - sku?: string barcode?: string + sku?: string AND?: Prisma.ProductWhereInput | Prisma.ProductWhereInput[] OR?: Prisma.ProductWhereInput[] NOT?: Prisma.ProductWhereInput | Prisma.ProductWhereInput[] name?: Prisma.StringFilter<"Product"> | string description?: Prisma.StringNullableFilter<"Product"> | string | null - imageUrl?: Prisma.StringNullableFilter<"Product"> | string | null - attachmentId?: Prisma.BigIntNullableFilter<"Product"> | bigint | number | null - unit?: Prisma.StringFilter<"Product"> | string - discount?: Prisma.DecimalFilter<"Product"> | runtime.Decimal | runtime.DecimalJsLike | number | string - quantity?: Prisma.DecimalFilter<"Product"> | runtime.Decimal | runtime.DecimalJsLike | number | string - alertQuantity?: Prisma.DecimalFilter<"Product"> | runtime.Decimal | runtime.DecimalJsLike | number | string - isActive?: Prisma.BoolFilter<"Product"> | boolean - isFeatured?: Prisma.BoolFilter<"Product"> | boolean - createdAt?: Prisma.DateTimeNullableFilter<"Product"> | Date | string | null - updatedAt?: Prisma.DateTimeNullableFilter<"Product"> | Date | string | null + createdAt?: Prisma.DateTimeFilter<"Product"> | Date | string + updatedAt?: Prisma.DateTimeFilter<"Product"> | Date | string deletedAt?: Prisma.DateTimeNullableFilter<"Product"> | Date | string | null - productInfoId?: Prisma.IntFilter<"Product"> | number - productInfo?: Prisma.XOR -}, "id" | "sku" | "barcode"> + brandId?: Prisma.IntNullableFilter<"Product"> | number | null + categoryId?: Prisma.IntNullableFilter<"Product"> | number | null + variants?: Prisma.ProductVariantListRelationFilter + brand?: Prisma.XOR | null + category?: Prisma.XOR | null +}, "id" | "barcode" | "sku"> export type ProductOrderByWithAggregationInput = { id?: Prisma.SortOrder name?: Prisma.SortOrder - description?: Prisma.SortOrderInput | Prisma.SortOrder - sku?: Prisma.SortOrderInput | Prisma.SortOrder barcode?: Prisma.SortOrderInput | Prisma.SortOrder - imageUrl?: Prisma.SortOrderInput | Prisma.SortOrder - attachmentId?: Prisma.SortOrderInput | Prisma.SortOrder - unit?: Prisma.SortOrder - discount?: Prisma.SortOrder - quantity?: Prisma.SortOrder - alertQuantity?: Prisma.SortOrder - isActive?: Prisma.SortOrder - isFeatured?: Prisma.SortOrder - createdAt?: Prisma.SortOrderInput | Prisma.SortOrder - updatedAt?: Prisma.SortOrderInput | Prisma.SortOrder + sku?: Prisma.SortOrderInput | Prisma.SortOrder + description?: Prisma.SortOrderInput | Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder - productInfoId?: Prisma.SortOrder + brandId?: Prisma.SortOrderInput | Prisma.SortOrder + categoryId?: Prisma.SortOrderInput | Prisma.SortOrder _count?: Prisma.ProductCountOrderByAggregateInput _avg?: Prisma.ProductAvgOrderByAggregateInput _max?: Prisma.ProductMaxOrderByAggregateInput @@ -412,157 +329,109 @@ export type ProductScalarWhereWithAggregatesInput = { NOT?: Prisma.ProductScalarWhereWithAggregatesInput | Prisma.ProductScalarWhereWithAggregatesInput[] id?: Prisma.IntWithAggregatesFilter<"Product"> | number name?: Prisma.StringWithAggregatesFilter<"Product"> | string - description?: Prisma.StringNullableWithAggregatesFilter<"Product"> | string | null - sku?: Prisma.StringNullableWithAggregatesFilter<"Product"> | string | null barcode?: Prisma.StringNullableWithAggregatesFilter<"Product"> | string | null - imageUrl?: Prisma.StringNullableWithAggregatesFilter<"Product"> | string | null - attachmentId?: Prisma.BigIntNullableWithAggregatesFilter<"Product"> | bigint | number | null - unit?: Prisma.StringWithAggregatesFilter<"Product"> | string - discount?: Prisma.DecimalWithAggregatesFilter<"Product"> | runtime.Decimal | runtime.DecimalJsLike | number | string - quantity?: Prisma.DecimalWithAggregatesFilter<"Product"> | runtime.Decimal | runtime.DecimalJsLike | number | string - alertQuantity?: Prisma.DecimalWithAggregatesFilter<"Product"> | runtime.Decimal | runtime.DecimalJsLike | number | string - isActive?: Prisma.BoolWithAggregatesFilter<"Product"> | boolean - isFeatured?: Prisma.BoolWithAggregatesFilter<"Product"> | boolean - createdAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Product"> | Date | string | null - updatedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Product"> | Date | string | null + sku?: Prisma.StringNullableWithAggregatesFilter<"Product"> | string | null + description?: Prisma.StringNullableWithAggregatesFilter<"Product"> | string | null + createdAt?: Prisma.DateTimeWithAggregatesFilter<"Product"> | Date | string + updatedAt?: Prisma.DateTimeWithAggregatesFilter<"Product"> | Date | string deletedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Product"> | Date | string | null - productInfoId?: Prisma.IntWithAggregatesFilter<"Product"> | number + brandId?: Prisma.IntNullableWithAggregatesFilter<"Product"> | number | null + categoryId?: Prisma.IntNullableWithAggregatesFilter<"Product"> | number | null } export type ProductCreateInput = { name: string - description?: string | null - sku?: string | null barcode?: string | null - imageUrl?: string | null - attachmentId?: bigint | number | null - unit: string - discount?: runtime.Decimal | runtime.DecimalJsLike | number | string - quantity?: runtime.Decimal | runtime.DecimalJsLike | number | string - alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string - isActive?: boolean - isFeatured?: boolean - createdAt?: Date | string | null - updatedAt?: Date | string | null + sku?: string | null + description?: string | null + createdAt?: Date | string + updatedAt?: Date | string deletedAt?: Date | string | null - productInfo: Prisma.ProductInfoCreateNestedOneWithoutProductsInput + variants?: Prisma.ProductVariantCreateNestedManyWithoutProductInput + brand?: Prisma.ProductBrandCreateNestedOneWithoutProductsInput + category?: Prisma.ProductCategoryCreateNestedOneWithoutProductsInput } export type ProductUncheckedCreateInput = { id?: number name: string - description?: string | null - sku?: string | null barcode?: string | null - imageUrl?: string | null - attachmentId?: bigint | number | null - unit: string - discount?: runtime.Decimal | runtime.DecimalJsLike | number | string - quantity?: runtime.Decimal | runtime.DecimalJsLike | number | string - alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string - isActive?: boolean - isFeatured?: boolean - createdAt?: Date | string | null - updatedAt?: Date | string | null + sku?: string | null + description?: string | null + createdAt?: Date | string + updatedAt?: Date | string deletedAt?: Date | string | null - productInfoId: number + brandId?: number | null + categoryId?: number | null + variants?: Prisma.ProductVariantUncheckedCreateNestedManyWithoutProductInput } export type ProductUpdateInput = { name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - imageUrl?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - attachmentId?: Prisma.NullableBigIntFieldUpdateOperationsInput | bigint | number | null - unit?: Prisma.StringFieldUpdateOperationsInput | string - discount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - alertQuantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean - isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean - createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - productInfo?: Prisma.ProductInfoUpdateOneRequiredWithoutProductsNestedInput + variants?: Prisma.ProductVariantUpdateManyWithoutProductNestedInput + brand?: Prisma.ProductBrandUpdateOneWithoutProductsNestedInput + category?: Prisma.ProductCategoryUpdateOneWithoutProductsNestedInput } export type ProductUncheckedUpdateInput = { id?: Prisma.IntFieldUpdateOperationsInput | number name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - imageUrl?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - attachmentId?: Prisma.NullableBigIntFieldUpdateOperationsInput | bigint | number | null - unit?: Prisma.StringFieldUpdateOperationsInput | string - discount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - alertQuantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean - isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean - createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - productInfoId?: Prisma.IntFieldUpdateOperationsInput | number + brandId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + categoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + variants?: Prisma.ProductVariantUncheckedUpdateManyWithoutProductNestedInput } export type ProductCreateManyInput = { id?: number name: string - description?: string | null - sku?: string | null barcode?: string | null - imageUrl?: string | null - attachmentId?: bigint | number | null - unit: string - discount?: runtime.Decimal | runtime.DecimalJsLike | number | string - quantity?: runtime.Decimal | runtime.DecimalJsLike | number | string - alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string - isActive?: boolean - isFeatured?: boolean - createdAt?: Date | string | null - updatedAt?: Date | string | null + sku?: string | null + description?: string | null + createdAt?: Date | string + updatedAt?: Date | string deletedAt?: Date | string | null - productInfoId: number + brandId?: number | null + categoryId?: number | null } export type ProductUpdateManyMutationInput = { name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - imageUrl?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - attachmentId?: Prisma.NullableBigIntFieldUpdateOperationsInput | bigint | number | null - unit?: Prisma.StringFieldUpdateOperationsInput | string - discount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - alertQuantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean - isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean - createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null } export type ProductUncheckedUpdateManyInput = { id?: Prisma.IntFieldUpdateOperationsInput | number name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - imageUrl?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - attachmentId?: Prisma.NullableBigIntFieldUpdateOperationsInput | bigint | number | null - unit?: Prisma.StringFieldUpdateOperationsInput | string - discount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - alertQuantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean - isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean - createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - productInfoId?: Prisma.IntFieldUpdateOperationsInput | number + brandId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + categoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null +} + +export type ProductScalarRelationFilter = { + is?: Prisma.ProductWhereInput + isNot?: Prisma.ProductWhereInput } export type ProductOrderByRelevanceInput = { @@ -574,79 +443,52 @@ export type ProductOrderByRelevanceInput = { export type ProductCountOrderByAggregateInput = { id?: Prisma.SortOrder name?: Prisma.SortOrder - description?: Prisma.SortOrder - sku?: Prisma.SortOrder barcode?: Prisma.SortOrder - imageUrl?: Prisma.SortOrder - attachmentId?: Prisma.SortOrder - unit?: Prisma.SortOrder - discount?: Prisma.SortOrder - quantity?: Prisma.SortOrder - alertQuantity?: Prisma.SortOrder - isActive?: Prisma.SortOrder - isFeatured?: Prisma.SortOrder + sku?: Prisma.SortOrder + description?: Prisma.SortOrder createdAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder deletedAt?: Prisma.SortOrder - productInfoId?: Prisma.SortOrder + brandId?: Prisma.SortOrder + categoryId?: Prisma.SortOrder } export type ProductAvgOrderByAggregateInput = { id?: Prisma.SortOrder - attachmentId?: Prisma.SortOrder - discount?: Prisma.SortOrder - quantity?: Prisma.SortOrder - alertQuantity?: Prisma.SortOrder - productInfoId?: Prisma.SortOrder + brandId?: Prisma.SortOrder + categoryId?: Prisma.SortOrder } export type ProductMaxOrderByAggregateInput = { id?: Prisma.SortOrder name?: Prisma.SortOrder - description?: Prisma.SortOrder - sku?: Prisma.SortOrder barcode?: Prisma.SortOrder - imageUrl?: Prisma.SortOrder - attachmentId?: Prisma.SortOrder - unit?: Prisma.SortOrder - discount?: Prisma.SortOrder - quantity?: Prisma.SortOrder - alertQuantity?: Prisma.SortOrder - isActive?: Prisma.SortOrder - isFeatured?: Prisma.SortOrder + sku?: Prisma.SortOrder + description?: Prisma.SortOrder createdAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder deletedAt?: Prisma.SortOrder - productInfoId?: Prisma.SortOrder + brandId?: Prisma.SortOrder + categoryId?: Prisma.SortOrder } export type ProductMinOrderByAggregateInput = { id?: Prisma.SortOrder name?: Prisma.SortOrder - description?: Prisma.SortOrder - sku?: Prisma.SortOrder barcode?: Prisma.SortOrder - imageUrl?: Prisma.SortOrder - attachmentId?: Prisma.SortOrder - unit?: Prisma.SortOrder - discount?: Prisma.SortOrder - quantity?: Prisma.SortOrder - alertQuantity?: Prisma.SortOrder - isActive?: Prisma.SortOrder - isFeatured?: Prisma.SortOrder + sku?: Prisma.SortOrder + description?: Prisma.SortOrder createdAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder deletedAt?: Prisma.SortOrder - productInfoId?: Prisma.SortOrder + brandId?: Prisma.SortOrder + categoryId?: Prisma.SortOrder } export type ProductSumOrderByAggregateInput = { id?: Prisma.SortOrder - attachmentId?: Prisma.SortOrder - discount?: Prisma.SortOrder - quantity?: Prisma.SortOrder - alertQuantity?: Prisma.SortOrder - productInfoId?: Prisma.SortOrder + brandId?: Prisma.SortOrder + categoryId?: Prisma.SortOrder } export type ProductListRelationFilter = { @@ -659,129 +501,227 @@ export type ProductOrderByRelationAggregateInput = { _count?: Prisma.SortOrder } -export type NullableBigIntFieldUpdateOperationsInput = { - set?: bigint | number | null - increment?: bigint | number - decrement?: bigint | number - multiply?: bigint | number - divide?: bigint | number +export type ProductCreateNestedOneWithoutVariantsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ProductCreateOrConnectWithoutVariantsInput + connect?: Prisma.ProductWhereUniqueInput } -export type DecimalFieldUpdateOperationsInput = { - set?: runtime.Decimal | runtime.DecimalJsLike | number | string - increment?: runtime.Decimal | runtime.DecimalJsLike | number | string - decrement?: runtime.Decimal | runtime.DecimalJsLike | number | string - multiply?: runtime.Decimal | runtime.DecimalJsLike | number | string - divide?: runtime.Decimal | runtime.DecimalJsLike | number | string +export type ProductUpdateOneRequiredWithoutVariantsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ProductCreateOrConnectWithoutVariantsInput + upsert?: Prisma.ProductUpsertWithoutVariantsInput + connect?: Prisma.ProductWhereUniqueInput + update?: Prisma.XOR, Prisma.ProductUncheckedUpdateWithoutVariantsInput> } -export type BoolFieldUpdateOperationsInput = { - set?: boolean +export type NullableIntFieldUpdateOperationsInput = { + set?: number | null + increment?: number + decrement?: number + multiply?: number + divide?: number } -export type ProductCreateNestedManyWithoutProductInfoInput = { - create?: Prisma.XOR | Prisma.ProductCreateWithoutProductInfoInput[] | Prisma.ProductUncheckedCreateWithoutProductInfoInput[] - connectOrCreate?: Prisma.ProductCreateOrConnectWithoutProductInfoInput | Prisma.ProductCreateOrConnectWithoutProductInfoInput[] - createMany?: Prisma.ProductCreateManyProductInfoInputEnvelope +export type ProductCreateNestedManyWithoutBrandInput = { + create?: Prisma.XOR | Prisma.ProductCreateWithoutBrandInput[] | Prisma.ProductUncheckedCreateWithoutBrandInput[] + connectOrCreate?: Prisma.ProductCreateOrConnectWithoutBrandInput | Prisma.ProductCreateOrConnectWithoutBrandInput[] + createMany?: Prisma.ProductCreateManyBrandInputEnvelope connect?: Prisma.ProductWhereUniqueInput | Prisma.ProductWhereUniqueInput[] } -export type ProductUncheckedCreateNestedManyWithoutProductInfoInput = { - create?: Prisma.XOR | Prisma.ProductCreateWithoutProductInfoInput[] | Prisma.ProductUncheckedCreateWithoutProductInfoInput[] - connectOrCreate?: Prisma.ProductCreateOrConnectWithoutProductInfoInput | Prisma.ProductCreateOrConnectWithoutProductInfoInput[] - createMany?: Prisma.ProductCreateManyProductInfoInputEnvelope +export type ProductUncheckedCreateNestedManyWithoutBrandInput = { + create?: Prisma.XOR | Prisma.ProductCreateWithoutBrandInput[] | Prisma.ProductUncheckedCreateWithoutBrandInput[] + connectOrCreate?: Prisma.ProductCreateOrConnectWithoutBrandInput | Prisma.ProductCreateOrConnectWithoutBrandInput[] + createMany?: Prisma.ProductCreateManyBrandInputEnvelope connect?: Prisma.ProductWhereUniqueInput | Prisma.ProductWhereUniqueInput[] } -export type ProductUpdateManyWithoutProductInfoNestedInput = { - create?: Prisma.XOR | Prisma.ProductCreateWithoutProductInfoInput[] | Prisma.ProductUncheckedCreateWithoutProductInfoInput[] - connectOrCreate?: Prisma.ProductCreateOrConnectWithoutProductInfoInput | Prisma.ProductCreateOrConnectWithoutProductInfoInput[] - upsert?: Prisma.ProductUpsertWithWhereUniqueWithoutProductInfoInput | Prisma.ProductUpsertWithWhereUniqueWithoutProductInfoInput[] - createMany?: Prisma.ProductCreateManyProductInfoInputEnvelope +export type ProductUpdateManyWithoutBrandNestedInput = { + create?: Prisma.XOR | Prisma.ProductCreateWithoutBrandInput[] | Prisma.ProductUncheckedCreateWithoutBrandInput[] + connectOrCreate?: Prisma.ProductCreateOrConnectWithoutBrandInput | Prisma.ProductCreateOrConnectWithoutBrandInput[] + upsert?: Prisma.ProductUpsertWithWhereUniqueWithoutBrandInput | Prisma.ProductUpsertWithWhereUniqueWithoutBrandInput[] + createMany?: Prisma.ProductCreateManyBrandInputEnvelope set?: Prisma.ProductWhereUniqueInput | Prisma.ProductWhereUniqueInput[] disconnect?: Prisma.ProductWhereUniqueInput | Prisma.ProductWhereUniqueInput[] delete?: Prisma.ProductWhereUniqueInput | Prisma.ProductWhereUniqueInput[] connect?: Prisma.ProductWhereUniqueInput | Prisma.ProductWhereUniqueInput[] - update?: Prisma.ProductUpdateWithWhereUniqueWithoutProductInfoInput | Prisma.ProductUpdateWithWhereUniqueWithoutProductInfoInput[] - updateMany?: Prisma.ProductUpdateManyWithWhereWithoutProductInfoInput | Prisma.ProductUpdateManyWithWhereWithoutProductInfoInput[] + update?: Prisma.ProductUpdateWithWhereUniqueWithoutBrandInput | Prisma.ProductUpdateWithWhereUniqueWithoutBrandInput[] + updateMany?: Prisma.ProductUpdateManyWithWhereWithoutBrandInput | Prisma.ProductUpdateManyWithWhereWithoutBrandInput[] deleteMany?: Prisma.ProductScalarWhereInput | Prisma.ProductScalarWhereInput[] } -export type ProductUncheckedUpdateManyWithoutProductInfoNestedInput = { - create?: Prisma.XOR | Prisma.ProductCreateWithoutProductInfoInput[] | Prisma.ProductUncheckedCreateWithoutProductInfoInput[] - connectOrCreate?: Prisma.ProductCreateOrConnectWithoutProductInfoInput | Prisma.ProductCreateOrConnectWithoutProductInfoInput[] - upsert?: Prisma.ProductUpsertWithWhereUniqueWithoutProductInfoInput | Prisma.ProductUpsertWithWhereUniqueWithoutProductInfoInput[] - createMany?: Prisma.ProductCreateManyProductInfoInputEnvelope +export type ProductUncheckedUpdateManyWithoutBrandNestedInput = { + create?: Prisma.XOR | Prisma.ProductCreateWithoutBrandInput[] | Prisma.ProductUncheckedCreateWithoutBrandInput[] + connectOrCreate?: Prisma.ProductCreateOrConnectWithoutBrandInput | Prisma.ProductCreateOrConnectWithoutBrandInput[] + upsert?: Prisma.ProductUpsertWithWhereUniqueWithoutBrandInput | Prisma.ProductUpsertWithWhereUniqueWithoutBrandInput[] + createMany?: Prisma.ProductCreateManyBrandInputEnvelope set?: Prisma.ProductWhereUniqueInput | Prisma.ProductWhereUniqueInput[] disconnect?: Prisma.ProductWhereUniqueInput | Prisma.ProductWhereUniqueInput[] delete?: Prisma.ProductWhereUniqueInput | Prisma.ProductWhereUniqueInput[] connect?: Prisma.ProductWhereUniqueInput | Prisma.ProductWhereUniqueInput[] - update?: Prisma.ProductUpdateWithWhereUniqueWithoutProductInfoInput | Prisma.ProductUpdateWithWhereUniqueWithoutProductInfoInput[] - updateMany?: Prisma.ProductUpdateManyWithWhereWithoutProductInfoInput | Prisma.ProductUpdateManyWithWhereWithoutProductInfoInput[] + update?: Prisma.ProductUpdateWithWhereUniqueWithoutBrandInput | Prisma.ProductUpdateWithWhereUniqueWithoutBrandInput[] + updateMany?: Prisma.ProductUpdateManyWithWhereWithoutBrandInput | Prisma.ProductUpdateManyWithWhereWithoutBrandInput[] deleteMany?: Prisma.ProductScalarWhereInput | Prisma.ProductScalarWhereInput[] } -export type ProductCreateWithoutProductInfoInput = { +export type ProductCreateNestedManyWithoutCategoryInput = { + create?: Prisma.XOR | Prisma.ProductCreateWithoutCategoryInput[] | Prisma.ProductUncheckedCreateWithoutCategoryInput[] + connectOrCreate?: Prisma.ProductCreateOrConnectWithoutCategoryInput | Prisma.ProductCreateOrConnectWithoutCategoryInput[] + createMany?: Prisma.ProductCreateManyCategoryInputEnvelope + connect?: Prisma.ProductWhereUniqueInput | Prisma.ProductWhereUniqueInput[] +} + +export type ProductUncheckedCreateNestedManyWithoutCategoryInput = { + create?: Prisma.XOR | Prisma.ProductCreateWithoutCategoryInput[] | Prisma.ProductUncheckedCreateWithoutCategoryInput[] + connectOrCreate?: Prisma.ProductCreateOrConnectWithoutCategoryInput | Prisma.ProductCreateOrConnectWithoutCategoryInput[] + createMany?: Prisma.ProductCreateManyCategoryInputEnvelope + connect?: Prisma.ProductWhereUniqueInput | Prisma.ProductWhereUniqueInput[] +} + +export type ProductUpdateManyWithoutCategoryNestedInput = { + create?: Prisma.XOR | Prisma.ProductCreateWithoutCategoryInput[] | Prisma.ProductUncheckedCreateWithoutCategoryInput[] + connectOrCreate?: Prisma.ProductCreateOrConnectWithoutCategoryInput | Prisma.ProductCreateOrConnectWithoutCategoryInput[] + upsert?: Prisma.ProductUpsertWithWhereUniqueWithoutCategoryInput | Prisma.ProductUpsertWithWhereUniqueWithoutCategoryInput[] + createMany?: Prisma.ProductCreateManyCategoryInputEnvelope + set?: Prisma.ProductWhereUniqueInput | Prisma.ProductWhereUniqueInput[] + disconnect?: Prisma.ProductWhereUniqueInput | Prisma.ProductWhereUniqueInput[] + delete?: Prisma.ProductWhereUniqueInput | Prisma.ProductWhereUniqueInput[] + connect?: Prisma.ProductWhereUniqueInput | Prisma.ProductWhereUniqueInput[] + update?: Prisma.ProductUpdateWithWhereUniqueWithoutCategoryInput | Prisma.ProductUpdateWithWhereUniqueWithoutCategoryInput[] + updateMany?: Prisma.ProductUpdateManyWithWhereWithoutCategoryInput | Prisma.ProductUpdateManyWithWhereWithoutCategoryInput[] + deleteMany?: Prisma.ProductScalarWhereInput | Prisma.ProductScalarWhereInput[] +} + +export type ProductUncheckedUpdateManyWithoutCategoryNestedInput = { + create?: Prisma.XOR | Prisma.ProductCreateWithoutCategoryInput[] | Prisma.ProductUncheckedCreateWithoutCategoryInput[] + connectOrCreate?: Prisma.ProductCreateOrConnectWithoutCategoryInput | Prisma.ProductCreateOrConnectWithoutCategoryInput[] + upsert?: Prisma.ProductUpsertWithWhereUniqueWithoutCategoryInput | Prisma.ProductUpsertWithWhereUniqueWithoutCategoryInput[] + createMany?: Prisma.ProductCreateManyCategoryInputEnvelope + set?: Prisma.ProductWhereUniqueInput | Prisma.ProductWhereUniqueInput[] + disconnect?: Prisma.ProductWhereUniqueInput | Prisma.ProductWhereUniqueInput[] + delete?: Prisma.ProductWhereUniqueInput | Prisma.ProductWhereUniqueInput[] + connect?: Prisma.ProductWhereUniqueInput | Prisma.ProductWhereUniqueInput[] + update?: Prisma.ProductUpdateWithWhereUniqueWithoutCategoryInput | Prisma.ProductUpdateWithWhereUniqueWithoutCategoryInput[] + updateMany?: Prisma.ProductUpdateManyWithWhereWithoutCategoryInput | Prisma.ProductUpdateManyWithWhereWithoutCategoryInput[] + deleteMany?: Prisma.ProductScalarWhereInput | Prisma.ProductScalarWhereInput[] +} + +export type ProductCreateWithoutVariantsInput = { name: string - description?: string | null - sku?: string | null barcode?: string | null - imageUrl?: string | null - attachmentId?: bigint | number | null - unit: string - discount?: runtime.Decimal | runtime.DecimalJsLike | number | string - quantity?: runtime.Decimal | runtime.DecimalJsLike | number | string - alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string - isActive?: boolean - isFeatured?: boolean - createdAt?: Date | string | null - updatedAt?: Date | string | null + sku?: string | null + description?: string | null + createdAt?: Date | string + updatedAt?: Date | string deletedAt?: Date | string | null + brand?: Prisma.ProductBrandCreateNestedOneWithoutProductsInput + category?: Prisma.ProductCategoryCreateNestedOneWithoutProductsInput } -export type ProductUncheckedCreateWithoutProductInfoInput = { +export type ProductUncheckedCreateWithoutVariantsInput = { id?: number name: string - description?: string | null - sku?: string | null barcode?: string | null - imageUrl?: string | null - attachmentId?: bigint | number | null - unit: string - discount?: runtime.Decimal | runtime.DecimalJsLike | number | string - quantity?: runtime.Decimal | runtime.DecimalJsLike | number | string - alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string - isActive?: boolean - isFeatured?: boolean - createdAt?: Date | string | null - updatedAt?: Date | string | null + sku?: string | null + description?: string | null + createdAt?: Date | string + updatedAt?: Date | string deletedAt?: Date | string | null + brandId?: number | null + categoryId?: number | null } -export type ProductCreateOrConnectWithoutProductInfoInput = { +export type ProductCreateOrConnectWithoutVariantsInput = { where: Prisma.ProductWhereUniqueInput - create: Prisma.XOR + create: Prisma.XOR } -export type ProductCreateManyProductInfoInputEnvelope = { - data: Prisma.ProductCreateManyProductInfoInput | Prisma.ProductCreateManyProductInfoInput[] +export type ProductUpsertWithoutVariantsInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.ProductWhereInput +} + +export type ProductUpdateToOneWithWhereWithoutVariantsInput = { + where?: Prisma.ProductWhereInput + data: Prisma.XOR +} + +export type ProductUpdateWithoutVariantsInput = { + name?: Prisma.StringFieldUpdateOperationsInput | string + barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + brand?: Prisma.ProductBrandUpdateOneWithoutProductsNestedInput + category?: Prisma.ProductCategoryUpdateOneWithoutProductsNestedInput +} + +export type ProductUncheckedUpdateWithoutVariantsInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + name?: Prisma.StringFieldUpdateOperationsInput | string + barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + brandId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + categoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null +} + +export type ProductCreateWithoutBrandInput = { + name: string + barcode?: string | null + sku?: string | null + description?: string | null + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + variants?: Prisma.ProductVariantCreateNestedManyWithoutProductInput + category?: Prisma.ProductCategoryCreateNestedOneWithoutProductsInput +} + +export type ProductUncheckedCreateWithoutBrandInput = { + id?: number + name: string + barcode?: string | null + sku?: string | null + description?: string | null + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + categoryId?: number | null + variants?: Prisma.ProductVariantUncheckedCreateNestedManyWithoutProductInput +} + +export type ProductCreateOrConnectWithoutBrandInput = { + where: Prisma.ProductWhereUniqueInput + create: Prisma.XOR +} + +export type ProductCreateManyBrandInputEnvelope = { + data: Prisma.ProductCreateManyBrandInput | Prisma.ProductCreateManyBrandInput[] skipDuplicates?: boolean } -export type ProductUpsertWithWhereUniqueWithoutProductInfoInput = { +export type ProductUpsertWithWhereUniqueWithoutBrandInput = { where: Prisma.ProductWhereUniqueInput - update: Prisma.XOR - create: Prisma.XOR + update: Prisma.XOR + create: Prisma.XOR } -export type ProductUpdateWithWhereUniqueWithoutProductInfoInput = { +export type ProductUpdateWithWhereUniqueWithoutBrandInput = { where: Prisma.ProductWhereUniqueInput - data: Prisma.XOR + data: Prisma.XOR } -export type ProductUpdateManyWithWhereWithoutProductInfoInput = { +export type ProductUpdateManyWithWhereWithoutBrandInput = { where: Prisma.ProductScalarWhereInput - data: Prisma.XOR + data: Prisma.XOR } export type ProductScalarWhereInput = { @@ -790,119 +730,211 @@ export type ProductScalarWhereInput = { NOT?: Prisma.ProductScalarWhereInput | Prisma.ProductScalarWhereInput[] id?: Prisma.IntFilter<"Product"> | number name?: Prisma.StringFilter<"Product"> | string - description?: Prisma.StringNullableFilter<"Product"> | string | null - sku?: Prisma.StringNullableFilter<"Product"> | string | null barcode?: Prisma.StringNullableFilter<"Product"> | string | null - imageUrl?: Prisma.StringNullableFilter<"Product"> | string | null - attachmentId?: Prisma.BigIntNullableFilter<"Product"> | bigint | number | null - unit?: Prisma.StringFilter<"Product"> | string - discount?: Prisma.DecimalFilter<"Product"> | runtime.Decimal | runtime.DecimalJsLike | number | string - quantity?: Prisma.DecimalFilter<"Product"> | runtime.Decimal | runtime.DecimalJsLike | number | string - alertQuantity?: Prisma.DecimalFilter<"Product"> | runtime.Decimal | runtime.DecimalJsLike | number | string - isActive?: Prisma.BoolFilter<"Product"> | boolean - isFeatured?: Prisma.BoolFilter<"Product"> | boolean - createdAt?: Prisma.DateTimeNullableFilter<"Product"> | Date | string | null - updatedAt?: Prisma.DateTimeNullableFilter<"Product"> | Date | string | null + sku?: Prisma.StringNullableFilter<"Product"> | string | null + description?: Prisma.StringNullableFilter<"Product"> | string | null + createdAt?: Prisma.DateTimeFilter<"Product"> | Date | string + updatedAt?: Prisma.DateTimeFilter<"Product"> | Date | string deletedAt?: Prisma.DateTimeNullableFilter<"Product"> | Date | string | null - productInfoId?: Prisma.IntFilter<"Product"> | number + brandId?: Prisma.IntNullableFilter<"Product"> | number | null + categoryId?: Prisma.IntNullableFilter<"Product"> | number | null } -export type ProductCreateManyProductInfoInput = { +export type ProductCreateWithoutCategoryInput = { + name: string + barcode?: string | null + sku?: string | null + description?: string | null + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + variants?: Prisma.ProductVariantCreateNestedManyWithoutProductInput + brand?: Prisma.ProductBrandCreateNestedOneWithoutProductsInput +} + +export type ProductUncheckedCreateWithoutCategoryInput = { id?: number name: string - description?: string | null - sku?: string | null barcode?: string | null - imageUrl?: string | null - attachmentId?: bigint | number | null - unit: string - discount?: runtime.Decimal | runtime.DecimalJsLike | number | string - quantity?: runtime.Decimal | runtime.DecimalJsLike | number | string - alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string - isActive?: boolean - isFeatured?: boolean - createdAt?: Date | string | null - updatedAt?: Date | string | null + sku?: string | null + description?: string | null + createdAt?: Date | string + updatedAt?: Date | string deletedAt?: Date | string | null + brandId?: number | null + variants?: Prisma.ProductVariantUncheckedCreateNestedManyWithoutProductInput } -export type ProductUpdateWithoutProductInfoInput = { +export type ProductCreateOrConnectWithoutCategoryInput = { + where: Prisma.ProductWhereUniqueInput + create: Prisma.XOR +} + +export type ProductCreateManyCategoryInputEnvelope = { + data: Prisma.ProductCreateManyCategoryInput | Prisma.ProductCreateManyCategoryInput[] + skipDuplicates?: boolean +} + +export type ProductUpsertWithWhereUniqueWithoutCategoryInput = { + where: Prisma.ProductWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type ProductUpdateWithWhereUniqueWithoutCategoryInput = { + where: Prisma.ProductWhereUniqueInput + data: Prisma.XOR +} + +export type ProductUpdateManyWithWhereWithoutCategoryInput = { + where: Prisma.ProductScalarWhereInput + data: Prisma.XOR +} + +export type ProductCreateManyBrandInput = { + id?: number + name: string + barcode?: string | null + sku?: string | null + description?: string | null + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + categoryId?: number | null +} + +export type ProductUpdateWithoutBrandInput = { name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - imageUrl?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - attachmentId?: Prisma.NullableBigIntFieldUpdateOperationsInput | bigint | number | null - unit?: Prisma.StringFieldUpdateOperationsInput | string - discount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - alertQuantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean - isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean - createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + variants?: Prisma.ProductVariantUpdateManyWithoutProductNestedInput + category?: Prisma.ProductCategoryUpdateOneWithoutProductsNestedInput } -export type ProductUncheckedUpdateWithoutProductInfoInput = { +export type ProductUncheckedUpdateWithoutBrandInput = { id?: Prisma.IntFieldUpdateOperationsInput | number name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - imageUrl?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - attachmentId?: Prisma.NullableBigIntFieldUpdateOperationsInput | bigint | number | null - unit?: Prisma.StringFieldUpdateOperationsInput | string - discount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - alertQuantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean - isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean - createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + categoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + variants?: Prisma.ProductVariantUncheckedUpdateManyWithoutProductNestedInput } -export type ProductUncheckedUpdateManyWithoutProductInfoInput = { +export type ProductUncheckedUpdateManyWithoutBrandInput = { id?: Prisma.IntFieldUpdateOperationsInput | number name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - imageUrl?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - attachmentId?: Prisma.NullableBigIntFieldUpdateOperationsInput | bigint | number | null - unit?: Prisma.StringFieldUpdateOperationsInput | string - discount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - alertQuantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean - isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean - createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + categoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null } +export type ProductCreateManyCategoryInput = { + id?: number + name: string + barcode?: string | null + sku?: string | null + description?: string | null + createdAt?: Date | string + updatedAt?: Date | string + deletedAt?: Date | string | null + brandId?: number | null +} + +export type ProductUpdateWithoutCategoryInput = { + name?: Prisma.StringFieldUpdateOperationsInput | string + barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + variants?: Prisma.ProductVariantUpdateManyWithoutProductNestedInput + brand?: Prisma.ProductBrandUpdateOneWithoutProductsNestedInput +} + +export type ProductUncheckedUpdateWithoutCategoryInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + name?: Prisma.StringFieldUpdateOperationsInput | string + barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + brandId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null + variants?: Prisma.ProductVariantUncheckedUpdateManyWithoutProductNestedInput +} + +export type ProductUncheckedUpdateManyWithoutCategoryInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + name?: Prisma.StringFieldUpdateOperationsInput | string + barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + brandId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null +} + + +/** + * Count Type ProductCountOutputType + */ + +export type ProductCountOutputType = { + variants: number +} + +export type ProductCountOutputTypeSelect = { + variants?: boolean | ProductCountOutputTypeCountVariantsArgs +} + +/** + * ProductCountOutputType without action + */ +export type ProductCountOutputTypeDefaultArgs = { + /** + * Select specific fields to fetch from the ProductCountOutputType + */ + select?: Prisma.ProductCountOutputTypeSelect | null +} + +/** + * ProductCountOutputType without action + */ +export type ProductCountOutputTypeCountVariantsArgs = { + where?: Prisma.ProductVariantWhereInput +} export type ProductSelect = runtime.Types.Extensions.GetSelect<{ id?: boolean name?: boolean - description?: boolean - sku?: boolean barcode?: boolean - imageUrl?: boolean - attachmentId?: boolean - unit?: boolean - discount?: boolean - quantity?: boolean - alertQuantity?: boolean - isActive?: boolean - isFeatured?: boolean + sku?: boolean + description?: boolean createdAt?: boolean updatedAt?: boolean deletedAt?: boolean - productInfoId?: boolean - productInfo?: boolean | Prisma.ProductInfoDefaultArgs + brandId?: boolean + categoryId?: boolean + variants?: boolean | Prisma.Product$variantsArgs + brand?: boolean | Prisma.Product$brandArgs + category?: boolean | Prisma.Product$categoryArgs + _count?: boolean | Prisma.ProductCountOutputTypeDefaultArgs }, ExtArgs["result"]["product"]> @@ -910,51 +942,42 @@ export type ProductSelect = runtime.Types.Extensions.GetOmit<"id" | "name" | "description" | "sku" | "barcode" | "imageUrl" | "attachmentId" | "unit" | "discount" | "quantity" | "alertQuantity" | "isActive" | "isFeatured" | "createdAt" | "updatedAt" | "deletedAt" | "productInfoId", ExtArgs["result"]["product"]> +export type ProductOmit = runtime.Types.Extensions.GetOmit<"id" | "name" | "barcode" | "sku" | "description" | "createdAt" | "updatedAt" | "deletedAt" | "brandId" | "categoryId", ExtArgs["result"]["product"]> export type ProductInclude = { - productInfo?: boolean | Prisma.ProductInfoDefaultArgs + variants?: boolean | Prisma.Product$variantsArgs + brand?: boolean | Prisma.Product$brandArgs + category?: boolean | Prisma.Product$categoryArgs + _count?: boolean | Prisma.ProductCountOutputTypeDefaultArgs } export type $ProductPayload = { name: "Product" objects: { - productInfo: Prisma.$ProductInfoPayload + variants: Prisma.$ProductVariantPayload[] + brand: Prisma.$ProductBrandPayload | null + category: Prisma.$ProductCategoryPayload | null } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: number name: string - description: string | null - sku: string | null barcode: string | null - imageUrl: string | null - attachmentId: bigint | null - unit: string - discount: runtime.Decimal - quantity: runtime.Decimal - alertQuantity: runtime.Decimal - isActive: boolean - isFeatured: boolean - createdAt: Date | null - updatedAt: Date | null + sku: string | null + description: string | null + createdAt: Date + updatedAt: Date deletedAt: Date | null - productInfoId: number + brandId: number | null + categoryId: number | null }, ExtArgs["result"]["product"]> composites: {} } @@ -1295,7 +1318,9 @@ readonly fields: ProductFieldRefs; */ export interface Prisma__ProductClient extends Prisma.PrismaPromise { readonly [Symbol.toStringTag]: "PrismaPromise" - productInfo = {}>(args?: Prisma.Subset>): Prisma.Prisma__ProductInfoClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + variants = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> + brand = {}>(args?: Prisma.Subset>): Prisma.Prisma__ProductBrandClient, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + category = {}>(args?: Prisma.Subset>): Prisma.Prisma__ProductCategoryClient, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> /** * Attaches callbacks for the resolution and/or rejection of the Promise. * @param onfulfilled The callback to execute when the Promise is resolved. @@ -1327,21 +1352,14 @@ export interface Prisma__ProductClient readonly name: Prisma.FieldRef<"Product", 'String'> - readonly description: Prisma.FieldRef<"Product", 'String'> - readonly sku: Prisma.FieldRef<"Product", 'String'> readonly barcode: Prisma.FieldRef<"Product", 'String'> - readonly imageUrl: Prisma.FieldRef<"Product", 'String'> - readonly attachmentId: Prisma.FieldRef<"Product", 'BigInt'> - readonly unit: Prisma.FieldRef<"Product", 'String'> - readonly discount: Prisma.FieldRef<"Product", 'Decimal'> - readonly quantity: Prisma.FieldRef<"Product", 'Decimal'> - readonly alertQuantity: Prisma.FieldRef<"Product", 'Decimal'> - readonly isActive: Prisma.FieldRef<"Product", 'Boolean'> - readonly isFeatured: Prisma.FieldRef<"Product", 'Boolean'> + readonly sku: Prisma.FieldRef<"Product", 'String'> + readonly description: Prisma.FieldRef<"Product", 'String'> readonly createdAt: Prisma.FieldRef<"Product", 'DateTime'> readonly updatedAt: Prisma.FieldRef<"Product", 'DateTime'> readonly deletedAt: Prisma.FieldRef<"Product", 'DateTime'> - readonly productInfoId: Prisma.FieldRef<"Product", 'Int'> + readonly brandId: Prisma.FieldRef<"Product", 'Int'> + readonly categoryId: Prisma.FieldRef<"Product", 'Int'> } @@ -1684,6 +1702,68 @@ export type ProductDeleteManyArgs = { + /** + * Select specific fields to fetch from the ProductVariant + */ + select?: Prisma.ProductVariantSelect | null + /** + * Omit specific fields from the ProductVariant + */ + omit?: Prisma.ProductVariantOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProductVariantInclude | null + where?: Prisma.ProductVariantWhereInput + orderBy?: Prisma.ProductVariantOrderByWithRelationInput | Prisma.ProductVariantOrderByWithRelationInput[] + cursor?: Prisma.ProductVariantWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.ProductVariantScalarFieldEnum | Prisma.ProductVariantScalarFieldEnum[] +} + +/** + * Product.brand + */ +export type Product$brandArgs = { + /** + * Select specific fields to fetch from the ProductBrand + */ + select?: Prisma.ProductBrandSelect | null + /** + * Omit specific fields from the ProductBrand + */ + omit?: Prisma.ProductBrandOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProductBrandInclude | null + where?: Prisma.ProductBrandWhereInput +} + +/** + * Product.category + */ +export type Product$categoryArgs = { + /** + * Select specific fields to fetch from the ProductCategory + */ + select?: Prisma.ProductCategorySelect | null + /** + * Omit specific fields from the ProductCategory + */ + omit?: Prisma.ProductCategoryOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProductCategoryInclude | null + where?: Prisma.ProductCategoryWhereInput +} + /** * Product without action */ diff --git a/src/generated/prisma/models/ProductBrand.ts b/src/generated/prisma/models/ProductBrand.ts index c9d76ae..b07467f 100644 --- a/src/generated/prisma/models/ProductBrand.ts +++ b/src/generated/prisma/models/ProductBrand.ts @@ -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 - connectOrCreate?: Prisma.ProductBrandCreateOrConnectWithoutProductInfoInput +export type ProductBrandCreateNestedOneWithoutProductsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ProductBrandCreateOrConnectWithoutProductsInput connect?: Prisma.ProductBrandWhereUniqueInput } -export type ProductBrandUpdateOneWithoutProductInfoNestedInput = { - create?: Prisma.XOR - connectOrCreate?: Prisma.ProductBrandCreateOrConnectWithoutProductInfoInput - upsert?: Prisma.ProductBrandUpsertWithoutProductInfoInput +export type ProductBrandUpdateOneWithoutProductsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ProductBrandCreateOrConnectWithoutProductsInput + upsert?: Prisma.ProductBrandUpsertWithoutProductsInput disconnect?: Prisma.ProductBrandWhereInput | boolean delete?: Prisma.ProductBrandWhereInput | boolean connect?: Prisma.ProductBrandWhereUniqueInput - update?: Prisma.XOR, Prisma.ProductBrandUncheckedUpdateWithoutProductInfoInput> + update?: Prisma.XOR, 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 + create: Prisma.XOR } -export type ProductBrandUpsertWithoutProductInfoInput = { - update: Prisma.XOR - create: Prisma.XOR +export type ProductBrandUpsertWithoutProductsInput = { + update: Prisma.XOR + create: Prisma.XOR where?: Prisma.ProductBrandWhereInput } -export type ProductBrandUpdateToOneWithWhereWithoutProductInfoInput = { +export type ProductBrandUpdateToOneWithWhereWithoutProductsInput = { where?: Prisma.ProductBrandWhereInput - data: Prisma.XOR + data: Prisma.XOR } -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 = { - productInfo?: boolean | ProductBrandCountOutputTypeCountProductInfoArgs + products?: boolean | ProductBrandCountOutputTypeCountProductsArgs } /** @@ -505,8 +505,8 @@ export type ProductBrandCountOutputTypeDefaultArgs = { - where?: Prisma.ProductInfoWhereInput +export type ProductBrandCountOutputTypeCountProductsArgs = { + where?: Prisma.ProductWhereInput } @@ -518,7 +518,7 @@ export type ProductBrandSelect + products?: boolean | Prisma.ProductBrand$productsArgs _count?: boolean | Prisma.ProductBrandCountOutputTypeDefaultArgs }, ExtArgs["result"]["productBrand"]> @@ -536,14 +536,14 @@ export type ProductBrandSelectScalar = { export type ProductBrandOmit = runtime.Types.Extensions.GetOmit<"id" | "name" | "description" | "imageUrl" | "createdAt" | "updatedAt" | "deletedAt", ExtArgs["result"]["productBrand"]> export type ProductBrandInclude = { - productInfo?: boolean | Prisma.ProductBrand$productInfoArgs + products?: boolean | Prisma.ProductBrand$productsArgs _count?: boolean | Prisma.ProductBrandCountOutputTypeDefaultArgs } export type $ProductBrandPayload = { name: "ProductBrand" objects: { - productInfo: Prisma.$ProductInfoPayload[] + products: Prisma.$ProductPayload[] } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: number @@ -893,7 +893,7 @@ readonly fields: ProductBrandFieldRefs; */ export interface Prisma__ProductBrandClient extends Prisma.PrismaPromise { readonly [Symbol.toStringTag]: "PrismaPromise" - productInfo = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> + products = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, 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 = { +export type ProductBrand$productsArgs = { /** - * Select specific fields to fetch from the ProductInfo + * Select specific fields to fetch from the Product */ - select?: Prisma.ProductInfoSelect | null + select?: Prisma.ProductSelect | null /** - * Omit specific fields from the ProductInfo + * Omit specific fields from the Product */ - omit?: Prisma.ProductInfoOmit | null + omit?: Prisma.ProductOmit | null /** * Choose, which related nodes to fetch as well */ - include?: Prisma.ProductInfoInclude | null - where?: Prisma.ProductInfoWhereInput - orderBy?: Prisma.ProductInfoOrderByWithRelationInput | Prisma.ProductInfoOrderByWithRelationInput[] - cursor?: Prisma.ProductInfoWhereUniqueInput + include?: Prisma.ProductInclude | 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[] } /** diff --git a/src/generated/prisma/models/ProductCategory.ts b/src/generated/prisma/models/ProductCategory.ts index 70c1075..d0a1247 100644 --- a/src/generated/prisma/models/ProductCategory.ts +++ b/src/generated/prisma/models/ProductCategory.ts @@ -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 - connectOrCreate?: Prisma.ProductCategoryCreateOrConnectWithoutProductInfoInput +export type ProductCategoryCreateNestedOneWithoutProductsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ProductCategoryCreateOrConnectWithoutProductsInput connect?: Prisma.ProductCategoryWhereUniqueInput } -export type ProductCategoryUpdateOneWithoutProductInfoNestedInput = { - create?: Prisma.XOR - connectOrCreate?: Prisma.ProductCategoryCreateOrConnectWithoutProductInfoInput - upsert?: Prisma.ProductCategoryUpsertWithoutProductInfoInput +export type ProductCategoryUpdateOneWithoutProductsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.ProductCategoryCreateOrConnectWithoutProductsInput + upsert?: Prisma.ProductCategoryUpsertWithoutProductsInput disconnect?: Prisma.ProductCategoryWhereInput | boolean delete?: Prisma.ProductCategoryWhereInput | boolean connect?: Prisma.ProductCategoryWhereUniqueInput - update?: Prisma.XOR, Prisma.ProductCategoryUncheckedUpdateWithoutProductInfoInput> + update?: Prisma.XOR, 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 + create: Prisma.XOR } -export type ProductCategoryUpsertWithoutProductInfoInput = { - update: Prisma.XOR - create: Prisma.XOR +export type ProductCategoryUpsertWithoutProductsInput = { + update: Prisma.XOR + create: Prisma.XOR where?: Prisma.ProductCategoryWhereInput } -export type ProductCategoryUpdateToOneWithWhereWithoutProductInfoInput = { +export type ProductCategoryUpdateToOneWithWhereWithoutProductsInput = { where?: Prisma.ProductCategoryWhereInput - data: Prisma.XOR + data: Prisma.XOR } -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 = { - productInfo?: boolean | ProductCategoryCountOutputTypeCountProductInfoArgs + products?: boolean | ProductCategoryCountOutputTypeCountProductsArgs } /** @@ -505,8 +505,8 @@ export type ProductCategoryCountOutputTypeDefaultArgs = { - where?: Prisma.ProductInfoWhereInput +export type ProductCategoryCountOutputTypeCountProductsArgs = { + where?: Prisma.ProductWhereInput } @@ -518,7 +518,7 @@ export type ProductCategorySelect + products?: boolean | Prisma.ProductCategory$productsArgs _count?: boolean | Prisma.ProductCategoryCountOutputTypeDefaultArgs }, ExtArgs["result"]["productCategory"]> @@ -536,14 +536,14 @@ export type ProductCategorySelectScalar = { export type ProductCategoryOmit = runtime.Types.Extensions.GetOmit<"id" | "name" | "description" | "imageUrl" | "createdAt" | "updatedAt" | "deletedAt", ExtArgs["result"]["productCategory"]> export type ProductCategoryInclude = { - productInfo?: boolean | Prisma.ProductCategory$productInfoArgs + products?: boolean | Prisma.ProductCategory$productsArgs _count?: boolean | Prisma.ProductCategoryCountOutputTypeDefaultArgs } export type $ProductCategoryPayload = { name: "ProductCategory" objects: { - productInfo: Prisma.$ProductInfoPayload[] + products: Prisma.$ProductPayload[] } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: number @@ -893,7 +893,7 @@ readonly fields: ProductCategoryFieldRefs; */ export interface Prisma__ProductCategoryClient extends Prisma.PrismaPromise { readonly [Symbol.toStringTag]: "PrismaPromise" - productInfo = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> + products = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, 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 = { +export type ProductCategory$productsArgs = { /** - * Select specific fields to fetch from the ProductInfo + * Select specific fields to fetch from the Product */ - select?: Prisma.ProductInfoSelect | null + select?: Prisma.ProductSelect | null /** - * Omit specific fields from the ProductInfo + * Omit specific fields from the Product */ - omit?: Prisma.ProductInfoOmit | null + omit?: Prisma.ProductOmit | null /** * Choose, which related nodes to fetch as well */ - include?: Prisma.ProductInfoInclude | null - where?: Prisma.ProductInfoWhereInput - orderBy?: Prisma.ProductInfoOrderByWithRelationInput | Prisma.ProductInfoOrderByWithRelationInput[] - cursor?: Prisma.ProductInfoWhereUniqueInput + include?: Prisma.ProductInclude | 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[] } /** diff --git a/src/generated/prisma/models/ProductInfo.ts b/src/generated/prisma/models/ProductInfo.ts deleted file mode 100644 index fbef700..0000000 --- a/src/generated/prisma/models/ProductInfo.ts +++ /dev/null @@ -1,1980 +0,0 @@ - -/* !!! This is code generated by Prisma. Do not edit directly. !!! */ -/* eslint-disable */ -// biome-ignore-all lint: generated file -// @ts-nocheck -/* - * This file exports the `ProductInfo` model and its related types. - * - * 🟢 You can import this file directly. - */ -import type * as runtime from "@prisma/client/runtime/client" -import type * as $Enums from "../enums.js" -import type * as Prisma from "../internal/prismaNamespace.js" - -/** - * Model ProductInfo - * - */ -export type ProductInfoModel = runtime.Types.Result.DefaultSelection - -export type AggregateProductInfo = { - _count: ProductInfoCountAggregateOutputType | null - _avg: ProductInfoAvgAggregateOutputType | null - _sum: ProductInfoSumAggregateOutputType | null - _min: ProductInfoMinAggregateOutputType | null - _max: ProductInfoMaxAggregateOutputType | null -} - -export type ProductInfoAvgAggregateOutputType = { - id: number | null - brandId: number | null - categoryId: number | null - supplierId: number | null -} - -export type ProductInfoSumAggregateOutputType = { - id: number | null - brandId: number | null - categoryId: number | null - supplierId: number | null -} - -export type ProductInfoMinAggregateOutputType = { - id: number | null - name: string | null - description: string | null - productType: string | null - createdAt: Date | null - updatedAt: Date | null - deletedAt: Date | null - brandId: number | null - categoryId: number | null - supplierId: number | null -} - -export type ProductInfoMaxAggregateOutputType = { - id: number | null - name: string | null - description: string | null - productType: string | null - createdAt: Date | null - updatedAt: Date | null - deletedAt: Date | null - brandId: number | null - categoryId: number | null - supplierId: number | null -} - -export type ProductInfoCountAggregateOutputType = { - id: number - name: number - description: number - productType: number - metaData: number - createdAt: number - updatedAt: number - deletedAt: number - brandId: number - categoryId: number - supplierId: number - _all: number -} - - -export type ProductInfoAvgAggregateInputType = { - id?: true - brandId?: true - categoryId?: true - supplierId?: true -} - -export type ProductInfoSumAggregateInputType = { - id?: true - brandId?: true - categoryId?: true - supplierId?: true -} - -export type ProductInfoMinAggregateInputType = { - id?: true - name?: true - description?: true - productType?: true - createdAt?: true - updatedAt?: true - deletedAt?: true - brandId?: true - categoryId?: true - supplierId?: true -} - -export type ProductInfoMaxAggregateInputType = { - id?: true - name?: true - description?: true - productType?: true - createdAt?: true - updatedAt?: true - deletedAt?: true - brandId?: true - categoryId?: true - supplierId?: true -} - -export type ProductInfoCountAggregateInputType = { - id?: true - name?: true - description?: true - productType?: true - metaData?: true - createdAt?: true - updatedAt?: true - deletedAt?: true - brandId?: true - categoryId?: true - supplierId?: true - _all?: true -} - -export type ProductInfoAggregateArgs = { - /** - * Filter which ProductInfo to aggregate. - */ - where?: Prisma.ProductInfoWhereInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} - * - * Determine the order of ProductInfos to fetch. - */ - orderBy?: Prisma.ProductInfoOrderByWithRelationInput | Prisma.ProductInfoOrderByWithRelationInput[] - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} - * - * Sets the start position - */ - cursor?: Prisma.ProductInfoWhereUniqueInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Take `±n` ProductInfos from the position of the cursor. - */ - take?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Skip the first `n` ProductInfos. - */ - skip?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Count returned ProductInfos - **/ - _count?: true | ProductInfoCountAggregateInputType - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Select which fields to average - **/ - _avg?: ProductInfoAvgAggregateInputType - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Select which fields to sum - **/ - _sum?: ProductInfoSumAggregateInputType - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Select which fields to find the minimum value - **/ - _min?: ProductInfoMinAggregateInputType - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} - * - * Select which fields to find the maximum value - **/ - _max?: ProductInfoMaxAggregateInputType -} - -export type GetProductInfoAggregateType = { - [P in keyof T & keyof AggregateProductInfo]: P extends '_count' | 'count' - ? T[P] extends true - ? number - : Prisma.GetScalarType - : Prisma.GetScalarType -} - - - - -export type ProductInfoGroupByArgs = { - where?: Prisma.ProductInfoWhereInput - orderBy?: Prisma.ProductInfoOrderByWithAggregationInput | Prisma.ProductInfoOrderByWithAggregationInput[] - by: Prisma.ProductInfoScalarFieldEnum[] | Prisma.ProductInfoScalarFieldEnum - having?: Prisma.ProductInfoScalarWhereWithAggregatesInput - take?: number - skip?: number - _count?: ProductInfoCountAggregateInputType | true - _avg?: ProductInfoAvgAggregateInputType - _sum?: ProductInfoSumAggregateInputType - _min?: ProductInfoMinAggregateInputType - _max?: ProductInfoMaxAggregateInputType -} - -export type ProductInfoGroupByOutputType = { - id: number - name: string - description: string | null - productType: string | null - metaData: runtime.JsonValue | null - createdAt: Date - updatedAt: Date - deletedAt: Date | null - brandId: number | null - categoryId: number | null - supplierId: number - _count: ProductInfoCountAggregateOutputType | null - _avg: ProductInfoAvgAggregateOutputType | null - _sum: ProductInfoSumAggregateOutputType | null - _min: ProductInfoMinAggregateOutputType | null - _max: ProductInfoMaxAggregateOutputType | null -} - -type GetProductInfoGroupByPayload = Prisma.PrismaPromise< - Array< - Prisma.PickEnumerable & - { - [P in ((keyof T) & (keyof ProductInfoGroupByOutputType))]: P extends '_count' - ? T[P] extends boolean - ? number - : Prisma.GetScalarType - : Prisma.GetScalarType - } - > - > - - - -export type ProductInfoWhereInput = { - AND?: Prisma.ProductInfoWhereInput | Prisma.ProductInfoWhereInput[] - OR?: Prisma.ProductInfoWhereInput[] - NOT?: Prisma.ProductInfoWhereInput | Prisma.ProductInfoWhereInput[] - id?: Prisma.IntFilter<"ProductInfo"> | number - name?: Prisma.StringFilter<"ProductInfo"> | string - description?: Prisma.StringNullableFilter<"ProductInfo"> | string | null - productType?: Prisma.StringNullableFilter<"ProductInfo"> | string | null - metaData?: Prisma.JsonNullableFilter<"ProductInfo"> - createdAt?: Prisma.DateTimeFilter<"ProductInfo"> | Date | string - updatedAt?: Prisma.DateTimeFilter<"ProductInfo"> | Date | string - deletedAt?: Prisma.DateTimeNullableFilter<"ProductInfo"> | Date | string | null - brandId?: Prisma.IntNullableFilter<"ProductInfo"> | number | null - categoryId?: Prisma.IntNullableFilter<"ProductInfo"> | number | null - supplierId?: Prisma.IntFilter<"ProductInfo"> | number - products?: Prisma.ProductListRelationFilter - brand?: Prisma.XOR | null - category?: Prisma.XOR | null - supplier?: Prisma.XOR -} - -export type ProductInfoOrderByWithRelationInput = { - id?: Prisma.SortOrder - name?: Prisma.SortOrder - description?: Prisma.SortOrderInput | Prisma.SortOrder - productType?: Prisma.SortOrderInput | Prisma.SortOrder - metaData?: Prisma.SortOrderInput | Prisma.SortOrder - createdAt?: Prisma.SortOrder - updatedAt?: Prisma.SortOrder - deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder - brandId?: Prisma.SortOrderInput | Prisma.SortOrder - categoryId?: Prisma.SortOrderInput | Prisma.SortOrder - supplierId?: Prisma.SortOrder - products?: Prisma.ProductOrderByRelationAggregateInput - brand?: Prisma.ProductBrandOrderByWithRelationInput - category?: Prisma.ProductCategoryOrderByWithRelationInput - supplier?: Prisma.SupplierOrderByWithRelationInput - _relevance?: Prisma.ProductInfoOrderByRelevanceInput -} - -export type ProductInfoWhereUniqueInput = Prisma.AtLeast<{ - id?: number - AND?: Prisma.ProductInfoWhereInput | Prisma.ProductInfoWhereInput[] - OR?: Prisma.ProductInfoWhereInput[] - NOT?: Prisma.ProductInfoWhereInput | Prisma.ProductInfoWhereInput[] - name?: Prisma.StringFilter<"ProductInfo"> | string - description?: Prisma.StringNullableFilter<"ProductInfo"> | string | null - productType?: Prisma.StringNullableFilter<"ProductInfo"> | string | null - metaData?: Prisma.JsonNullableFilter<"ProductInfo"> - createdAt?: Prisma.DateTimeFilter<"ProductInfo"> | Date | string - updatedAt?: Prisma.DateTimeFilter<"ProductInfo"> | Date | string - deletedAt?: Prisma.DateTimeNullableFilter<"ProductInfo"> | Date | string | null - brandId?: Prisma.IntNullableFilter<"ProductInfo"> | number | null - categoryId?: Prisma.IntNullableFilter<"ProductInfo"> | number | null - supplierId?: Prisma.IntFilter<"ProductInfo"> | number - products?: Prisma.ProductListRelationFilter - brand?: Prisma.XOR | null - category?: Prisma.XOR | null - supplier?: Prisma.XOR -}, "id"> - -export type ProductInfoOrderByWithAggregationInput = { - id?: Prisma.SortOrder - name?: Prisma.SortOrder - description?: Prisma.SortOrderInput | Prisma.SortOrder - productType?: Prisma.SortOrderInput | Prisma.SortOrder - metaData?: Prisma.SortOrderInput | Prisma.SortOrder - createdAt?: Prisma.SortOrder - updatedAt?: Prisma.SortOrder - deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder - brandId?: Prisma.SortOrderInput | Prisma.SortOrder - categoryId?: Prisma.SortOrderInput | Prisma.SortOrder - supplierId?: Prisma.SortOrder - _count?: Prisma.ProductInfoCountOrderByAggregateInput - _avg?: Prisma.ProductInfoAvgOrderByAggregateInput - _max?: Prisma.ProductInfoMaxOrderByAggregateInput - _min?: Prisma.ProductInfoMinOrderByAggregateInput - _sum?: Prisma.ProductInfoSumOrderByAggregateInput -} - -export type ProductInfoScalarWhereWithAggregatesInput = { - AND?: Prisma.ProductInfoScalarWhereWithAggregatesInput | Prisma.ProductInfoScalarWhereWithAggregatesInput[] - OR?: Prisma.ProductInfoScalarWhereWithAggregatesInput[] - NOT?: Prisma.ProductInfoScalarWhereWithAggregatesInput | Prisma.ProductInfoScalarWhereWithAggregatesInput[] - id?: Prisma.IntWithAggregatesFilter<"ProductInfo"> | number - name?: Prisma.StringWithAggregatesFilter<"ProductInfo"> | string - description?: Prisma.StringNullableWithAggregatesFilter<"ProductInfo"> | string | null - productType?: Prisma.StringNullableWithAggregatesFilter<"ProductInfo"> | string | null - metaData?: Prisma.JsonNullableWithAggregatesFilter<"ProductInfo"> - createdAt?: Prisma.DateTimeWithAggregatesFilter<"ProductInfo"> | Date | string - updatedAt?: Prisma.DateTimeWithAggregatesFilter<"ProductInfo"> | Date | string - deletedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"ProductInfo"> | Date | string | null - brandId?: Prisma.IntNullableWithAggregatesFilter<"ProductInfo"> | number | null - categoryId?: Prisma.IntNullableWithAggregatesFilter<"ProductInfo"> | number | null - supplierId?: Prisma.IntWithAggregatesFilter<"ProductInfo"> | number -} - -export type ProductInfoCreateInput = { - name: string - description?: string | null - productType?: string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Date | string - updatedAt?: Date | string - deletedAt?: Date | string | null - products?: Prisma.ProductCreateNestedManyWithoutProductInfoInput - brand?: Prisma.ProductBrandCreateNestedOneWithoutProductInfoInput - category?: Prisma.ProductCategoryCreateNestedOneWithoutProductInfoInput - supplier: Prisma.SupplierCreateNestedOneWithoutProductInfoInput -} - -export type ProductInfoUncheckedCreateInput = { - id?: number - name: string - description?: string | null - productType?: string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Date | string - updatedAt?: Date | string - deletedAt?: Date | string | null - brandId?: number | null - categoryId?: number | null - supplierId: number - products?: Prisma.ProductUncheckedCreateNestedManyWithoutProductInfoInput -} - -export type ProductInfoUpdateInput = { - name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - productType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - products?: Prisma.ProductUpdateManyWithoutProductInfoNestedInput - brand?: Prisma.ProductBrandUpdateOneWithoutProductInfoNestedInput - category?: Prisma.ProductCategoryUpdateOneWithoutProductInfoNestedInput - supplier?: Prisma.SupplierUpdateOneRequiredWithoutProductInfoNestedInput -} - -export type ProductInfoUncheckedUpdateInput = { - id?: Prisma.IntFieldUpdateOperationsInput | number - name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - productType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - brandId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - categoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - supplierId?: Prisma.IntFieldUpdateOperationsInput | number - products?: Prisma.ProductUncheckedUpdateManyWithoutProductInfoNestedInput -} - -export type ProductInfoCreateManyInput = { - id?: number - name: string - description?: string | null - productType?: string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Date | string - updatedAt?: Date | string - deletedAt?: Date | string | null - brandId?: number | null - categoryId?: number | null - supplierId: number -} - -export type ProductInfoUpdateManyMutationInput = { - name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - productType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null -} - -export type ProductInfoUncheckedUpdateManyInput = { - id?: Prisma.IntFieldUpdateOperationsInput | number - name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - productType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - brandId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - categoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - supplierId?: Prisma.IntFieldUpdateOperationsInput | number -} - -export type ProductInfoScalarRelationFilter = { - is?: Prisma.ProductInfoWhereInput - isNot?: Prisma.ProductInfoWhereInput -} - -export type ProductInfoOrderByRelevanceInput = { - fields: Prisma.ProductInfoOrderByRelevanceFieldEnum | Prisma.ProductInfoOrderByRelevanceFieldEnum[] - sort: Prisma.SortOrder - search: string -} - -export type ProductInfoCountOrderByAggregateInput = { - id?: Prisma.SortOrder - name?: Prisma.SortOrder - description?: Prisma.SortOrder - productType?: Prisma.SortOrder - metaData?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - updatedAt?: Prisma.SortOrder - deletedAt?: Prisma.SortOrder - brandId?: Prisma.SortOrder - categoryId?: Prisma.SortOrder - supplierId?: Prisma.SortOrder -} - -export type ProductInfoAvgOrderByAggregateInput = { - id?: Prisma.SortOrder - brandId?: Prisma.SortOrder - categoryId?: Prisma.SortOrder - supplierId?: Prisma.SortOrder -} - -export type ProductInfoMaxOrderByAggregateInput = { - id?: Prisma.SortOrder - name?: Prisma.SortOrder - description?: Prisma.SortOrder - productType?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - updatedAt?: Prisma.SortOrder - deletedAt?: Prisma.SortOrder - brandId?: Prisma.SortOrder - categoryId?: Prisma.SortOrder - supplierId?: Prisma.SortOrder -} - -export type ProductInfoMinOrderByAggregateInput = { - id?: Prisma.SortOrder - name?: Prisma.SortOrder - description?: Prisma.SortOrder - productType?: Prisma.SortOrder - createdAt?: Prisma.SortOrder - updatedAt?: Prisma.SortOrder - deletedAt?: Prisma.SortOrder - brandId?: Prisma.SortOrder - categoryId?: Prisma.SortOrder - supplierId?: Prisma.SortOrder -} - -export type ProductInfoSumOrderByAggregateInput = { - id?: Prisma.SortOrder - brandId?: Prisma.SortOrder - categoryId?: Prisma.SortOrder - supplierId?: Prisma.SortOrder -} - -export type ProductInfoListRelationFilter = { - every?: Prisma.ProductInfoWhereInput - some?: Prisma.ProductInfoWhereInput - none?: Prisma.ProductInfoWhereInput -} - -export type ProductInfoOrderByRelationAggregateInput = { - _count?: Prisma.SortOrder -} - -export type ProductInfoCreateNestedOneWithoutProductsInput = { - create?: Prisma.XOR - connectOrCreate?: Prisma.ProductInfoCreateOrConnectWithoutProductsInput - connect?: Prisma.ProductInfoWhereUniqueInput -} - -export type ProductInfoUpdateOneRequiredWithoutProductsNestedInput = { - create?: Prisma.XOR - connectOrCreate?: Prisma.ProductInfoCreateOrConnectWithoutProductsInput - upsert?: Prisma.ProductInfoUpsertWithoutProductsInput - connect?: Prisma.ProductInfoWhereUniqueInput - update?: Prisma.XOR, Prisma.ProductInfoUncheckedUpdateWithoutProductsInput> -} - -export type NullableIntFieldUpdateOperationsInput = { - set?: number | null - increment?: number - decrement?: number - multiply?: number - divide?: number -} - -export type ProductInfoCreateNestedManyWithoutBrandInput = { - create?: Prisma.XOR | Prisma.ProductInfoCreateWithoutBrandInput[] | Prisma.ProductInfoUncheckedCreateWithoutBrandInput[] - connectOrCreate?: Prisma.ProductInfoCreateOrConnectWithoutBrandInput | Prisma.ProductInfoCreateOrConnectWithoutBrandInput[] - createMany?: Prisma.ProductInfoCreateManyBrandInputEnvelope - connect?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] -} - -export type ProductInfoUncheckedCreateNestedManyWithoutBrandInput = { - create?: Prisma.XOR | Prisma.ProductInfoCreateWithoutBrandInput[] | Prisma.ProductInfoUncheckedCreateWithoutBrandInput[] - connectOrCreate?: Prisma.ProductInfoCreateOrConnectWithoutBrandInput | Prisma.ProductInfoCreateOrConnectWithoutBrandInput[] - createMany?: Prisma.ProductInfoCreateManyBrandInputEnvelope - connect?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] -} - -export type ProductInfoUpdateManyWithoutBrandNestedInput = { - create?: Prisma.XOR | Prisma.ProductInfoCreateWithoutBrandInput[] | Prisma.ProductInfoUncheckedCreateWithoutBrandInput[] - connectOrCreate?: Prisma.ProductInfoCreateOrConnectWithoutBrandInput | Prisma.ProductInfoCreateOrConnectWithoutBrandInput[] - upsert?: Prisma.ProductInfoUpsertWithWhereUniqueWithoutBrandInput | Prisma.ProductInfoUpsertWithWhereUniqueWithoutBrandInput[] - createMany?: Prisma.ProductInfoCreateManyBrandInputEnvelope - set?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - disconnect?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - delete?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - connect?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - update?: Prisma.ProductInfoUpdateWithWhereUniqueWithoutBrandInput | Prisma.ProductInfoUpdateWithWhereUniqueWithoutBrandInput[] - updateMany?: Prisma.ProductInfoUpdateManyWithWhereWithoutBrandInput | Prisma.ProductInfoUpdateManyWithWhereWithoutBrandInput[] - deleteMany?: Prisma.ProductInfoScalarWhereInput | Prisma.ProductInfoScalarWhereInput[] -} - -export type ProductInfoUncheckedUpdateManyWithoutBrandNestedInput = { - create?: Prisma.XOR | Prisma.ProductInfoCreateWithoutBrandInput[] | Prisma.ProductInfoUncheckedCreateWithoutBrandInput[] - connectOrCreate?: Prisma.ProductInfoCreateOrConnectWithoutBrandInput | Prisma.ProductInfoCreateOrConnectWithoutBrandInput[] - upsert?: Prisma.ProductInfoUpsertWithWhereUniqueWithoutBrandInput | Prisma.ProductInfoUpsertWithWhereUniqueWithoutBrandInput[] - createMany?: Prisma.ProductInfoCreateManyBrandInputEnvelope - set?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - disconnect?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - delete?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - connect?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - update?: Prisma.ProductInfoUpdateWithWhereUniqueWithoutBrandInput | Prisma.ProductInfoUpdateWithWhereUniqueWithoutBrandInput[] - updateMany?: Prisma.ProductInfoUpdateManyWithWhereWithoutBrandInput | Prisma.ProductInfoUpdateManyWithWhereWithoutBrandInput[] - deleteMany?: Prisma.ProductInfoScalarWhereInput | Prisma.ProductInfoScalarWhereInput[] -} - -export type ProductInfoCreateNestedManyWithoutCategoryInput = { - create?: Prisma.XOR | Prisma.ProductInfoCreateWithoutCategoryInput[] | Prisma.ProductInfoUncheckedCreateWithoutCategoryInput[] - connectOrCreate?: Prisma.ProductInfoCreateOrConnectWithoutCategoryInput | Prisma.ProductInfoCreateOrConnectWithoutCategoryInput[] - createMany?: Prisma.ProductInfoCreateManyCategoryInputEnvelope - connect?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] -} - -export type ProductInfoUncheckedCreateNestedManyWithoutCategoryInput = { - create?: Prisma.XOR | Prisma.ProductInfoCreateWithoutCategoryInput[] | Prisma.ProductInfoUncheckedCreateWithoutCategoryInput[] - connectOrCreate?: Prisma.ProductInfoCreateOrConnectWithoutCategoryInput | Prisma.ProductInfoCreateOrConnectWithoutCategoryInput[] - createMany?: Prisma.ProductInfoCreateManyCategoryInputEnvelope - connect?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] -} - -export type ProductInfoUpdateManyWithoutCategoryNestedInput = { - create?: Prisma.XOR | Prisma.ProductInfoCreateWithoutCategoryInput[] | Prisma.ProductInfoUncheckedCreateWithoutCategoryInput[] - connectOrCreate?: Prisma.ProductInfoCreateOrConnectWithoutCategoryInput | Prisma.ProductInfoCreateOrConnectWithoutCategoryInput[] - upsert?: Prisma.ProductInfoUpsertWithWhereUniqueWithoutCategoryInput | Prisma.ProductInfoUpsertWithWhereUniqueWithoutCategoryInput[] - createMany?: Prisma.ProductInfoCreateManyCategoryInputEnvelope - set?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - disconnect?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - delete?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - connect?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - update?: Prisma.ProductInfoUpdateWithWhereUniqueWithoutCategoryInput | Prisma.ProductInfoUpdateWithWhereUniqueWithoutCategoryInput[] - updateMany?: Prisma.ProductInfoUpdateManyWithWhereWithoutCategoryInput | Prisma.ProductInfoUpdateManyWithWhereWithoutCategoryInput[] - deleteMany?: Prisma.ProductInfoScalarWhereInput | Prisma.ProductInfoScalarWhereInput[] -} - -export type ProductInfoUncheckedUpdateManyWithoutCategoryNestedInput = { - create?: Prisma.XOR | Prisma.ProductInfoCreateWithoutCategoryInput[] | Prisma.ProductInfoUncheckedCreateWithoutCategoryInput[] - connectOrCreate?: Prisma.ProductInfoCreateOrConnectWithoutCategoryInput | Prisma.ProductInfoCreateOrConnectWithoutCategoryInput[] - upsert?: Prisma.ProductInfoUpsertWithWhereUniqueWithoutCategoryInput | Prisma.ProductInfoUpsertWithWhereUniqueWithoutCategoryInput[] - createMany?: Prisma.ProductInfoCreateManyCategoryInputEnvelope - set?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - disconnect?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - delete?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - connect?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - update?: Prisma.ProductInfoUpdateWithWhereUniqueWithoutCategoryInput | Prisma.ProductInfoUpdateWithWhereUniqueWithoutCategoryInput[] - updateMany?: Prisma.ProductInfoUpdateManyWithWhereWithoutCategoryInput | Prisma.ProductInfoUpdateManyWithWhereWithoutCategoryInput[] - deleteMany?: Prisma.ProductInfoScalarWhereInput | Prisma.ProductInfoScalarWhereInput[] -} - -export type ProductInfoCreateNestedManyWithoutSupplierInput = { - create?: Prisma.XOR | Prisma.ProductInfoCreateWithoutSupplierInput[] | Prisma.ProductInfoUncheckedCreateWithoutSupplierInput[] - connectOrCreate?: Prisma.ProductInfoCreateOrConnectWithoutSupplierInput | Prisma.ProductInfoCreateOrConnectWithoutSupplierInput[] - createMany?: Prisma.ProductInfoCreateManySupplierInputEnvelope - connect?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] -} - -export type ProductInfoUncheckedCreateNestedManyWithoutSupplierInput = { - create?: Prisma.XOR | Prisma.ProductInfoCreateWithoutSupplierInput[] | Prisma.ProductInfoUncheckedCreateWithoutSupplierInput[] - connectOrCreate?: Prisma.ProductInfoCreateOrConnectWithoutSupplierInput | Prisma.ProductInfoCreateOrConnectWithoutSupplierInput[] - createMany?: Prisma.ProductInfoCreateManySupplierInputEnvelope - connect?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] -} - -export type ProductInfoUpdateManyWithoutSupplierNestedInput = { - create?: Prisma.XOR | Prisma.ProductInfoCreateWithoutSupplierInput[] | Prisma.ProductInfoUncheckedCreateWithoutSupplierInput[] - connectOrCreate?: Prisma.ProductInfoCreateOrConnectWithoutSupplierInput | Prisma.ProductInfoCreateOrConnectWithoutSupplierInput[] - upsert?: Prisma.ProductInfoUpsertWithWhereUniqueWithoutSupplierInput | Prisma.ProductInfoUpsertWithWhereUniqueWithoutSupplierInput[] - createMany?: Prisma.ProductInfoCreateManySupplierInputEnvelope - set?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - disconnect?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - delete?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - connect?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - update?: Prisma.ProductInfoUpdateWithWhereUniqueWithoutSupplierInput | Prisma.ProductInfoUpdateWithWhereUniqueWithoutSupplierInput[] - updateMany?: Prisma.ProductInfoUpdateManyWithWhereWithoutSupplierInput | Prisma.ProductInfoUpdateManyWithWhereWithoutSupplierInput[] - deleteMany?: Prisma.ProductInfoScalarWhereInput | Prisma.ProductInfoScalarWhereInput[] -} - -export type ProductInfoUncheckedUpdateManyWithoutSupplierNestedInput = { - create?: Prisma.XOR | Prisma.ProductInfoCreateWithoutSupplierInput[] | Prisma.ProductInfoUncheckedCreateWithoutSupplierInput[] - connectOrCreate?: Prisma.ProductInfoCreateOrConnectWithoutSupplierInput | Prisma.ProductInfoCreateOrConnectWithoutSupplierInput[] - upsert?: Prisma.ProductInfoUpsertWithWhereUniqueWithoutSupplierInput | Prisma.ProductInfoUpsertWithWhereUniqueWithoutSupplierInput[] - createMany?: Prisma.ProductInfoCreateManySupplierInputEnvelope - set?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - disconnect?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - delete?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - connect?: Prisma.ProductInfoWhereUniqueInput | Prisma.ProductInfoWhereUniqueInput[] - update?: Prisma.ProductInfoUpdateWithWhereUniqueWithoutSupplierInput | Prisma.ProductInfoUpdateWithWhereUniqueWithoutSupplierInput[] - updateMany?: Prisma.ProductInfoUpdateManyWithWhereWithoutSupplierInput | Prisma.ProductInfoUpdateManyWithWhereWithoutSupplierInput[] - deleteMany?: Prisma.ProductInfoScalarWhereInput | Prisma.ProductInfoScalarWhereInput[] -} - -export type ProductInfoCreateWithoutProductsInput = { - name: string - description?: string | null - productType?: string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Date | string - updatedAt?: Date | string - deletedAt?: Date | string | null - brand?: Prisma.ProductBrandCreateNestedOneWithoutProductInfoInput - category?: Prisma.ProductCategoryCreateNestedOneWithoutProductInfoInput - supplier: Prisma.SupplierCreateNestedOneWithoutProductInfoInput -} - -export type ProductInfoUncheckedCreateWithoutProductsInput = { - id?: number - name: string - description?: string | null - productType?: string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Date | string - updatedAt?: Date | string - deletedAt?: Date | string | null - brandId?: number | null - categoryId?: number | null - supplierId: number -} - -export type ProductInfoCreateOrConnectWithoutProductsInput = { - where: Prisma.ProductInfoWhereUniqueInput - create: Prisma.XOR -} - -export type ProductInfoUpsertWithoutProductsInput = { - update: Prisma.XOR - create: Prisma.XOR - where?: Prisma.ProductInfoWhereInput -} - -export type ProductInfoUpdateToOneWithWhereWithoutProductsInput = { - where?: Prisma.ProductInfoWhereInput - data: Prisma.XOR -} - -export type ProductInfoUpdateWithoutProductsInput = { - name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - productType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - brand?: Prisma.ProductBrandUpdateOneWithoutProductInfoNestedInput - category?: Prisma.ProductCategoryUpdateOneWithoutProductInfoNestedInput - supplier?: Prisma.SupplierUpdateOneRequiredWithoutProductInfoNestedInput -} - -export type ProductInfoUncheckedUpdateWithoutProductsInput = { - id?: Prisma.IntFieldUpdateOperationsInput | number - name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - productType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - brandId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - categoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - supplierId?: Prisma.IntFieldUpdateOperationsInput | number -} - -export type ProductInfoCreateWithoutBrandInput = { - name: string - description?: string | null - productType?: string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Date | string - updatedAt?: Date | string - deletedAt?: Date | string | null - products?: Prisma.ProductCreateNestedManyWithoutProductInfoInput - category?: Prisma.ProductCategoryCreateNestedOneWithoutProductInfoInput - supplier: Prisma.SupplierCreateNestedOneWithoutProductInfoInput -} - -export type ProductInfoUncheckedCreateWithoutBrandInput = { - id?: number - name: string - description?: string | null - productType?: string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Date | string - updatedAt?: Date | string - deletedAt?: Date | string | null - categoryId?: number | null - supplierId: number - products?: Prisma.ProductUncheckedCreateNestedManyWithoutProductInfoInput -} - -export type ProductInfoCreateOrConnectWithoutBrandInput = { - where: Prisma.ProductInfoWhereUniqueInput - create: Prisma.XOR -} - -export type ProductInfoCreateManyBrandInputEnvelope = { - data: Prisma.ProductInfoCreateManyBrandInput | Prisma.ProductInfoCreateManyBrandInput[] - skipDuplicates?: boolean -} - -export type ProductInfoUpsertWithWhereUniqueWithoutBrandInput = { - where: Prisma.ProductInfoWhereUniqueInput - update: Prisma.XOR - create: Prisma.XOR -} - -export type ProductInfoUpdateWithWhereUniqueWithoutBrandInput = { - where: Prisma.ProductInfoWhereUniqueInput - data: Prisma.XOR -} - -export type ProductInfoUpdateManyWithWhereWithoutBrandInput = { - where: Prisma.ProductInfoScalarWhereInput - data: Prisma.XOR -} - -export type ProductInfoScalarWhereInput = { - AND?: Prisma.ProductInfoScalarWhereInput | Prisma.ProductInfoScalarWhereInput[] - OR?: Prisma.ProductInfoScalarWhereInput[] - NOT?: Prisma.ProductInfoScalarWhereInput | Prisma.ProductInfoScalarWhereInput[] - id?: Prisma.IntFilter<"ProductInfo"> | number - name?: Prisma.StringFilter<"ProductInfo"> | string - description?: Prisma.StringNullableFilter<"ProductInfo"> | string | null - productType?: Prisma.StringNullableFilter<"ProductInfo"> | string | null - metaData?: Prisma.JsonNullableFilter<"ProductInfo"> - createdAt?: Prisma.DateTimeFilter<"ProductInfo"> | Date | string - updatedAt?: Prisma.DateTimeFilter<"ProductInfo"> | Date | string - deletedAt?: Prisma.DateTimeNullableFilter<"ProductInfo"> | Date | string | null - brandId?: Prisma.IntNullableFilter<"ProductInfo"> | number | null - categoryId?: Prisma.IntNullableFilter<"ProductInfo"> | number | null - supplierId?: Prisma.IntFilter<"ProductInfo"> | number -} - -export type ProductInfoCreateWithoutCategoryInput = { - name: string - description?: string | null - productType?: string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Date | string - updatedAt?: Date | string - deletedAt?: Date | string | null - products?: Prisma.ProductCreateNestedManyWithoutProductInfoInput - brand?: Prisma.ProductBrandCreateNestedOneWithoutProductInfoInput - supplier: Prisma.SupplierCreateNestedOneWithoutProductInfoInput -} - -export type ProductInfoUncheckedCreateWithoutCategoryInput = { - id?: number - name: string - description?: string | null - productType?: string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Date | string - updatedAt?: Date | string - deletedAt?: Date | string | null - brandId?: number | null - supplierId: number - products?: Prisma.ProductUncheckedCreateNestedManyWithoutProductInfoInput -} - -export type ProductInfoCreateOrConnectWithoutCategoryInput = { - where: Prisma.ProductInfoWhereUniqueInput - create: Prisma.XOR -} - -export type ProductInfoCreateManyCategoryInputEnvelope = { - data: Prisma.ProductInfoCreateManyCategoryInput | Prisma.ProductInfoCreateManyCategoryInput[] - skipDuplicates?: boolean -} - -export type ProductInfoUpsertWithWhereUniqueWithoutCategoryInput = { - where: Prisma.ProductInfoWhereUniqueInput - update: Prisma.XOR - create: Prisma.XOR -} - -export type ProductInfoUpdateWithWhereUniqueWithoutCategoryInput = { - where: Prisma.ProductInfoWhereUniqueInput - data: Prisma.XOR -} - -export type ProductInfoUpdateManyWithWhereWithoutCategoryInput = { - where: Prisma.ProductInfoScalarWhereInput - data: Prisma.XOR -} - -export type ProductInfoCreateWithoutSupplierInput = { - name: string - description?: string | null - productType?: string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Date | string - updatedAt?: Date | string - deletedAt?: Date | string | null - products?: Prisma.ProductCreateNestedManyWithoutProductInfoInput - brand?: Prisma.ProductBrandCreateNestedOneWithoutProductInfoInput - category?: Prisma.ProductCategoryCreateNestedOneWithoutProductInfoInput -} - -export type ProductInfoUncheckedCreateWithoutSupplierInput = { - id?: number - name: string - description?: string | null - productType?: string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Date | string - updatedAt?: Date | string - deletedAt?: Date | string | null - brandId?: number | null - categoryId?: number | null - products?: Prisma.ProductUncheckedCreateNestedManyWithoutProductInfoInput -} - -export type ProductInfoCreateOrConnectWithoutSupplierInput = { - where: Prisma.ProductInfoWhereUniqueInput - create: Prisma.XOR -} - -export type ProductInfoCreateManySupplierInputEnvelope = { - data: Prisma.ProductInfoCreateManySupplierInput | Prisma.ProductInfoCreateManySupplierInput[] - skipDuplicates?: boolean -} - -export type ProductInfoUpsertWithWhereUniqueWithoutSupplierInput = { - where: Prisma.ProductInfoWhereUniqueInput - update: Prisma.XOR - create: Prisma.XOR -} - -export type ProductInfoUpdateWithWhereUniqueWithoutSupplierInput = { - where: Prisma.ProductInfoWhereUniqueInput - data: Prisma.XOR -} - -export type ProductInfoUpdateManyWithWhereWithoutSupplierInput = { - where: Prisma.ProductInfoScalarWhereInput - data: Prisma.XOR -} - -export type ProductInfoCreateManyBrandInput = { - id?: number - name: string - description?: string | null - productType?: string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Date | string - updatedAt?: Date | string - deletedAt?: Date | string | null - categoryId?: number | null - supplierId: number -} - -export type ProductInfoUpdateWithoutBrandInput = { - name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - productType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - products?: Prisma.ProductUpdateManyWithoutProductInfoNestedInput - category?: Prisma.ProductCategoryUpdateOneWithoutProductInfoNestedInput - supplier?: Prisma.SupplierUpdateOneRequiredWithoutProductInfoNestedInput -} - -export type ProductInfoUncheckedUpdateWithoutBrandInput = { - id?: Prisma.IntFieldUpdateOperationsInput | number - name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - productType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - categoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - supplierId?: Prisma.IntFieldUpdateOperationsInput | number - products?: Prisma.ProductUncheckedUpdateManyWithoutProductInfoNestedInput -} - -export type ProductInfoUncheckedUpdateManyWithoutBrandInput = { - id?: Prisma.IntFieldUpdateOperationsInput | number - name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - productType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - categoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - supplierId?: Prisma.IntFieldUpdateOperationsInput | number -} - -export type ProductInfoCreateManyCategoryInput = { - id?: number - name: string - description?: string | null - productType?: string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Date | string - updatedAt?: Date | string - deletedAt?: Date | string | null - brandId?: number | null - supplierId: number -} - -export type ProductInfoUpdateWithoutCategoryInput = { - name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - productType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - products?: Prisma.ProductUpdateManyWithoutProductInfoNestedInput - brand?: Prisma.ProductBrandUpdateOneWithoutProductInfoNestedInput - supplier?: Prisma.SupplierUpdateOneRequiredWithoutProductInfoNestedInput -} - -export type ProductInfoUncheckedUpdateWithoutCategoryInput = { - id?: Prisma.IntFieldUpdateOperationsInput | number - name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - productType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - brandId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - supplierId?: Prisma.IntFieldUpdateOperationsInput | number - products?: Prisma.ProductUncheckedUpdateManyWithoutProductInfoNestedInput -} - -export type ProductInfoUncheckedUpdateManyWithoutCategoryInput = { - id?: Prisma.IntFieldUpdateOperationsInput | number - name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - productType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - brandId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - supplierId?: Prisma.IntFieldUpdateOperationsInput | number -} - -export type ProductInfoCreateManySupplierInput = { - id?: number - name: string - description?: string | null - productType?: string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Date | string - updatedAt?: Date | string - deletedAt?: Date | string | null - brandId?: number | null - categoryId?: number | null -} - -export type ProductInfoUpdateWithoutSupplierInput = { - name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - productType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - products?: Prisma.ProductUpdateManyWithoutProductInfoNestedInput - brand?: Prisma.ProductBrandUpdateOneWithoutProductInfoNestedInput - category?: Prisma.ProductCategoryUpdateOneWithoutProductInfoNestedInput -} - -export type ProductInfoUncheckedUpdateWithoutSupplierInput = { - id?: Prisma.IntFieldUpdateOperationsInput | number - name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - productType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - brandId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - categoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - products?: Prisma.ProductUncheckedUpdateManyWithoutProductInfoNestedInput -} - -export type ProductInfoUncheckedUpdateManyWithoutSupplierInput = { - id?: Prisma.IntFieldUpdateOperationsInput | number - name?: Prisma.StringFieldUpdateOperationsInput | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - productType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - metaData?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue - createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null - brandId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null - categoryId?: Prisma.NullableIntFieldUpdateOperationsInput | number | null -} - - -/** - * Count Type ProductInfoCountOutputType - */ - -export type ProductInfoCountOutputType = { - products: number -} - -export type ProductInfoCountOutputTypeSelect = { - products?: boolean | ProductInfoCountOutputTypeCountProductsArgs -} - -/** - * ProductInfoCountOutputType without action - */ -export type ProductInfoCountOutputTypeDefaultArgs = { - /** - * Select specific fields to fetch from the ProductInfoCountOutputType - */ - select?: Prisma.ProductInfoCountOutputTypeSelect | null -} - -/** - * ProductInfoCountOutputType without action - */ -export type ProductInfoCountOutputTypeCountProductsArgs = { - where?: Prisma.ProductWhereInput -} - - -export type ProductInfoSelect = runtime.Types.Extensions.GetSelect<{ - id?: boolean - name?: boolean - description?: boolean - productType?: boolean - metaData?: boolean - createdAt?: boolean - updatedAt?: boolean - deletedAt?: boolean - brandId?: boolean - categoryId?: boolean - supplierId?: boolean - products?: boolean | Prisma.ProductInfo$productsArgs - brand?: boolean | Prisma.ProductInfo$brandArgs - category?: boolean | Prisma.ProductInfo$categoryArgs - supplier?: boolean | Prisma.SupplierDefaultArgs - _count?: boolean | Prisma.ProductInfoCountOutputTypeDefaultArgs -}, ExtArgs["result"]["productInfo"]> - - - -export type ProductInfoSelectScalar = { - id?: boolean - name?: boolean - description?: boolean - productType?: boolean - metaData?: boolean - createdAt?: boolean - updatedAt?: boolean - deletedAt?: boolean - brandId?: boolean - categoryId?: boolean - supplierId?: boolean -} - -export type ProductInfoOmit = runtime.Types.Extensions.GetOmit<"id" | "name" | "description" | "productType" | "metaData" | "createdAt" | "updatedAt" | "deletedAt" | "brandId" | "categoryId" | "supplierId", ExtArgs["result"]["productInfo"]> -export type ProductInfoInclude = { - products?: boolean | Prisma.ProductInfo$productsArgs - brand?: boolean | Prisma.ProductInfo$brandArgs - category?: boolean | Prisma.ProductInfo$categoryArgs - supplier?: boolean | Prisma.SupplierDefaultArgs - _count?: boolean | Prisma.ProductInfoCountOutputTypeDefaultArgs -} - -export type $ProductInfoPayload = { - name: "ProductInfo" - objects: { - products: Prisma.$ProductPayload[] - brand: Prisma.$ProductBrandPayload | null - category: Prisma.$ProductCategoryPayload | null - supplier: Prisma.$SupplierPayload - } - scalars: runtime.Types.Extensions.GetPayloadResult<{ - id: number - name: string - description: string | null - productType: string | null - metaData: runtime.JsonValue | null - createdAt: Date - updatedAt: Date - deletedAt: Date | null - brandId: number | null - categoryId: number | null - supplierId: number - }, ExtArgs["result"]["productInfo"]> - composites: {} -} - -export type ProductInfoGetPayload = runtime.Types.Result.GetResult - -export type ProductInfoCountArgs = - Omit & { - select?: ProductInfoCountAggregateInputType | true - } - -export interface ProductInfoDelegate { - [K: symbol]: { types: Prisma.TypeMap['model']['ProductInfo'], meta: { name: 'ProductInfo' } } - /** - * Find zero or one ProductInfo that matches the filter. - * @param {ProductInfoFindUniqueArgs} args - Arguments to find a ProductInfo - * @example - * // Get one ProductInfo - * const productInfo = await prisma.productInfo.findUnique({ - * where: { - * // ... provide filter here - * } - * }) - */ - findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__ProductInfoClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> - - /** - * Find one ProductInfo that matches the filter or throw an error with `error.code='P2025'` - * if no matches were found. - * @param {ProductInfoFindUniqueOrThrowArgs} args - Arguments to find a ProductInfo - * @example - * // Get one ProductInfo - * const productInfo = await prisma.productInfo.findUniqueOrThrow({ - * where: { - * // ... provide filter here - * } - * }) - */ - findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__ProductInfoClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Find the first ProductInfo that matches the filter. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {ProductInfoFindFirstArgs} args - Arguments to find a ProductInfo - * @example - * // Get one ProductInfo - * const productInfo = await prisma.productInfo.findFirst({ - * where: { - * // ... provide filter here - * } - * }) - */ - findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__ProductInfoClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> - - /** - * Find the first ProductInfo that matches the filter or - * throw `PrismaKnownClientError` with `P2025` code if no matches were found. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {ProductInfoFindFirstOrThrowArgs} args - Arguments to find a ProductInfo - * @example - * // Get one ProductInfo - * const productInfo = await prisma.productInfo.findFirstOrThrow({ - * where: { - * // ... provide filter here - * } - * }) - */ - findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__ProductInfoClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Find zero or more ProductInfos that matches the filter. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {ProductInfoFindManyArgs} args - Arguments to filter and select certain fields only. - * @example - * // Get all ProductInfos - * const productInfos = await prisma.productInfo.findMany() - * - * // Get first 10 ProductInfos - * const productInfos = await prisma.productInfo.findMany({ take: 10 }) - * - * // Only select the `id` - * const productInfoWithIdOnly = await prisma.productInfo.findMany({ select: { id: true } }) - * - */ - findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> - - /** - * Create a ProductInfo. - * @param {ProductInfoCreateArgs} args - Arguments to create a ProductInfo. - * @example - * // Create one ProductInfo - * const ProductInfo = await prisma.productInfo.create({ - * data: { - * // ... data to create a ProductInfo - * } - * }) - * - */ - create(args: Prisma.SelectSubset>): Prisma.Prisma__ProductInfoClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Create many ProductInfos. - * @param {ProductInfoCreateManyArgs} args - Arguments to create many ProductInfos. - * @example - * // Create many ProductInfos - * const productInfo = await prisma.productInfo.createMany({ - * data: [ - * // ... provide data here - * ] - * }) - * - */ - createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise - - /** - * Delete a ProductInfo. - * @param {ProductInfoDeleteArgs} args - Arguments to delete one ProductInfo. - * @example - * // Delete one ProductInfo - * const ProductInfo = await prisma.productInfo.delete({ - * where: { - * // ... filter to delete one ProductInfo - * } - * }) - * - */ - delete(args: Prisma.SelectSubset>): Prisma.Prisma__ProductInfoClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Update one ProductInfo. - * @param {ProductInfoUpdateArgs} args - Arguments to update one ProductInfo. - * @example - * // Update one ProductInfo - * const productInfo = await prisma.productInfo.update({ - * where: { - * // ... provide filter here - * }, - * data: { - * // ... provide data here - * } - * }) - * - */ - update(args: Prisma.SelectSubset>): Prisma.Prisma__ProductInfoClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - /** - * Delete zero or more ProductInfos. - * @param {ProductInfoDeleteManyArgs} args - Arguments to filter ProductInfos to delete. - * @example - * // Delete a few ProductInfos - * const { count } = await prisma.productInfo.deleteMany({ - * where: { - * // ... provide filter here - * } - * }) - * - */ - deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise - - /** - * Update zero or more ProductInfos. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {ProductInfoUpdateManyArgs} args - Arguments to update one or more rows. - * @example - * // Update many ProductInfos - * const productInfo = await prisma.productInfo.updateMany({ - * where: { - * // ... provide filter here - * }, - * data: { - * // ... provide data here - * } - * }) - * - */ - updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise - - /** - * Create or update one ProductInfo. - * @param {ProductInfoUpsertArgs} args - Arguments to update or create a ProductInfo. - * @example - * // Update or create a ProductInfo - * const productInfo = await prisma.productInfo.upsert({ - * create: { - * // ... data to create a ProductInfo - * }, - * update: { - * // ... in case it already exists, update - * }, - * where: { - * // ... the filter for the ProductInfo we want to update - * } - * }) - */ - upsert(args: Prisma.SelectSubset>): Prisma.Prisma__ProductInfoClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> - - - /** - * Count the number of ProductInfos. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {ProductInfoCountArgs} args - Arguments to filter ProductInfos to count. - * @example - * // Count the number of ProductInfos - * const count = await prisma.productInfo.count({ - * where: { - * // ... the filter for the ProductInfos we want to count - * } - * }) - **/ - count( - args?: Prisma.Subset, - ): Prisma.PrismaPromise< - T extends runtime.Types.Utils.Record<'select', any> - ? T['select'] extends true - ? number - : Prisma.GetScalarType - : number - > - - /** - * Allows you to perform aggregations operations on a ProductInfo. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {ProductInfoAggregateArgs} args - Select which aggregations you would like to apply and on what fields. - * @example - * // Ordered by age ascending - * // Where email contains prisma.io - * // Limited to the 10 users - * const aggregations = await prisma.user.aggregate({ - * _avg: { - * age: true, - * }, - * where: { - * email: { - * contains: "prisma.io", - * }, - * }, - * orderBy: { - * age: "asc", - * }, - * take: 10, - * }) - **/ - aggregate(args: Prisma.Subset): Prisma.PrismaPromise> - - /** - * Group by ProductInfo. - * Note, that providing `undefined` is treated as the value not being there. - * Read more here: https://pris.ly/d/null-undefined - * @param {ProductInfoGroupByArgs} args - Group by arguments. - * @example - * // Group by city, order by createdAt, get count - * const result = await prisma.user.groupBy({ - * by: ['city', 'createdAt'], - * orderBy: { - * createdAt: true - * }, - * _count: { - * _all: true - * }, - * }) - * - **/ - groupBy< - T extends ProductInfoGroupByArgs, - HasSelectOrTake extends Prisma.Or< - Prisma.Extends<'skip', Prisma.Keys>, - Prisma.Extends<'take', Prisma.Keys> - >, - OrderByArg extends Prisma.True extends HasSelectOrTake - ? { orderBy: ProductInfoGroupByArgs['orderBy'] } - : { orderBy?: ProductInfoGroupByArgs['orderBy'] }, - OrderFields extends Prisma.ExcludeUnderscoreKeys>>, - ByFields extends Prisma.MaybeTupleToUnion, - ByValid extends Prisma.Has, - HavingFields extends Prisma.GetHavingFields, - HavingValid extends Prisma.Has, - ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False, - InputErrors extends ByEmpty extends Prisma.True - ? `Error: "by" must not be empty.` - : HavingValid extends Prisma.False - ? { - [P in HavingFields]: P extends ByFields - ? never - : P extends string - ? `Error: Field "${P}" used in "having" needs to be provided in "by".` - : [ - Error, - 'Field ', - P, - ` in "having" needs to be provided in "by"`, - ] - }[HavingFields] - : 'take' extends Prisma.Keys - ? 'orderBy' extends Prisma.Keys - ? ByValid extends Prisma.True - ? {} - : { - [P in OrderFields]: P extends ByFields - ? never - : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` - }[OrderFields] - : 'Error: If you provide "take", you also need to provide "orderBy"' - : 'skip' extends Prisma.Keys - ? 'orderBy' extends Prisma.Keys - ? ByValid extends Prisma.True - ? {} - : { - [P in OrderFields]: P extends ByFields - ? never - : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` - }[OrderFields] - : 'Error: If you provide "skip", you also need to provide "orderBy"' - : ByValid extends Prisma.True - ? {} - : { - [P in OrderFields]: P extends ByFields - ? never - : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` - }[OrderFields] - >(args: Prisma.SubsetIntersection & InputErrors): {} extends InputErrors ? GetProductInfoGroupByPayload : Prisma.PrismaPromise -/** - * Fields of the ProductInfo model - */ -readonly fields: ProductInfoFieldRefs; -} - -/** - * The delegate class that acts as a "Promise-like" for ProductInfo. - * Why is this prefixed with `Prisma__`? - * Because we want to prevent naming conflicts as mentioned in - * https://github.com/prisma/prisma-client-js/issues/707 - */ -export interface Prisma__ProductInfoClient extends Prisma.PrismaPromise { - readonly [Symbol.toStringTag]: "PrismaPromise" - products = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> - brand = {}>(args?: Prisma.Subset>): Prisma.Prisma__ProductBrandClient, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> - category = {}>(args?: Prisma.Subset>): Prisma.Prisma__ProductCategoryClient, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> - supplier = {}>(args?: Prisma.Subset>): Prisma.Prisma__SupplierClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise - /** - * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The - * resolved value cannot be modified from the callback. - * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). - * @returns A Promise for the completion of the callback. - */ - finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise -} - - - - -/** - * Fields of the ProductInfo model - */ -export interface ProductInfoFieldRefs { - readonly id: Prisma.FieldRef<"ProductInfo", 'Int'> - readonly name: Prisma.FieldRef<"ProductInfo", 'String'> - readonly description: Prisma.FieldRef<"ProductInfo", 'String'> - readonly productType: Prisma.FieldRef<"ProductInfo", 'String'> - readonly metaData: Prisma.FieldRef<"ProductInfo", 'Json'> - readonly createdAt: Prisma.FieldRef<"ProductInfo", 'DateTime'> - readonly updatedAt: Prisma.FieldRef<"ProductInfo", 'DateTime'> - readonly deletedAt: Prisma.FieldRef<"ProductInfo", 'DateTime'> - readonly brandId: Prisma.FieldRef<"ProductInfo", 'Int'> - readonly categoryId: Prisma.FieldRef<"ProductInfo", 'Int'> - readonly supplierId: Prisma.FieldRef<"ProductInfo", 'Int'> -} - - -// Custom InputTypes -/** - * ProductInfo findUnique - */ -export type ProductInfoFindUniqueArgs = { - /** - * Select specific fields to fetch from the ProductInfo - */ - select?: Prisma.ProductInfoSelect | null - /** - * Omit specific fields from the ProductInfo - */ - omit?: Prisma.ProductInfoOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ProductInfoInclude | null - /** - * Filter, which ProductInfo to fetch. - */ - where: Prisma.ProductInfoWhereUniqueInput -} - -/** - * ProductInfo findUniqueOrThrow - */ -export type ProductInfoFindUniqueOrThrowArgs = { - /** - * Select specific fields to fetch from the ProductInfo - */ - select?: Prisma.ProductInfoSelect | null - /** - * Omit specific fields from the ProductInfo - */ - omit?: Prisma.ProductInfoOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ProductInfoInclude | null - /** - * Filter, which ProductInfo to fetch. - */ - where: Prisma.ProductInfoWhereUniqueInput -} - -/** - * ProductInfo findFirst - */ -export type ProductInfoFindFirstArgs = { - /** - * Select specific fields to fetch from the ProductInfo - */ - select?: Prisma.ProductInfoSelect | null - /** - * Omit specific fields from the ProductInfo - */ - omit?: Prisma.ProductInfoOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ProductInfoInclude | null - /** - * Filter, which ProductInfo to fetch. - */ - where?: Prisma.ProductInfoWhereInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} - * - * Determine the order of ProductInfos to fetch. - */ - orderBy?: Prisma.ProductInfoOrderByWithRelationInput | Prisma.ProductInfoOrderByWithRelationInput[] - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} - * - * Sets the position for searching for ProductInfos. - */ - cursor?: Prisma.ProductInfoWhereUniqueInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Take `±n` ProductInfos from the position of the cursor. - */ - take?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Skip the first `n` ProductInfos. - */ - skip?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} - * - * Filter by unique combinations of ProductInfos. - */ - distinct?: Prisma.ProductInfoScalarFieldEnum | Prisma.ProductInfoScalarFieldEnum[] -} - -/** - * ProductInfo findFirstOrThrow - */ -export type ProductInfoFindFirstOrThrowArgs = { - /** - * Select specific fields to fetch from the ProductInfo - */ - select?: Prisma.ProductInfoSelect | null - /** - * Omit specific fields from the ProductInfo - */ - omit?: Prisma.ProductInfoOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ProductInfoInclude | null - /** - * Filter, which ProductInfo to fetch. - */ - where?: Prisma.ProductInfoWhereInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} - * - * Determine the order of ProductInfos to fetch. - */ - orderBy?: Prisma.ProductInfoOrderByWithRelationInput | Prisma.ProductInfoOrderByWithRelationInput[] - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} - * - * Sets the position for searching for ProductInfos. - */ - cursor?: Prisma.ProductInfoWhereUniqueInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Take `±n` ProductInfos from the position of the cursor. - */ - take?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Skip the first `n` ProductInfos. - */ - skip?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} - * - * Filter by unique combinations of ProductInfos. - */ - distinct?: Prisma.ProductInfoScalarFieldEnum | Prisma.ProductInfoScalarFieldEnum[] -} - -/** - * ProductInfo findMany - */ -export type ProductInfoFindManyArgs = { - /** - * Select specific fields to fetch from the ProductInfo - */ - select?: Prisma.ProductInfoSelect | null - /** - * Omit specific fields from the ProductInfo - */ - omit?: Prisma.ProductInfoOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ProductInfoInclude | null - /** - * Filter, which ProductInfos to fetch. - */ - where?: Prisma.ProductInfoWhereInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} - * - * Determine the order of ProductInfos to fetch. - */ - orderBy?: Prisma.ProductInfoOrderByWithRelationInput | Prisma.ProductInfoOrderByWithRelationInput[] - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} - * - * Sets the position for listing ProductInfos. - */ - cursor?: Prisma.ProductInfoWhereUniqueInput - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Take `±n` ProductInfos from the position of the cursor. - */ - take?: number - /** - * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} - * - * Skip the first `n` ProductInfos. - */ - skip?: number - distinct?: Prisma.ProductInfoScalarFieldEnum | Prisma.ProductInfoScalarFieldEnum[] -} - -/** - * ProductInfo create - */ -export type ProductInfoCreateArgs = { - /** - * Select specific fields to fetch from the ProductInfo - */ - select?: Prisma.ProductInfoSelect | null - /** - * Omit specific fields from the ProductInfo - */ - omit?: Prisma.ProductInfoOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ProductInfoInclude | null - /** - * The data needed to create a ProductInfo. - */ - data: Prisma.XOR -} - -/** - * ProductInfo createMany - */ -export type ProductInfoCreateManyArgs = { - /** - * The data used to create many ProductInfos. - */ - data: Prisma.ProductInfoCreateManyInput | Prisma.ProductInfoCreateManyInput[] - skipDuplicates?: boolean -} - -/** - * ProductInfo update - */ -export type ProductInfoUpdateArgs = { - /** - * Select specific fields to fetch from the ProductInfo - */ - select?: Prisma.ProductInfoSelect | null - /** - * Omit specific fields from the ProductInfo - */ - omit?: Prisma.ProductInfoOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ProductInfoInclude | null - /** - * The data needed to update a ProductInfo. - */ - data: Prisma.XOR - /** - * Choose, which ProductInfo to update. - */ - where: Prisma.ProductInfoWhereUniqueInput -} - -/** - * ProductInfo updateMany - */ -export type ProductInfoUpdateManyArgs = { - /** - * The data used to update ProductInfos. - */ - data: Prisma.XOR - /** - * Filter which ProductInfos to update - */ - where?: Prisma.ProductInfoWhereInput - /** - * Limit how many ProductInfos to update. - */ - limit?: number -} - -/** - * ProductInfo upsert - */ -export type ProductInfoUpsertArgs = { - /** - * Select specific fields to fetch from the ProductInfo - */ - select?: Prisma.ProductInfoSelect | null - /** - * Omit specific fields from the ProductInfo - */ - omit?: Prisma.ProductInfoOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ProductInfoInclude | null - /** - * The filter to search for the ProductInfo to update in case it exists. - */ - where: Prisma.ProductInfoWhereUniqueInput - /** - * In case the ProductInfo found by the `where` argument doesn't exist, create a new ProductInfo with this data. - */ - create: Prisma.XOR - /** - * In case the ProductInfo was found with the provided `where` argument, update it with this data. - */ - update: Prisma.XOR -} - -/** - * ProductInfo delete - */ -export type ProductInfoDeleteArgs = { - /** - * Select specific fields to fetch from the ProductInfo - */ - select?: Prisma.ProductInfoSelect | null - /** - * Omit specific fields from the ProductInfo - */ - omit?: Prisma.ProductInfoOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ProductInfoInclude | null - /** - * Filter which ProductInfo to delete. - */ - where: Prisma.ProductInfoWhereUniqueInput -} - -/** - * ProductInfo deleteMany - */ -export type ProductInfoDeleteManyArgs = { - /** - * Filter which ProductInfos to delete - */ - where?: Prisma.ProductInfoWhereInput - /** - * Limit how many ProductInfos to delete. - */ - limit?: number -} - -/** - * ProductInfo.products - */ -export type ProductInfo$productsArgs = { - /** - * Select specific fields to fetch from the Product - */ - select?: Prisma.ProductSelect | null - /** - * Omit specific fields from the Product - */ - omit?: Prisma.ProductOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ProductInclude | null - where?: Prisma.ProductWhereInput - orderBy?: Prisma.ProductOrderByWithRelationInput | Prisma.ProductOrderByWithRelationInput[] - cursor?: Prisma.ProductWhereUniqueInput - take?: number - skip?: number - distinct?: Prisma.ProductScalarFieldEnum | Prisma.ProductScalarFieldEnum[] -} - -/** - * ProductInfo.brand - */ -export type ProductInfo$brandArgs = { - /** - * Select specific fields to fetch from the ProductBrand - */ - select?: Prisma.ProductBrandSelect | null - /** - * Omit specific fields from the ProductBrand - */ - omit?: Prisma.ProductBrandOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ProductBrandInclude | null - where?: Prisma.ProductBrandWhereInput -} - -/** - * ProductInfo.category - */ -export type ProductInfo$categoryArgs = { - /** - * Select specific fields to fetch from the ProductCategory - */ - select?: Prisma.ProductCategorySelect | null - /** - * Omit specific fields from the ProductCategory - */ - omit?: Prisma.ProductCategoryOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ProductCategoryInclude | null - where?: Prisma.ProductCategoryWhereInput -} - -/** - * ProductInfo without action - */ -export type ProductInfoDefaultArgs = { - /** - * Select specific fields to fetch from the ProductInfo - */ - select?: Prisma.ProductInfoSelect | null - /** - * Omit specific fields from the ProductInfo - */ - omit?: Prisma.ProductInfoOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ProductInfoInclude | null -} diff --git a/src/generated/prisma/models/ProductVariant.ts b/src/generated/prisma/models/ProductVariant.ts new file mode 100644 index 0000000..5d2f0cf --- /dev/null +++ b/src/generated/prisma/models/ProductVariant.ts @@ -0,0 +1,1670 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `ProductVariant` model and its related types. + * + * 🟢 You can import this file directly. + */ +import type * as runtime from "@prisma/client/runtime/client" +import type * as $Enums from "../enums.js" +import type * as Prisma from "../internal/prismaNamespace.js" + +/** + * Model ProductVariant + * + */ +export type ProductVariantModel = runtime.Types.Result.DefaultSelection + +export type AggregateProductVariant = { + _count: ProductVariantCountAggregateOutputType | null + _avg: ProductVariantAvgAggregateOutputType | null + _sum: ProductVariantSumAggregateOutputType | null + _min: ProductVariantMinAggregateOutputType | null + _max: ProductVariantMaxAggregateOutputType | null +} + +export type ProductVariantAvgAggregateOutputType = { + id: number | null + basePrice: runtime.Decimal | null + salePrice: runtime.Decimal | null + quantity: runtime.Decimal | null + alertQuantity: runtime.Decimal | null + productId: number | null +} + +export type ProductVariantSumAggregateOutputType = { + id: number | null + basePrice: runtime.Decimal | null + salePrice: runtime.Decimal | null + quantity: runtime.Decimal | null + alertQuantity: runtime.Decimal | null + productId: number | null +} + +export type ProductVariantMinAggregateOutputType = { + id: number | null + name: string | null + basePrice: runtime.Decimal | null + salePrice: runtime.Decimal | null + description: string | null + barcode: string | null + imageUrl: string | null + unit: string | null + quantity: runtime.Decimal | null + alertQuantity: runtime.Decimal | null + isActive: boolean | null + isFeatured: boolean | null + createdAt: Date | null + updatedAt: Date | null + deletedAt: Date | null + productId: number | null +} + +export type ProductVariantMaxAggregateOutputType = { + id: number | null + name: string | null + basePrice: runtime.Decimal | null + salePrice: runtime.Decimal | null + description: string | null + barcode: string | null + imageUrl: string | null + unit: string | null + quantity: runtime.Decimal | null + alertQuantity: runtime.Decimal | null + isActive: boolean | null + isFeatured: boolean | null + createdAt: Date | null + updatedAt: Date | null + deletedAt: Date | null + productId: number | null +} + +export type ProductVariantCountAggregateOutputType = { + id: number + name: number + basePrice: number + salePrice: number + description: number + barcode: number + imageUrl: number + unit: number + quantity: number + alertQuantity: number + isActive: number + isFeatured: number + createdAt: number + updatedAt: number + deletedAt: number + productId: number + _all: number +} + + +export type ProductVariantAvgAggregateInputType = { + id?: true + basePrice?: true + salePrice?: true + quantity?: true + alertQuantity?: true + productId?: true +} + +export type ProductVariantSumAggregateInputType = { + id?: true + basePrice?: true + salePrice?: true + quantity?: true + alertQuantity?: true + productId?: true +} + +export type ProductVariantMinAggregateInputType = { + id?: true + name?: true + basePrice?: true + salePrice?: true + description?: true + barcode?: true + imageUrl?: true + unit?: true + quantity?: true + alertQuantity?: true + isActive?: true + isFeatured?: true + createdAt?: true + updatedAt?: true + deletedAt?: true + productId?: true +} + +export type ProductVariantMaxAggregateInputType = { + id?: true + name?: true + basePrice?: true + salePrice?: true + description?: true + barcode?: true + imageUrl?: true + unit?: true + quantity?: true + alertQuantity?: true + isActive?: true + isFeatured?: true + createdAt?: true + updatedAt?: true + deletedAt?: true + productId?: true +} + +export type ProductVariantCountAggregateInputType = { + id?: true + name?: true + basePrice?: true + salePrice?: true + description?: true + barcode?: true + imageUrl?: true + unit?: true + quantity?: true + alertQuantity?: true + isActive?: true + isFeatured?: true + createdAt?: true + updatedAt?: true + deletedAt?: true + productId?: true + _all?: true +} + +export type ProductVariantAggregateArgs = { + /** + * Filter which ProductVariant to aggregate. + */ + where?: Prisma.ProductVariantWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of ProductVariants to fetch. + */ + orderBy?: Prisma.ProductVariantOrderByWithRelationInput | Prisma.ProductVariantOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.ProductVariantWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` ProductVariants from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` ProductVariants. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned ProductVariants + **/ + _count?: true | ProductVariantCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to average + **/ + _avg?: ProductVariantAvgAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to sum + **/ + _sum?: ProductVariantSumAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: ProductVariantMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: ProductVariantMaxAggregateInputType +} + +export type GetProductVariantAggregateType = { + [P in keyof T & keyof AggregateProductVariant]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type ProductVariantGroupByArgs = { + where?: Prisma.ProductVariantWhereInput + orderBy?: Prisma.ProductVariantOrderByWithAggregationInput | Prisma.ProductVariantOrderByWithAggregationInput[] + by: Prisma.ProductVariantScalarFieldEnum[] | Prisma.ProductVariantScalarFieldEnum + having?: Prisma.ProductVariantScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: ProductVariantCountAggregateInputType | true + _avg?: ProductVariantAvgAggregateInputType + _sum?: ProductVariantSumAggregateInputType + _min?: ProductVariantMinAggregateInputType + _max?: ProductVariantMaxAggregateInputType +} + +export type ProductVariantGroupByOutputType = { + id: number + name: string + basePrice: runtime.Decimal + salePrice: runtime.Decimal + description: string | null + barcode: string | null + imageUrl: string | null + unit: string | null + quantity: runtime.Decimal | null + alertQuantity: runtime.Decimal | null + isActive: boolean + isFeatured: boolean + createdAt: Date | null + updatedAt: Date | null + deletedAt: Date | null + productId: number + _count: ProductVariantCountAggregateOutputType | null + _avg: ProductVariantAvgAggregateOutputType | null + _sum: ProductVariantSumAggregateOutputType | null + _min: ProductVariantMinAggregateOutputType | null + _max: ProductVariantMaxAggregateOutputType | null +} + +type GetProductVariantGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof ProductVariantGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type ProductVariantWhereInput = { + AND?: Prisma.ProductVariantWhereInput | Prisma.ProductVariantWhereInput[] + OR?: Prisma.ProductVariantWhereInput[] + NOT?: Prisma.ProductVariantWhereInput | Prisma.ProductVariantWhereInput[] + id?: Prisma.IntFilter<"ProductVariant"> | number + name?: Prisma.StringFilter<"ProductVariant"> | string + basePrice?: Prisma.DecimalFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string + salePrice?: Prisma.DecimalFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string + description?: Prisma.StringNullableFilter<"ProductVariant"> | string | null + barcode?: Prisma.StringNullableFilter<"ProductVariant"> | string | null + imageUrl?: Prisma.StringNullableFilter<"ProductVariant"> | string | null + unit?: Prisma.StringNullableFilter<"ProductVariant"> | string | null + quantity?: Prisma.DecimalNullableFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null + alertQuantity?: Prisma.DecimalNullableFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null + isActive?: Prisma.BoolFilter<"ProductVariant"> | boolean + isFeatured?: Prisma.BoolFilter<"ProductVariant"> | boolean + createdAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null + updatedAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null + deletedAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null + productId?: Prisma.IntFilter<"ProductVariant"> | number + product?: Prisma.XOR +} + +export type ProductVariantOrderByWithRelationInput = { + id?: Prisma.SortOrder + name?: Prisma.SortOrder + basePrice?: Prisma.SortOrder + salePrice?: Prisma.SortOrder + description?: Prisma.SortOrderInput | Prisma.SortOrder + barcode?: Prisma.SortOrderInput | Prisma.SortOrder + imageUrl?: Prisma.SortOrderInput | Prisma.SortOrder + unit?: Prisma.SortOrderInput | Prisma.SortOrder + quantity?: Prisma.SortOrderInput | Prisma.SortOrder + alertQuantity?: Prisma.SortOrderInput | Prisma.SortOrder + isActive?: Prisma.SortOrder + isFeatured?: Prisma.SortOrder + createdAt?: Prisma.SortOrderInput | Prisma.SortOrder + updatedAt?: Prisma.SortOrderInput | Prisma.SortOrder + deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder + productId?: Prisma.SortOrder + product?: Prisma.ProductOrderByWithRelationInput + _relevance?: Prisma.ProductVariantOrderByRelevanceInput +} + +export type ProductVariantWhereUniqueInput = Prisma.AtLeast<{ + id?: number + barcode?: string + AND?: Prisma.ProductVariantWhereInput | Prisma.ProductVariantWhereInput[] + OR?: Prisma.ProductVariantWhereInput[] + NOT?: Prisma.ProductVariantWhereInput | Prisma.ProductVariantWhereInput[] + name?: Prisma.StringFilter<"ProductVariant"> | string + basePrice?: Prisma.DecimalFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string + salePrice?: Prisma.DecimalFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string + description?: Prisma.StringNullableFilter<"ProductVariant"> | string | null + imageUrl?: Prisma.StringNullableFilter<"ProductVariant"> | string | null + unit?: Prisma.StringNullableFilter<"ProductVariant"> | string | null + quantity?: Prisma.DecimalNullableFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null + alertQuantity?: Prisma.DecimalNullableFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null + isActive?: Prisma.BoolFilter<"ProductVariant"> | boolean + isFeatured?: Prisma.BoolFilter<"ProductVariant"> | boolean + createdAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null + updatedAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null + deletedAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null + productId?: Prisma.IntFilter<"ProductVariant"> | number + product?: Prisma.XOR +}, "id" | "barcode"> + +export type ProductVariantOrderByWithAggregationInput = { + id?: Prisma.SortOrder + name?: Prisma.SortOrder + basePrice?: Prisma.SortOrder + salePrice?: Prisma.SortOrder + description?: Prisma.SortOrderInput | Prisma.SortOrder + barcode?: Prisma.SortOrderInput | Prisma.SortOrder + imageUrl?: Prisma.SortOrderInput | Prisma.SortOrder + unit?: Prisma.SortOrderInput | Prisma.SortOrder + quantity?: Prisma.SortOrderInput | Prisma.SortOrder + alertQuantity?: Prisma.SortOrderInput | Prisma.SortOrder + isActive?: Prisma.SortOrder + isFeatured?: Prisma.SortOrder + createdAt?: Prisma.SortOrderInput | Prisma.SortOrder + updatedAt?: Prisma.SortOrderInput | Prisma.SortOrder + deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder + productId?: Prisma.SortOrder + _count?: Prisma.ProductVariantCountOrderByAggregateInput + _avg?: Prisma.ProductVariantAvgOrderByAggregateInput + _max?: Prisma.ProductVariantMaxOrderByAggregateInput + _min?: Prisma.ProductVariantMinOrderByAggregateInput + _sum?: Prisma.ProductVariantSumOrderByAggregateInput +} + +export type ProductVariantScalarWhereWithAggregatesInput = { + AND?: Prisma.ProductVariantScalarWhereWithAggregatesInput | Prisma.ProductVariantScalarWhereWithAggregatesInput[] + OR?: Prisma.ProductVariantScalarWhereWithAggregatesInput[] + NOT?: Prisma.ProductVariantScalarWhereWithAggregatesInput | Prisma.ProductVariantScalarWhereWithAggregatesInput[] + id?: Prisma.IntWithAggregatesFilter<"ProductVariant"> | number + name?: Prisma.StringWithAggregatesFilter<"ProductVariant"> | string + basePrice?: Prisma.DecimalWithAggregatesFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string + salePrice?: Prisma.DecimalWithAggregatesFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string + description?: Prisma.StringNullableWithAggregatesFilter<"ProductVariant"> | string | null + barcode?: Prisma.StringNullableWithAggregatesFilter<"ProductVariant"> | string | null + imageUrl?: Prisma.StringNullableWithAggregatesFilter<"ProductVariant"> | string | null + unit?: Prisma.StringNullableWithAggregatesFilter<"ProductVariant"> | string | null + quantity?: Prisma.DecimalNullableWithAggregatesFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null + alertQuantity?: Prisma.DecimalNullableWithAggregatesFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null + isActive?: Prisma.BoolWithAggregatesFilter<"ProductVariant"> | boolean + isFeatured?: Prisma.BoolWithAggregatesFilter<"ProductVariant"> | boolean + createdAt?: Prisma.DateTimeNullableWithAggregatesFilter<"ProductVariant"> | Date | string | null + updatedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"ProductVariant"> | Date | string | null + deletedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"ProductVariant"> | Date | string | null + productId?: Prisma.IntWithAggregatesFilter<"ProductVariant"> | number +} + +export type ProductVariantCreateInput = { + name: string + basePrice: runtime.Decimal | runtime.DecimalJsLike | number | string + salePrice: runtime.Decimal | runtime.DecimalJsLike | number | string + description?: string | null + barcode?: string | null + imageUrl?: string | null + unit?: string | null + quantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null + alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null + isActive?: boolean + isFeatured?: boolean + createdAt?: Date | string | null + updatedAt?: Date | string | null + deletedAt?: Date | string | null + product: Prisma.ProductCreateNestedOneWithoutVariantsInput +} + +export type ProductVariantUncheckedCreateInput = { + id?: number + name: string + basePrice: runtime.Decimal | runtime.DecimalJsLike | number | string + salePrice: runtime.Decimal | runtime.DecimalJsLike | number | string + description?: string | null + barcode?: string | null + imageUrl?: string | null + unit?: string | null + quantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null + alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null + isActive?: boolean + isFeatured?: boolean + createdAt?: Date | string | null + updatedAt?: Date | string | null + deletedAt?: Date | string | null + productId: number +} + +export type ProductVariantUpdateInput = { + name?: Prisma.StringFieldUpdateOperationsInput | string + basePrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + salePrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + imageUrl?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + unit?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + quantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null + alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null + isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean + isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean + createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + product?: Prisma.ProductUpdateOneRequiredWithoutVariantsNestedInput +} + +export type ProductVariantUncheckedUpdateInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + name?: Prisma.StringFieldUpdateOperationsInput | string + basePrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + salePrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + imageUrl?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + unit?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + quantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null + alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null + isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean + isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean + createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + productId?: Prisma.IntFieldUpdateOperationsInput | number +} + +export type ProductVariantCreateManyInput = { + id?: number + name: string + basePrice: runtime.Decimal | runtime.DecimalJsLike | number | string + salePrice: runtime.Decimal | runtime.DecimalJsLike | number | string + description?: string | null + barcode?: string | null + imageUrl?: string | null + unit?: string | null + quantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null + alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null + isActive?: boolean + isFeatured?: boolean + createdAt?: Date | string | null + updatedAt?: Date | string | null + deletedAt?: Date | string | null + productId: number +} + +export type ProductVariantUpdateManyMutationInput = { + name?: Prisma.StringFieldUpdateOperationsInput | string + basePrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + salePrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + imageUrl?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + unit?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + quantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null + alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null + isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean + isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean + createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null +} + +export type ProductVariantUncheckedUpdateManyInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + name?: Prisma.StringFieldUpdateOperationsInput | string + basePrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + salePrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + imageUrl?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + unit?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + quantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null + alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null + isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean + isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean + createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + productId?: Prisma.IntFieldUpdateOperationsInput | number +} + +export type ProductVariantOrderByRelevanceInput = { + fields: Prisma.ProductVariantOrderByRelevanceFieldEnum | Prisma.ProductVariantOrderByRelevanceFieldEnum[] + sort: Prisma.SortOrder + search: string +} + +export type ProductVariantCountOrderByAggregateInput = { + id?: Prisma.SortOrder + name?: Prisma.SortOrder + basePrice?: Prisma.SortOrder + salePrice?: Prisma.SortOrder + description?: Prisma.SortOrder + barcode?: Prisma.SortOrder + imageUrl?: Prisma.SortOrder + unit?: Prisma.SortOrder + quantity?: Prisma.SortOrder + alertQuantity?: Prisma.SortOrder + isActive?: Prisma.SortOrder + isFeatured?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder + deletedAt?: Prisma.SortOrder + productId?: Prisma.SortOrder +} + +export type ProductVariantAvgOrderByAggregateInput = { + id?: Prisma.SortOrder + basePrice?: Prisma.SortOrder + salePrice?: Prisma.SortOrder + quantity?: Prisma.SortOrder + alertQuantity?: Prisma.SortOrder + productId?: Prisma.SortOrder +} + +export type ProductVariantMaxOrderByAggregateInput = { + id?: Prisma.SortOrder + name?: Prisma.SortOrder + basePrice?: Prisma.SortOrder + salePrice?: Prisma.SortOrder + description?: Prisma.SortOrder + barcode?: Prisma.SortOrder + imageUrl?: Prisma.SortOrder + unit?: Prisma.SortOrder + quantity?: Prisma.SortOrder + alertQuantity?: Prisma.SortOrder + isActive?: Prisma.SortOrder + isFeatured?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder + deletedAt?: Prisma.SortOrder + productId?: Prisma.SortOrder +} + +export type ProductVariantMinOrderByAggregateInput = { + id?: Prisma.SortOrder + name?: Prisma.SortOrder + basePrice?: Prisma.SortOrder + salePrice?: Prisma.SortOrder + description?: Prisma.SortOrder + barcode?: Prisma.SortOrder + imageUrl?: Prisma.SortOrder + unit?: Prisma.SortOrder + quantity?: Prisma.SortOrder + alertQuantity?: Prisma.SortOrder + isActive?: Prisma.SortOrder + isFeatured?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder + deletedAt?: Prisma.SortOrder + productId?: Prisma.SortOrder +} + +export type ProductVariantSumOrderByAggregateInput = { + id?: Prisma.SortOrder + basePrice?: Prisma.SortOrder + salePrice?: Prisma.SortOrder + quantity?: Prisma.SortOrder + alertQuantity?: Prisma.SortOrder + productId?: Prisma.SortOrder +} + +export type ProductVariantListRelationFilter = { + every?: Prisma.ProductVariantWhereInput + some?: Prisma.ProductVariantWhereInput + none?: Prisma.ProductVariantWhereInput +} + +export type ProductVariantOrderByRelationAggregateInput = { + _count?: Prisma.SortOrder +} + +export type DecimalFieldUpdateOperationsInput = { + set?: runtime.Decimal | runtime.DecimalJsLike | number | string + increment?: runtime.Decimal | runtime.DecimalJsLike | number | string + decrement?: runtime.Decimal | runtime.DecimalJsLike | number | string + multiply?: runtime.Decimal | runtime.DecimalJsLike | number | string + divide?: runtime.Decimal | runtime.DecimalJsLike | number | string +} + +export type NullableDecimalFieldUpdateOperationsInput = { + set?: runtime.Decimal | runtime.DecimalJsLike | number | string | null + increment?: runtime.Decimal | runtime.DecimalJsLike | number | string + decrement?: runtime.Decimal | runtime.DecimalJsLike | number | string + multiply?: runtime.Decimal | runtime.DecimalJsLike | number | string + divide?: runtime.Decimal | runtime.DecimalJsLike | number | string +} + +export type BoolFieldUpdateOperationsInput = { + set?: boolean +} + +export type ProductVariantCreateNestedManyWithoutProductInput = { + create?: Prisma.XOR | Prisma.ProductVariantCreateWithoutProductInput[] | Prisma.ProductVariantUncheckedCreateWithoutProductInput[] + connectOrCreate?: Prisma.ProductVariantCreateOrConnectWithoutProductInput | Prisma.ProductVariantCreateOrConnectWithoutProductInput[] + createMany?: Prisma.ProductVariantCreateManyProductInputEnvelope + connect?: Prisma.ProductVariantWhereUniqueInput | Prisma.ProductVariantWhereUniqueInput[] +} + +export type ProductVariantUncheckedCreateNestedManyWithoutProductInput = { + create?: Prisma.XOR | Prisma.ProductVariantCreateWithoutProductInput[] | Prisma.ProductVariantUncheckedCreateWithoutProductInput[] + connectOrCreate?: Prisma.ProductVariantCreateOrConnectWithoutProductInput | Prisma.ProductVariantCreateOrConnectWithoutProductInput[] + createMany?: Prisma.ProductVariantCreateManyProductInputEnvelope + connect?: Prisma.ProductVariantWhereUniqueInput | Prisma.ProductVariantWhereUniqueInput[] +} + +export type ProductVariantUpdateManyWithoutProductNestedInput = { + create?: Prisma.XOR | Prisma.ProductVariantCreateWithoutProductInput[] | Prisma.ProductVariantUncheckedCreateWithoutProductInput[] + connectOrCreate?: Prisma.ProductVariantCreateOrConnectWithoutProductInput | Prisma.ProductVariantCreateOrConnectWithoutProductInput[] + upsert?: Prisma.ProductVariantUpsertWithWhereUniqueWithoutProductInput | Prisma.ProductVariantUpsertWithWhereUniqueWithoutProductInput[] + createMany?: Prisma.ProductVariantCreateManyProductInputEnvelope + set?: Prisma.ProductVariantWhereUniqueInput | Prisma.ProductVariantWhereUniqueInput[] + disconnect?: Prisma.ProductVariantWhereUniqueInput | Prisma.ProductVariantWhereUniqueInput[] + delete?: Prisma.ProductVariantWhereUniqueInput | Prisma.ProductVariantWhereUniqueInput[] + connect?: Prisma.ProductVariantWhereUniqueInput | Prisma.ProductVariantWhereUniqueInput[] + update?: Prisma.ProductVariantUpdateWithWhereUniqueWithoutProductInput | Prisma.ProductVariantUpdateWithWhereUniqueWithoutProductInput[] + updateMany?: Prisma.ProductVariantUpdateManyWithWhereWithoutProductInput | Prisma.ProductVariantUpdateManyWithWhereWithoutProductInput[] + deleteMany?: Prisma.ProductVariantScalarWhereInput | Prisma.ProductVariantScalarWhereInput[] +} + +export type ProductVariantUncheckedUpdateManyWithoutProductNestedInput = { + create?: Prisma.XOR | Prisma.ProductVariantCreateWithoutProductInput[] | Prisma.ProductVariantUncheckedCreateWithoutProductInput[] + connectOrCreate?: Prisma.ProductVariantCreateOrConnectWithoutProductInput | Prisma.ProductVariantCreateOrConnectWithoutProductInput[] + upsert?: Prisma.ProductVariantUpsertWithWhereUniqueWithoutProductInput | Prisma.ProductVariantUpsertWithWhereUniqueWithoutProductInput[] + createMany?: Prisma.ProductVariantCreateManyProductInputEnvelope + set?: Prisma.ProductVariantWhereUniqueInput | Prisma.ProductVariantWhereUniqueInput[] + disconnect?: Prisma.ProductVariantWhereUniqueInput | Prisma.ProductVariantWhereUniqueInput[] + delete?: Prisma.ProductVariantWhereUniqueInput | Prisma.ProductVariantWhereUniqueInput[] + connect?: Prisma.ProductVariantWhereUniqueInput | Prisma.ProductVariantWhereUniqueInput[] + update?: Prisma.ProductVariantUpdateWithWhereUniqueWithoutProductInput | Prisma.ProductVariantUpdateWithWhereUniqueWithoutProductInput[] + updateMany?: Prisma.ProductVariantUpdateManyWithWhereWithoutProductInput | Prisma.ProductVariantUpdateManyWithWhereWithoutProductInput[] + deleteMany?: Prisma.ProductVariantScalarWhereInput | Prisma.ProductVariantScalarWhereInput[] +} + +export type ProductVariantCreateWithoutProductInput = { + name: string + basePrice: runtime.Decimal | runtime.DecimalJsLike | number | string + salePrice: runtime.Decimal | runtime.DecimalJsLike | number | string + description?: string | null + barcode?: string | null + imageUrl?: string | null + unit?: string | null + quantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null + alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null + isActive?: boolean + isFeatured?: boolean + createdAt?: Date | string | null + updatedAt?: Date | string | null + deletedAt?: Date | string | null +} + +export type ProductVariantUncheckedCreateWithoutProductInput = { + id?: number + name: string + basePrice: runtime.Decimal | runtime.DecimalJsLike | number | string + salePrice: runtime.Decimal | runtime.DecimalJsLike | number | string + description?: string | null + barcode?: string | null + imageUrl?: string | null + unit?: string | null + quantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null + alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null + isActive?: boolean + isFeatured?: boolean + createdAt?: Date | string | null + updatedAt?: Date | string | null + deletedAt?: Date | string | null +} + +export type ProductVariantCreateOrConnectWithoutProductInput = { + where: Prisma.ProductVariantWhereUniqueInput + create: Prisma.XOR +} + +export type ProductVariantCreateManyProductInputEnvelope = { + data: Prisma.ProductVariantCreateManyProductInput | Prisma.ProductVariantCreateManyProductInput[] + skipDuplicates?: boolean +} + +export type ProductVariantUpsertWithWhereUniqueWithoutProductInput = { + where: Prisma.ProductVariantWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type ProductVariantUpdateWithWhereUniqueWithoutProductInput = { + where: Prisma.ProductVariantWhereUniqueInput + data: Prisma.XOR +} + +export type ProductVariantUpdateManyWithWhereWithoutProductInput = { + where: Prisma.ProductVariantScalarWhereInput + data: Prisma.XOR +} + +export type ProductVariantScalarWhereInput = { + AND?: Prisma.ProductVariantScalarWhereInput | Prisma.ProductVariantScalarWhereInput[] + OR?: Prisma.ProductVariantScalarWhereInput[] + NOT?: Prisma.ProductVariantScalarWhereInput | Prisma.ProductVariantScalarWhereInput[] + id?: Prisma.IntFilter<"ProductVariant"> | number + name?: Prisma.StringFilter<"ProductVariant"> | string + basePrice?: Prisma.DecimalFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string + salePrice?: Prisma.DecimalFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string + description?: Prisma.StringNullableFilter<"ProductVariant"> | string | null + barcode?: Prisma.StringNullableFilter<"ProductVariant"> | string | null + imageUrl?: Prisma.StringNullableFilter<"ProductVariant"> | string | null + unit?: Prisma.StringNullableFilter<"ProductVariant"> | string | null + quantity?: Prisma.DecimalNullableFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null + alertQuantity?: Prisma.DecimalNullableFilter<"ProductVariant"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null + isActive?: Prisma.BoolFilter<"ProductVariant"> | boolean + isFeatured?: Prisma.BoolFilter<"ProductVariant"> | boolean + createdAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null + updatedAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null + deletedAt?: Prisma.DateTimeNullableFilter<"ProductVariant"> | Date | string | null + productId?: Prisma.IntFilter<"ProductVariant"> | number +} + +export type ProductVariantCreateManyProductInput = { + id?: number + name: string + basePrice: runtime.Decimal | runtime.DecimalJsLike | number | string + salePrice: runtime.Decimal | runtime.DecimalJsLike | number | string + description?: string | null + barcode?: string | null + imageUrl?: string | null + unit?: string | null + quantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null + alertQuantity?: runtime.Decimal | runtime.DecimalJsLike | number | string | null + isActive?: boolean + isFeatured?: boolean + createdAt?: Date | string | null + updatedAt?: Date | string | null + deletedAt?: Date | string | null +} + +export type ProductVariantUpdateWithoutProductInput = { + name?: Prisma.StringFieldUpdateOperationsInput | string + basePrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + salePrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + imageUrl?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + unit?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + quantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null + alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null + isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean + isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean + createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null +} + +export type ProductVariantUncheckedUpdateWithoutProductInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + name?: Prisma.StringFieldUpdateOperationsInput | string + basePrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + salePrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + imageUrl?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + unit?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + quantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null + alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null + isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean + isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean + createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null +} + +export type ProductVariantUncheckedUpdateManyWithoutProductInput = { + id?: Prisma.IntFieldUpdateOperationsInput | number + name?: Prisma.StringFieldUpdateOperationsInput | string + basePrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + salePrice?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + imageUrl?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + unit?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + quantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null + alertQuantity?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null + isActive?: Prisma.BoolFieldUpdateOperationsInput | boolean + isFeatured?: Prisma.BoolFieldUpdateOperationsInput | boolean + createdAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + updatedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null +} + + + +export type ProductVariantSelect = runtime.Types.Extensions.GetSelect<{ + id?: boolean + name?: boolean + basePrice?: boolean + salePrice?: boolean + description?: boolean + barcode?: boolean + imageUrl?: boolean + unit?: boolean + quantity?: boolean + alertQuantity?: boolean + isActive?: boolean + isFeatured?: boolean + createdAt?: boolean + updatedAt?: boolean + deletedAt?: boolean + productId?: boolean + product?: boolean | Prisma.ProductDefaultArgs +}, ExtArgs["result"]["productVariant"]> + + + +export type ProductVariantSelectScalar = { + id?: boolean + name?: boolean + basePrice?: boolean + salePrice?: boolean + description?: boolean + barcode?: boolean + imageUrl?: boolean + unit?: boolean + quantity?: boolean + alertQuantity?: boolean + isActive?: boolean + isFeatured?: boolean + createdAt?: boolean + updatedAt?: boolean + deletedAt?: boolean + productId?: boolean +} + +export type ProductVariantOmit = runtime.Types.Extensions.GetOmit<"id" | "name" | "basePrice" | "salePrice" | "description" | "barcode" | "imageUrl" | "unit" | "quantity" | "alertQuantity" | "isActive" | "isFeatured" | "createdAt" | "updatedAt" | "deletedAt" | "productId", ExtArgs["result"]["productVariant"]> +export type ProductVariantInclude = { + product?: boolean | Prisma.ProductDefaultArgs +} + +export type $ProductVariantPayload = { + name: "ProductVariant" + objects: { + product: Prisma.$ProductPayload + } + scalars: runtime.Types.Extensions.GetPayloadResult<{ + id: number + name: string + basePrice: runtime.Decimal + salePrice: runtime.Decimal + description: string | null + barcode: string | null + imageUrl: string | null + unit: string | null + quantity: runtime.Decimal | null + alertQuantity: runtime.Decimal | null + isActive: boolean + isFeatured: boolean + createdAt: Date | null + updatedAt: Date | null + deletedAt: Date | null + productId: number + }, ExtArgs["result"]["productVariant"]> + composites: {} +} + +export type ProductVariantGetPayload = runtime.Types.Result.GetResult + +export type ProductVariantCountArgs = + Omit & { + select?: ProductVariantCountAggregateInputType | true + } + +export interface ProductVariantDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['ProductVariant'], meta: { name: 'ProductVariant' } } + /** + * Find zero or one ProductVariant that matches the filter. + * @param {ProductVariantFindUniqueArgs} args - Arguments to find a ProductVariant + * @example + * // Get one ProductVariant + * const productVariant = await prisma.productVariant.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__ProductVariantClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one ProductVariant that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {ProductVariantFindUniqueOrThrowArgs} args - Arguments to find a ProductVariant + * @example + * // Get one ProductVariant + * const productVariant = await prisma.productVariant.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__ProductVariantClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first ProductVariant that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ProductVariantFindFirstArgs} args - Arguments to find a ProductVariant + * @example + * // Get one ProductVariant + * const productVariant = await prisma.productVariant.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__ProductVariantClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first ProductVariant that matches the filter or + * throw `PrismaKnownClientError` with `P2025` code if no matches were found. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ProductVariantFindFirstOrThrowArgs} args - Arguments to find a ProductVariant + * @example + * // Get one ProductVariant + * const productVariant = await prisma.productVariant.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__ProductVariantClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more ProductVariants that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ProductVariantFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all ProductVariants + * const productVariants = await prisma.productVariant.findMany() + * + * // Get first 10 ProductVariants + * const productVariants = await prisma.productVariant.findMany({ take: 10 }) + * + * // Only select the `id` + * const productVariantWithIdOnly = await prisma.productVariant.findMany({ select: { id: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a ProductVariant. + * @param {ProductVariantCreateArgs} args - Arguments to create a ProductVariant. + * @example + * // Create one ProductVariant + * const ProductVariant = await prisma.productVariant.create({ + * data: { + * // ... data to create a ProductVariant + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__ProductVariantClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many ProductVariants. + * @param {ProductVariantCreateManyArgs} args - Arguments to create many ProductVariants. + * @example + * // Create many ProductVariants + * const productVariant = await prisma.productVariant.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Delete a ProductVariant. + * @param {ProductVariantDeleteArgs} args - Arguments to delete one ProductVariant. + * @example + * // Delete one ProductVariant + * const ProductVariant = await prisma.productVariant.delete({ + * where: { + * // ... filter to delete one ProductVariant + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__ProductVariantClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one ProductVariant. + * @param {ProductVariantUpdateArgs} args - Arguments to update one ProductVariant. + * @example + * // Update one ProductVariant + * const productVariant = await prisma.productVariant.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__ProductVariantClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more ProductVariants. + * @param {ProductVariantDeleteManyArgs} args - Arguments to filter ProductVariants to delete. + * @example + * // Delete a few ProductVariants + * const { count } = await prisma.productVariant.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more ProductVariants. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ProductVariantUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many ProductVariants + * const productVariant = await prisma.productVariant.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create or update one ProductVariant. + * @param {ProductVariantUpsertArgs} args - Arguments to update or create a ProductVariant. + * @example + * // Update or create a ProductVariant + * const productVariant = await prisma.productVariant.upsert({ + * create: { + * // ... data to create a ProductVariant + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the ProductVariant we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__ProductVariantClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of ProductVariants. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ProductVariantCountArgs} args - Arguments to filter ProductVariants to count. + * @example + * // Count the number of ProductVariants + * const count = await prisma.productVariant.count({ + * where: { + * // ... the filter for the ProductVariants we want to count + * } + * }) + **/ + count( + args?: Prisma.Subset, + ): Prisma.PrismaPromise< + T extends runtime.Types.Utils.Record<'select', any> + ? T['select'] extends true + ? number + : Prisma.GetScalarType + : number + > + + /** + * Allows you to perform aggregations operations on a ProductVariant. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ProductVariantAggregateArgs} args - Select which aggregations you would like to apply and on what fields. + * @example + * // Ordered by age ascending + * // Where email contains prisma.io + * // Limited to the 10 users + * const aggregations = await prisma.user.aggregate({ + * _avg: { + * age: true, + * }, + * where: { + * email: { + * contains: "prisma.io", + * }, + * }, + * orderBy: { + * age: "asc", + * }, + * take: 10, + * }) + **/ + aggregate(args: Prisma.Subset): Prisma.PrismaPromise> + + /** + * Group by ProductVariant. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {ProductVariantGroupByArgs} args - Group by arguments. + * @example + * // Group by city, order by createdAt, get count + * const result = await prisma.user.groupBy({ + * by: ['city', 'createdAt'], + * orderBy: { + * createdAt: true + * }, + * _count: { + * _all: true + * }, + * }) + * + **/ + groupBy< + T extends ProductVariantGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: ProductVariantGroupByArgs['orderBy'] } + : { orderBy?: ProductVariantGroupByArgs['orderBy'] }, + OrderFields extends Prisma.ExcludeUnderscoreKeys>>, + ByFields extends Prisma.MaybeTupleToUnion, + ByValid extends Prisma.Has, + HavingFields extends Prisma.GetHavingFields, + HavingValid extends Prisma.Has, + ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False, + InputErrors extends ByEmpty extends Prisma.True + ? `Error: "by" must not be empty.` + : HavingValid extends Prisma.False + ? { + [P in HavingFields]: P extends ByFields + ? never + : P extends string + ? `Error: Field "${P}" used in "having" needs to be provided in "by".` + : [ + Error, + 'Field ', + P, + ` in "having" needs to be provided in "by"`, + ] + }[HavingFields] + : 'take' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "take", you also need to provide "orderBy"' + : 'skip' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "skip", you also need to provide "orderBy"' + : ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + >(args: Prisma.SubsetIntersection & InputErrors): {} extends InputErrors ? GetProductVariantGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the ProductVariant model + */ +readonly fields: ProductVariantFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for ProductVariant. + * Why is this prefixed with `Prisma__`? + * Because we want to prevent naming conflicts as mentioned in + * https://github.com/prisma/prisma-client-js/issues/707 + */ +export interface Prisma__ProductVariantClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + product = {}>(args?: Prisma.Subset>): Prisma.Prisma__ProductClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The + * resolved value cannot be modified from the callback. + * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). + * @returns A Promise for the completion of the callback. + */ + finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise +} + + + + +/** + * Fields of the ProductVariant model + */ +export interface ProductVariantFieldRefs { + readonly id: Prisma.FieldRef<"ProductVariant", 'Int'> + readonly name: Prisma.FieldRef<"ProductVariant", 'String'> + readonly basePrice: Prisma.FieldRef<"ProductVariant", 'Decimal'> + readonly salePrice: Prisma.FieldRef<"ProductVariant", 'Decimal'> + readonly description: Prisma.FieldRef<"ProductVariant", 'String'> + readonly barcode: Prisma.FieldRef<"ProductVariant", 'String'> + readonly imageUrl: Prisma.FieldRef<"ProductVariant", 'String'> + readonly unit: Prisma.FieldRef<"ProductVariant", 'String'> + readonly quantity: Prisma.FieldRef<"ProductVariant", 'Decimal'> + readonly alertQuantity: Prisma.FieldRef<"ProductVariant", 'Decimal'> + readonly isActive: Prisma.FieldRef<"ProductVariant", 'Boolean'> + readonly isFeatured: Prisma.FieldRef<"ProductVariant", 'Boolean'> + readonly createdAt: Prisma.FieldRef<"ProductVariant", 'DateTime'> + readonly updatedAt: Prisma.FieldRef<"ProductVariant", 'DateTime'> + readonly deletedAt: Prisma.FieldRef<"ProductVariant", 'DateTime'> + readonly productId: Prisma.FieldRef<"ProductVariant", 'Int'> +} + + +// Custom InputTypes +/** + * ProductVariant findUnique + */ +export type ProductVariantFindUniqueArgs = { + /** + * Select specific fields to fetch from the ProductVariant + */ + select?: Prisma.ProductVariantSelect | null + /** + * Omit specific fields from the ProductVariant + */ + omit?: Prisma.ProductVariantOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProductVariantInclude | null + /** + * Filter, which ProductVariant to fetch. + */ + where: Prisma.ProductVariantWhereUniqueInput +} + +/** + * ProductVariant findUniqueOrThrow + */ +export type ProductVariantFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the ProductVariant + */ + select?: Prisma.ProductVariantSelect | null + /** + * Omit specific fields from the ProductVariant + */ + omit?: Prisma.ProductVariantOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProductVariantInclude | null + /** + * Filter, which ProductVariant to fetch. + */ + where: Prisma.ProductVariantWhereUniqueInput +} + +/** + * ProductVariant findFirst + */ +export type ProductVariantFindFirstArgs = { + /** + * Select specific fields to fetch from the ProductVariant + */ + select?: Prisma.ProductVariantSelect | null + /** + * Omit specific fields from the ProductVariant + */ + omit?: Prisma.ProductVariantOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProductVariantInclude | null + /** + * Filter, which ProductVariant to fetch. + */ + where?: Prisma.ProductVariantWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of ProductVariants to fetch. + */ + orderBy?: Prisma.ProductVariantOrderByWithRelationInput | Prisma.ProductVariantOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for ProductVariants. + */ + cursor?: Prisma.ProductVariantWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` ProductVariants from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` ProductVariants. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of ProductVariants. + */ + distinct?: Prisma.ProductVariantScalarFieldEnum | Prisma.ProductVariantScalarFieldEnum[] +} + +/** + * ProductVariant findFirstOrThrow + */ +export type ProductVariantFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the ProductVariant + */ + select?: Prisma.ProductVariantSelect | null + /** + * Omit specific fields from the ProductVariant + */ + omit?: Prisma.ProductVariantOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProductVariantInclude | null + /** + * Filter, which ProductVariant to fetch. + */ + where?: Prisma.ProductVariantWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of ProductVariants to fetch. + */ + orderBy?: Prisma.ProductVariantOrderByWithRelationInput | Prisma.ProductVariantOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for ProductVariants. + */ + cursor?: Prisma.ProductVariantWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` ProductVariants from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` ProductVariants. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of ProductVariants. + */ + distinct?: Prisma.ProductVariantScalarFieldEnum | Prisma.ProductVariantScalarFieldEnum[] +} + +/** + * ProductVariant findMany + */ +export type ProductVariantFindManyArgs = { + /** + * Select specific fields to fetch from the ProductVariant + */ + select?: Prisma.ProductVariantSelect | null + /** + * Omit specific fields from the ProductVariant + */ + omit?: Prisma.ProductVariantOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProductVariantInclude | null + /** + * Filter, which ProductVariants to fetch. + */ + where?: Prisma.ProductVariantWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of ProductVariants to fetch. + */ + orderBy?: Prisma.ProductVariantOrderByWithRelationInput | Prisma.ProductVariantOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing ProductVariants. + */ + cursor?: Prisma.ProductVariantWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` ProductVariants from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` ProductVariants. + */ + skip?: number + distinct?: Prisma.ProductVariantScalarFieldEnum | Prisma.ProductVariantScalarFieldEnum[] +} + +/** + * ProductVariant create + */ +export type ProductVariantCreateArgs = { + /** + * Select specific fields to fetch from the ProductVariant + */ + select?: Prisma.ProductVariantSelect | null + /** + * Omit specific fields from the ProductVariant + */ + omit?: Prisma.ProductVariantOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProductVariantInclude | null + /** + * The data needed to create a ProductVariant. + */ + data: Prisma.XOR +} + +/** + * ProductVariant createMany + */ +export type ProductVariantCreateManyArgs = { + /** + * The data used to create many ProductVariants. + */ + data: Prisma.ProductVariantCreateManyInput | Prisma.ProductVariantCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * ProductVariant update + */ +export type ProductVariantUpdateArgs = { + /** + * Select specific fields to fetch from the ProductVariant + */ + select?: Prisma.ProductVariantSelect | null + /** + * Omit specific fields from the ProductVariant + */ + omit?: Prisma.ProductVariantOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProductVariantInclude | null + /** + * The data needed to update a ProductVariant. + */ + data: Prisma.XOR + /** + * Choose, which ProductVariant to update. + */ + where: Prisma.ProductVariantWhereUniqueInput +} + +/** + * ProductVariant updateMany + */ +export type ProductVariantUpdateManyArgs = { + /** + * The data used to update ProductVariants. + */ + data: Prisma.XOR + /** + * Filter which ProductVariants to update + */ + where?: Prisma.ProductVariantWhereInput + /** + * Limit how many ProductVariants to update. + */ + limit?: number +} + +/** + * ProductVariant upsert + */ +export type ProductVariantUpsertArgs = { + /** + * Select specific fields to fetch from the ProductVariant + */ + select?: Prisma.ProductVariantSelect | null + /** + * Omit specific fields from the ProductVariant + */ + omit?: Prisma.ProductVariantOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProductVariantInclude | null + /** + * The filter to search for the ProductVariant to update in case it exists. + */ + where: Prisma.ProductVariantWhereUniqueInput + /** + * In case the ProductVariant found by the `where` argument doesn't exist, create a new ProductVariant with this data. + */ + create: Prisma.XOR + /** + * In case the ProductVariant was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * ProductVariant delete + */ +export type ProductVariantDeleteArgs = { + /** + * Select specific fields to fetch from the ProductVariant + */ + select?: Prisma.ProductVariantSelect | null + /** + * Omit specific fields from the ProductVariant + */ + omit?: Prisma.ProductVariantOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProductVariantInclude | null + /** + * Filter which ProductVariant to delete. + */ + where: Prisma.ProductVariantWhereUniqueInput +} + +/** + * ProductVariant deleteMany + */ +export type ProductVariantDeleteManyArgs = { + /** + * Filter which ProductVariants to delete + */ + where?: Prisma.ProductVariantWhereInput + /** + * Limit how many ProductVariants to delete. + */ + limit?: number +} + +/** + * ProductVariant without action + */ +export type ProductVariantDefaultArgs = { + /** + * Select specific fields to fetch from the ProductVariant + */ + select?: Prisma.ProductVariantSelect | null + /** + * Omit specific fields from the ProductVariant + */ + omit?: Prisma.ProductVariantOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.ProductVariantInclude | null +} diff --git a/src/generated/prisma/models/Supplier.ts b/src/generated/prisma/models/Supplier.ts index 36dbbc4..ff4ddd2 100644 --- a/src/generated/prisma/models/Supplier.ts +++ b/src/generated/prisma/models/Supplier.ts @@ -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 - connectOrCreate?: Prisma.SupplierCreateOrConnectWithoutProductInfoInput - connect?: Prisma.SupplierWhereUniqueInput -} - -export type SupplierUpdateOneRequiredWithoutProductInfoNestedInput = { - create?: Prisma.XOR - connectOrCreate?: Prisma.SupplierCreateOrConnectWithoutProductInfoInput - upsert?: Prisma.SupplierUpsertWithoutProductInfoInput - connect?: Prisma.SupplierWhereUniqueInput - update?: Prisma.XOR, 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 -} - -export type SupplierUpsertWithoutProductInfoInput = { - update: Prisma.XOR - create: Prisma.XOR - where?: Prisma.SupplierWhereInput -} - -export type SupplierUpdateToOneWithWhereWithoutProductInfoInput = { - where?: Prisma.SupplierWhereInput - data: Prisma.XOR -} - -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 = { - productInfo?: boolean | SupplierCountOutputTypeCountProductInfoArgs -} - -/** - * SupplierCountOutputType without action - */ -export type SupplierCountOutputTypeDefaultArgs = { - /** - * Select specific fields to fetch from the SupplierCountOutputType - */ - select?: Prisma.SupplierCountOutputTypeSelect | null -} - -/** - * SupplierCountOutputType without action - */ -export type SupplierCountOutputTypeCountProductInfoArgs = { - where?: Prisma.ProductInfoWhereInput -} export type SupplierSelect = runtime.Types.Extensions.GetSelect<{ @@ -678,8 +545,6 @@ export type SupplierSelect - _count?: boolean | Prisma.SupplierCountOutputTypeDefaultArgs }, ExtArgs["result"]["supplier"]> @@ -701,16 +566,10 @@ export type SupplierSelectScalar = { } export type SupplierOmit = runtime.Types.Extensions.GetOmit<"id" | "firstName" | "lastName" | "email" | "mobileNumber" | "address" | "city" | "state" | "country" | "isActive" | "createdAt" | "updatedAt" | "deletedAt", ExtArgs["result"]["supplier"]> -export type SupplierInclude = { - productInfo?: boolean | Prisma.Supplier$productInfoArgs - _count?: boolean | Prisma.SupplierCountOutputTypeDefaultArgs -} export type $SupplierPayload = { name: "Supplier" - objects: { - productInfo: Prisma.$ProductInfoPayload[] - } + objects: {} scalars: runtime.Types.Extensions.GetPayloadResult<{ id: number firstName: string @@ -1065,7 +924,6 @@ readonly fields: SupplierFieldRefs; */ export interface Prisma__SupplierClient extends Prisma.PrismaPromise { readonly [Symbol.toStringTag]: "PrismaPromise" - productInfo = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, 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 | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.SupplierInclude | null /** * Filter, which Supplier to fetch. */ @@ -1146,10 +1000,6 @@ export type SupplierFindUniqueOrThrowArgs | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.SupplierInclude | null /** * Filter, which Supplier to fetch. */ @@ -1168,10 +1018,6 @@ export type SupplierFindFirstArgs | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.SupplierInclude | null /** * Filter, which Supplier to fetch. */ @@ -1220,10 +1066,6 @@ export type SupplierFindFirstOrThrowArgs | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.SupplierInclude | null /** * Filter, which Supplier to fetch. */ @@ -1272,10 +1114,6 @@ export type SupplierFindManyArgs | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.SupplierInclude | null /** * Filter, which Suppliers to fetch. */ @@ -1319,10 +1157,6 @@ export type SupplierCreateArgs | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.SupplierInclude | null /** * The data needed to create a Supplier. */ @@ -1352,10 +1186,6 @@ export type SupplierUpdateArgs | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.SupplierInclude | null /** * The data needed to update a Supplier. */ @@ -1396,10 +1226,6 @@ export type SupplierUpsertArgs | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.SupplierInclude | null /** * The filter to search for the Supplier to update in case it exists. */ @@ -1426,10 +1252,6 @@ export type SupplierDeleteArgs | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.SupplierInclude | null /** * Filter which Supplier to delete. */ @@ -1450,30 +1272,6 @@ export type SupplierDeleteManyArgs = { - /** - * Select specific fields to fetch from the ProductInfo - */ - select?: Prisma.ProductInfoSelect | null - /** - * Omit specific fields from the ProductInfo - */ - omit?: Prisma.ProductInfoOmit | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.ProductInfoInclude | 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 | null - /** - * Choose, which related nodes to fetch as well - */ - include?: Prisma.SupplierInclude | null } diff --git a/src/inventories/dto/create-inventory.dto.ts b/src/inventories/dto/create-inventory.dto.ts index 1d2c503..81d04a3 100644 --- a/src/inventories/dto/create-inventory.dto.ts +++ b/src/inventories/dto/create-inventory.dto.ts @@ -1,4 +1,10 @@ +import { IsOptional, IsString } from 'class-validator' + export class CreateInventoryDto { + @IsString() name: string + + @IsOptional() + @IsString() location?: string } diff --git a/src/inventories/dto/update-inventory.dto.ts b/src/inventories/dto/update-inventory.dto.ts index 95fa459..de8c2ce 100644 --- a/src/inventories/dto/update-inventory.dto.ts +++ b/src/inventories/dto/update-inventory.dto.ts @@ -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 } diff --git a/src/inventories/inventories.service.ts b/src/inventories/inventories.service.ts index 8f16899..da22d25 100644 --- a/src/inventories/inventories.service.ts +++ b/src/inventories/inventories.service.ts @@ -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) } } diff --git a/src/lib/prisma.ts b/src/lib/prisma.ts index c81541c..2106aea 100644 --- a/src/lib/prisma.ts +++ b/src/lib/prisma.ts @@ -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 } diff --git a/src/main.ts b/src/main.ts index c33375f..dc54161 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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() diff --git a/src/product-brands/dto/create-product-brand.dto.ts b/src/product-brands/dto/create-product-brand.dto.ts index f0e54be..1a4556f 100644 --- a/src/product-brands/dto/create-product-brand.dto.ts +++ b/src/product-brands/dto/create-product-brand.dto.ts @@ -1,5 +1,14 @@ +import { IsOptional, IsString } from 'class-validator' + export class CreateProductBrandDto { + @IsString() name: string + + @IsOptional() + @IsString() description?: string + + @IsOptional() + @IsString() imageUrl?: string } diff --git a/src/product-brands/dto/update-product-brand.dto.ts b/src/product-brands/dto/update-product-brand.dto.ts index daa10e2..342c6ef 100644 --- a/src/product-brands/dto/update-product-brand.dto.ts +++ b/src/product-brands/dto/update-product-brand.dto.ts @@ -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 } diff --git a/src/product-brands/product-brands.service.ts b/src/product-brands/product-brands.service.ts index 5ca5fe8..25aa22b 100644 --- a/src/product-brands/product-brands.service.ts +++ b/src/product-brands/product-brands.service.ts @@ -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) } } diff --git a/src/product-categories/dto/create-product-category.dto.ts b/src/product-categories/dto/create-product-category.dto.ts index 4c38945..306ef91 100644 --- a/src/product-categories/dto/create-product-category.dto.ts +++ b/src/product-categories/dto/create-product-category.dto.ts @@ -1,5 +1,14 @@ +import { IsOptional, IsString } from 'class-validator' + export class CreateProductCategoryDto { + @IsString() name: string + + @IsOptional() + @IsString() description?: string + + @IsOptional() + @IsString() imageUrl?: string } diff --git a/src/product-categories/dto/update-product-category.dto.ts b/src/product-categories/dto/update-product-category.dto.ts index 0c10549..c479034 100644 --- a/src/product-categories/dto/update-product-category.dto.ts +++ b/src/product-categories/dto/update-product-category.dto.ts @@ -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 } diff --git a/src/product-categories/product-categories.service.ts b/src/product-categories/product-categories.service.ts index f237afd..e22e373 100644 --- a/src/product-categories/product-categories.service.ts +++ b/src/product-categories/product-categories.service.ts @@ -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) } } diff --git a/src/product-info/dto/create-product-info.dto.ts b/src/product-info/dto/create-product-info.dto.ts deleted file mode 100644 index ed9c9a6..0000000 --- a/src/product-info/dto/create-product-info.dto.ts +++ /dev/null @@ -1,9 +0,0 @@ -export class CreateProductInfoDto { - name: string - description?: string - productType?: string - metaData?: any - brandId?: number - categoryId?: number - vendorId: number -} diff --git a/src/product-info/dto/update-product-info.dto.ts b/src/product-info/dto/update-product-info.dto.ts deleted file mode 100644 index aba1449..0000000 --- a/src/product-info/dto/update-product-info.dto.ts +++ /dev/null @@ -1,9 +0,0 @@ -export class UpdateProductInfoDto { - name?: string - description?: string - productType?: string - metaData?: any - brandId?: number - categoryId?: number - vendorId?: number -} diff --git a/src/product-info/product-info.controller.ts b/src/product-info/product-info.controller.ts deleted file mode 100644 index a67d81a..0000000 --- a/src/product-info/product-info.controller.ts +++ /dev/null @@ -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)) - } -} diff --git a/src/product-info/product-info.module.ts b/src/product-info/product-info.module.ts deleted file mode 100644 index d4fa458..0000000 --- a/src/product-info/product-info.module.ts +++ /dev/null @@ -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 {} diff --git a/src/product-info/product-info.service.ts b/src/product-info/product-info.service.ts deleted file mode 100644 index b8fdd3f..0000000 --- a/src/product-info/product-info.service.ts +++ /dev/null @@ -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 } }) - } -} diff --git a/src/product-variants/dto/create-product-variant.dto.ts b/src/product-variants/dto/create-product-variant.dto.ts new file mode 100644 index 0000000..332a5d8 --- /dev/null +++ b/src/product-variants/dto/create-product-variant.dto.ts @@ -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 +} diff --git a/src/product-variants/dto/update-product-variant.dto.ts b/src/product-variants/dto/update-product-variant.dto.ts new file mode 100644 index 0000000..5ef7a85 --- /dev/null +++ b/src/product-variants/dto/update-product-variant.dto.ts @@ -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 +} diff --git a/src/product-variants/product-variants.controller.ts b/src/product-variants/product-variants.controller.ts new file mode 100644 index 0000000..d6624f0 --- /dev/null +++ b/src/product-variants/product-variants.controller.ts @@ -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)) + } +} diff --git a/src/product-variants/product-variants.module.ts b/src/product-variants/product-variants.module.ts new file mode 100644 index 0000000..05bc55d --- /dev/null +++ b/src/product-variants/product-variants.module.ts @@ -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 {} diff --git a/src/product-variants/product-variants.service.ts b/src/product-variants/product-variants.service.ts new file mode 100644 index 0000000..6751f85 --- /dev/null +++ b/src/product-variants/product-variants.service.ts @@ -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) + } +} diff --git a/src/products/dto/create-product.dto.ts b/src/products/dto/create-product.dto.ts index 6480c56..fcee16b 100644 --- a/src/products/dto/create-product.dto.ts +++ b/src/products/dto/create-product.dto.ts @@ -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 } diff --git a/src/products/dto/update-product.dto.ts b/src/products/dto/update-product.dto.ts index f128e09..21a0ab6 100644 --- a/src/products/dto/update-product.dto.ts +++ b/src/products/dto/update-product.dto.ts @@ -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 } diff --git a/src/products/products.controller.ts b/src/products/products.controller.ts index c2354e6..68c237e 100644 --- a/src/products/products.controller.ts +++ b/src/products/products.controller.ts @@ -9,6 +9,7 @@ export class ProductsController { @Post() create(@Body() dto: CreateProductDto) { + console.log('[ProductController] create called', dto) return this.productsService.create(dto) } diff --git a/src/products/products.service.ts b/src/products/products.service.ts index f29f881..181a81e 100644 --- a/src/products/products.service.ts +++ b/src/products/products.service.ts @@ -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) } } diff --git a/src/roles/dto/create-role.dto.ts b/src/roles/dto/create-role.dto.ts index 03a711f..c1b07ff 100644 --- a/src/roles/dto/create-role.dto.ts +++ b/src/roles/dto/create-role.dto.ts @@ -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 } diff --git a/src/roles/dto/update-role.dto.ts b/src/roles/dto/update-role.dto.ts index 84bce47..8ed3ea9 100644 --- a/src/roles/dto/update-role.dto.ts +++ b/src/roles/dto/update-role.dto.ts @@ -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 } diff --git a/src/roles/roles.service.ts b/src/roles/roles.service.ts index 017fc60..4fa5eab 100644 --- a/src/roles/roles.service.ts +++ b/src/roles/roles.service.ts @@ -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) } } diff --git a/src/stores/dto/create-store.dto.ts b/src/stores/dto/create-store.dto.ts index fb7133d..576b54f 100644 --- a/src/stores/dto/create-store.dto.ts +++ b/src/stores/dto/create-store.dto.ts @@ -1,4 +1,10 @@ +import { IsOptional, IsString } from 'class-validator' + export class CreateStoreDto { + @IsString() name: string + + @IsOptional() + @IsString() location?: string } diff --git a/src/stores/dto/update-store.dto.ts b/src/stores/dto/update-store.dto.ts index 45f8455..6ebc4f3 100644 --- a/src/stores/dto/update-store.dto.ts +++ b/src/stores/dto/update-store.dto.ts @@ -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 } diff --git a/src/stores/stores.service.ts b/src/stores/stores.service.ts index 8a18dc8..872c684 100644 --- a/src/stores/stores.service.ts +++ b/src/stores/stores.service.ts @@ -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) } } diff --git a/src/suppliers/dto/create-supplier.dto.ts b/src/suppliers/dto/create-supplier.dto.ts index 903d317..1fc0584 100644 --- a/src/suppliers/dto/create-supplier.dto.ts +++ b/src/suppliers/dto/create-supplier.dto.ts @@ -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 } diff --git a/src/suppliers/dto/update-supplier.dto.ts b/src/suppliers/dto/update-supplier.dto.ts index 32ecf39..eb99cec 100644 --- a/src/suppliers/dto/update-supplier.dto.ts +++ b/src/suppliers/dto/update-supplier.dto.ts @@ -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 } diff --git a/src/suppliers/suppliers.service.ts b/src/suppliers/suppliers.service.ts index 4f9e6f6..9b041c8 100644 --- a/src/suppliers/suppliers.service.ts +++ b/src/suppliers/suppliers.service.ts @@ -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) } } diff --git a/src/uploads/uploads.controller.ts b/src/uploads/uploads.controller.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/uploads/uploads.service.ts b/src/uploads/uploads.service.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/users/dto/create-user.dto.ts b/src/users/dto/create-user.dto.ts index 45f076f..f95d398 100644 --- a/src/users/dto/create-user.dto.ts +++ b/src/users/dto/create-user.dto.ts @@ -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 } diff --git a/src/users/dto/update-user.dto.ts b/src/users/dto/update-user.dto.ts index 5f8c6bc..3388c3d 100644 --- a/src/users/dto/update-user.dto.ts +++ b/src/users/dto/update-user.dto.ts @@ -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 } diff --git a/src/users/users.service.ts b/src/users/users.service.ts index 3de7fa6..b00ef65 100644 --- a/src/users/users.service.ts +++ b/src/users/users.service.ts @@ -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) } }