diff --git a/common/keys.ts b/common/keys.ts new file mode 100644 index 0000000..c105005 --- /dev/null +++ b/common/keys.ts @@ -0,0 +1,2 @@ +export const PUBLIC_KEY = '__PUBLIC_KEY__'; +export const ROLE_KEY = '__ROLE_KEY__'; diff --git a/core/als/request-context.type.ts b/core/als/request-context.type.ts index a1786b7..d416f05 100644 --- a/core/als/request-context.type.ts +++ b/core/als/request-context.type.ts @@ -1,10 +1,10 @@ import { Prisma } from 'prisma/generated/prisma/client'; -import { AuthPayload } from 'src/auth/types'; +import { JwtPayload } from 'src/auth/types'; export interface RequestContext { requestId: string; correlationId?: string; headers: Record; - user?: AuthPayload; + user?: JwtPayload; tx?: Prisma.TransactionClient; } diff --git a/package.json b/package.json index bf3d361..cf4df8a 100644 --- a/package.json +++ b/package.json @@ -17,14 +17,22 @@ "test:watch": "jest --watch", "test:cov": "jest --coverage", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", - "test:e2e": "jest --config ./test/jest-e2e.json" + "test:e2e": "jest --config ./test/jest-e2e.json", + "prisma:migrate": "prisma migrate dev --create-only", + "prisma:apply": "prisma migrate dev && prisma generate", + "prisma:deploy": "prisma migrate deploy", + "prisma:generate": "prisma generate" }, "dependencies": { "@nestjs/common": "^11.0.1", "@nestjs/core": "^11.0.1", + "@nestjs/jwt": "^11.0.2", "@nestjs/platform-express": "^11.0.1", + "@nestjs/swagger": "^11.2.6", "@prisma/adapter-pg": "^7.3.0", "@prisma/client": "^7.3.0", + "class-transformer": "^0.5.1", + "class-validator": "^0.14.3", "pg": "^8.18.0", "reflect-metadata": "^0.2.2", "rxjs": "^7.8.1" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6fd3d55..a80d95b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,19 +10,31 @@ importers: dependencies: '@nestjs/common': specifier: ^11.0.1 - version: 11.1.13(reflect-metadata@0.2.2)(rxjs@7.8.2) + version: 11.1.13(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.13(@nestjs/common@11.1.13(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@11.1.13)(reflect-metadata@0.2.2)(rxjs@7.8.2) + version: 11.1.13(@nestjs/common@11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@11.1.13)(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nestjs/jwt': + specifier: ^11.0.2 + version: 11.0.2(@nestjs/common@11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2)) '@nestjs/platform-express': specifier: ^11.0.1 - version: 11.1.13(@nestjs/common@11.1.13(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.13) + version: 11.1.13(@nestjs/common@11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.13) + '@nestjs/swagger': + specifier: ^11.2.6 + version: 11.2.6(@nestjs/common@11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.13)(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2) '@prisma/adapter-pg': specifier: ^7.3.0 version: 7.3.0 '@prisma/client': specifier: ^7.3.0 version: 7.3.0(prisma@7.3.0(@types/react@19.2.13)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(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 pg: specifier: ^8.18.0 version: 8.18.0 @@ -44,13 +56,13 @@ importers: version: 11.0.16(@swc/cli@0.6.0(@swc/core@1.15.11)(chokidar@4.0.3))(@swc/core@1.15.11)(@types/node@22.19.10) '@nestjs/config': specifier: ^4.0.3 - version: 4.0.3(@nestjs/common@11.1.13(reflect-metadata@0.2.2)(rxjs@7.8.2))(rxjs@7.8.2) + version: 4.0.3(@nestjs/common@11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(rxjs@7.8.2) '@nestjs/schematics': specifier: ^11.0.0 version: 11.0.9(chokidar@4.0.3)(typescript@5.9.3) '@nestjs/testing': specifier: ^11.0.1 - version: 11.1.13(@nestjs/common@11.1.13(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.13)(@nestjs/platform-express@11.1.13) + version: 11.1.13(@nestjs/common@11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.13)(@nestjs/platform-express@11.1.13) '@swc/cli': specifier: ^0.6.0 version: 0.6.0(@swc/core@1.15.11)(chokidar@4.0.3) @@ -664,6 +676,9 @@ packages: resolution: {integrity: sha512-Z7C/xXCiGWsg0KuKsHTKJxbWhpI3Vs5GwLfOean7MGyVFGqdRgBbAjOCh6u4bbjPc/8MJ2pZmK/0DLdCbivLDA==} engines: {node: '>=8'} + '@microsoft/tsdoc@0.16.0': + resolution: {integrity: sha512-xgAyonlVVS+q7Vc7qLW0UrJU7rSFcETRWsqdXZtjzRU8dF+6CkozTK4V4y1LwOX7j8r/vHphjDeMeGI4tNGeGA==} + '@mrleebo/prisma-ast@0.13.1': resolution: {integrity: sha512-XyroGQXcHrZdvmrGJvsA9KNeOOgGMg1Vg9OlheUsBOSKznLMDl+YChxbkboRHvtFYJEMRYmlV3uoo/njCw05iw==} engines: {node: '>=16'} @@ -824,6 +839,24 @@ packages: '@nestjs/websockets': optional: true + '@nestjs/jwt@11.0.2': + resolution: {integrity: sha512-rK8aE/3/Ma45gAWfCksAXUNbOoSOUudU0Kn3rT39htPF7wsYXtKfjALKeKKJbFrIWbLjsbqfXX5bIJNvgBugGA==} + peerDependencies: + '@nestjs/common': ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 + + '@nestjs/mapped-types@2.1.0': + resolution: {integrity: sha512-W+n+rM69XsFdwORF11UqJahn4J3xi4g/ZEOlJNL6KoW5ygWSmBB2p0S2BZ4FQeS/NDH72e6xIcu35SfJnE8bXw==} + peerDependencies: + '@nestjs/common': ^10.0.0 || ^11.0.0 + class-transformer: ^0.4.0 || ^0.5.0 + class-validator: ^0.13.0 || ^0.14.0 + reflect-metadata: ^0.1.12 || ^0.2.0 + peerDependenciesMeta: + class-transformer: + optional: true + class-validator: + optional: true + '@nestjs/platform-express@11.1.13': resolution: {integrity: sha512-LYmi43BrAs1n74kLCUfXcHag7s1CmGETcFbf9IVyA/KWXAuAH95G3wEaZZiyabOLFNwq4ifnRGnIwUwW7cz3+w==} peerDependencies: @@ -835,6 +868,23 @@ packages: peerDependencies: typescript: '>=4.8.2' + '@nestjs/swagger@11.2.6': + resolution: {integrity: sha512-oiXOxMQqDFyv1AKAqFzSo6JPvMEs4uA36Eyz/s2aloZLxUjcLfUMELSLSNQunr61xCPTpwEOShfmO7NIufKXdA==} + peerDependencies: + '@fastify/static': ^8.0.0 || ^9.0.0 + '@nestjs/common': ^11.0.1 + '@nestjs/core': ^11.0.1 + class-transformer: '*' + class-validator: '*' + reflect-metadata: ^0.1.12 || ^0.2.0 + peerDependenciesMeta: + '@fastify/static': + optional: true + class-transformer: + optional: true + class-validator: + optional: true + '@nestjs/testing@11.1.13': resolution: {integrity: sha512-bOWP8nLEZAOEEX8jAZGBCc1yU0+nv4g2ipc+QEzkVUe3eEEUKHKaeGafJ3GtDuGavlZKfkXEqflZuICdavu5dQ==} peerDependencies: @@ -934,6 +984,9 @@ packages: react: ^18.0.0 || ^19.0.0 react-dom: ^18.0.0 || ^19.0.0 + '@scarf/scarf@1.4.0': + resolution: {integrity: sha512-xxeapPiUXdZAE3che6f3xogoJPeZgig6omHEy1rIY5WVsB3H2BHNnZH+gHG6x91SCWyQCzWGsuL2Hh3ClO5/qQ==} + '@sinclair/typebox@0.27.10': resolution: {integrity: sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA==} @@ -1123,9 +1176,15 @@ packages: '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + '@types/jsonwebtoken@9.0.10': + resolution: {integrity: sha512-asx5hIG9Qmf/1oStypjanR7iKTv0gXQ1Ov/jfrX6kS/EO0OFni8orbmGCn0672NHR3kXHwpAwR+B368ZGN/2rA==} + '@types/methods@1.1.4': resolution: {integrity: sha512-ymXWVrDiCxTBE3+RIrrP533E70eA+9qu7zdWoHuOmGujkYtzf4HQF96b8nwHLqhuf4ykX61IGRIB38CC6/sImQ==} + '@types/ms@2.1.0': + resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==} + '@types/node@22.19.10': resolution: {integrity: sha512-tF5VOugLS/EuDlTBijk0MqABfP8UxgYazTLo3uIn3b4yJgg26QRbVYJYsDtHrjdDUIRfP70+VfhTTc+CE1yskw==} @@ -1156,6 +1215,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==} @@ -1515,6 +1577,9 @@ packages: buffer-crc32@0.2.13: resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==} + buffer-equal-constant-time@1.0.1: + resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==} + buffer-from@1.1.2: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} @@ -1603,6 +1668,12 @@ packages: cjs-module-lexer@1.4.3: resolution: {integrity: sha512-9z8TZaGM1pfswYeXrUpzPrkx8UnWYdhJclsiYMm6x/w5+nN+8Tf/LnAgfLGQCm59qAOxU8WwHEq2vNwF6i4j+Q==} + 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'} @@ -1830,6 +1901,9 @@ packages: resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} engines: {node: '>= 0.4'} + ecdsa-sig-formatter@1.0.11: + resolution: {integrity: sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==} + ee-first@1.1.1: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} @@ -2576,6 +2650,16 @@ packages: jsonfile@6.2.0: resolution: {integrity: sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==} + jsonwebtoken@9.0.3: + resolution: {integrity: sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==} + engines: {node: '>=12', npm: '>=6'} + + jwa@2.0.1: + resolution: {integrity: sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==} + + jws@4.0.1: + resolution: {integrity: sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==} + keyv@4.5.4: resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} @@ -2595,6 +2679,9 @@ packages: resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} engines: {node: '>= 0.8.0'} + libphonenumber-js@1.12.37: + resolution: {integrity: sha512-rDU6bkpuMs8YRt/UpkuYEAsYSoNuDEbrE41I3KNvmXREGH6DGBJ8Wbak4by29wNOQ27zk4g4HL82zf0OGhwRuw==} + lilconfig@2.1.0: resolution: {integrity: sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==} engines: {node: '>=10'} @@ -2618,12 +2705,33 @@ packages: resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} engines: {node: '>=10'} + lodash.includes@4.3.0: + resolution: {integrity: sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==} + + lodash.isboolean@3.0.3: + resolution: {integrity: sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==} + + lodash.isinteger@4.0.4: + resolution: {integrity: sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==} + + lodash.isnumber@3.0.3: + resolution: {integrity: sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==} + + lodash.isplainobject@4.0.6: + resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==} + + lodash.isstring@4.0.1: + resolution: {integrity: sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==} + lodash.memoize@4.1.2: resolution: {integrity: sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==} lodash.merge@4.6.2: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} + lodash.once@4.1.1: + resolution: {integrity: sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==} + lodash@4.17.21: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} @@ -3377,6 +3485,9 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} + swagger-ui-dist@5.31.0: + resolution: {integrity: sha512-zSUTIck02fSga6rc0RZP3b7J7wgHXwLea8ZjgLA3Vgnb8QeOl3Wou2/j5QkzSGeoz6HusP/coYuJl33aQxQZpg==} + symbol-observable@4.0.0: resolution: {integrity: sha512-b19dMThMV4HVFynSAM1++gBHAbk2Tc/osgLIBZMKsyqh34jb2e8Os7T6ZW/Bt3pJFdBTd2JwAnAAEQV7rSNvcQ==} engines: {node: '>=0.10'} @@ -3604,6 +3715,10 @@ packages: typescript: optional: true + validator@13.15.26: + resolution: {integrity: sha512-spH26xU080ydGggxRyR1Yhcbgx+j3y5jbNXk/8L+iRvdIEQ4uTRH2Sgf2dokud6Q4oAtsbNvJ1Ft+9xmm6IZcA==} + engines: {node: '>= 0.10'} + vary@1.1.2: resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} engines: {node: '>= 0.8'} @@ -4390,6 +4505,8 @@ snapshots: '@lukeed/csprng@1.1.0': {} + '@microsoft/tsdoc@0.16.0': {} + '@mrleebo/prisma-ast@0.13.1': dependencies: chevrotain: 10.5.0 @@ -4496,7 +4613,7 @@ snapshots: - uglify-js - webpack-cli - '@nestjs/common@11.1.13(reflect-metadata@0.2.2)(rxjs@7.8.2)': + '@nestjs/common@11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2)': dependencies: file-type: 21.3.0 iterare: 1.2.1 @@ -4505,20 +4622,23 @@ 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/config@4.0.3(@nestjs/common@11.1.13(reflect-metadata@0.2.2)(rxjs@7.8.2))(rxjs@7.8.2)': + '@nestjs/config@4.0.3(@nestjs/common@11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(rxjs@7.8.2)': dependencies: - '@nestjs/common': 11.1.13(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nestjs/common': 11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) dotenv: 17.2.3 dotenv-expand: 12.0.3 lodash: 4.17.23 rxjs: 7.8.2 - '@nestjs/core@11.1.13(@nestjs/common@11.1.13(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@11.1.13)(reflect-metadata@0.2.2)(rxjs@7.8.2)': + '@nestjs/core@11.1.13(@nestjs/common@11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@11.1.13)(reflect-metadata@0.2.2)(rxjs@7.8.2)': dependencies: - '@nestjs/common': 11.1.13(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nestjs/common': 11.1.13(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 @@ -4528,12 +4648,26 @@ snapshots: tslib: 2.8.1 uid: 2.0.2 optionalDependencies: - '@nestjs/platform-express': 11.1.13(@nestjs/common@11.1.13(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.13) + '@nestjs/platform-express': 11.1.13(@nestjs/common@11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.13) - '@nestjs/platform-express@11.1.13(@nestjs/common@11.1.13(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.13)': + '@nestjs/jwt@11.0.2(@nestjs/common@11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))': dependencies: - '@nestjs/common': 11.1.13(reflect-metadata@0.2.2)(rxjs@7.8.2) - '@nestjs/core': 11.1.13(@nestjs/common@11.1.13(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@11.1.13)(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nestjs/common': 11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@types/jsonwebtoken': 9.0.10 + jsonwebtoken: 9.0.3 + + '@nestjs/mapped-types@2.1.0(@nestjs/common@11.1.13(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.13(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.13(@nestjs/common@11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.13)': + dependencies: + '@nestjs/common': 11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nestjs/core': 11.1.13(@nestjs/common@11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@11.1.13)(reflect-metadata@0.2.2)(rxjs@7.8.2) cors: 2.8.6 express: 5.2.1 multer: 2.0.2 @@ -4553,13 +4687,28 @@ snapshots: transitivePeerDependencies: - chokidar - '@nestjs/testing@11.1.13(@nestjs/common@11.1.13(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.13)(@nestjs/platform-express@11.1.13)': + '@nestjs/swagger@11.2.6(@nestjs/common@11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.13)(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)': dependencies: - '@nestjs/common': 11.1.13(reflect-metadata@0.2.2)(rxjs@7.8.2) - '@nestjs/core': 11.1.13(@nestjs/common@11.1.13(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@11.1.13)(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@microsoft/tsdoc': 0.16.0 + '@nestjs/common': 11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nestjs/core': 11.1.13(@nestjs/common@11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@11.1.13)(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nestjs/mapped-types': 2.1.0(@nestjs/common@11.1.13(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.23 + path-to-regexp: 8.3.0 + reflect-metadata: 0.2.2 + swagger-ui-dist: 5.31.0 + optionalDependencies: + class-transformer: 0.5.1 + class-validator: 0.14.3 + + '@nestjs/testing@11.1.13(@nestjs/common@11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.13)(@nestjs/platform-express@11.1.13)': + dependencies: + '@nestjs/common': 11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nestjs/core': 11.1.13(@nestjs/common@11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@11.1.13)(reflect-metadata@0.2.2)(rxjs@7.8.2) tslib: 2.8.1 optionalDependencies: - '@nestjs/platform-express': 11.1.13(@nestjs/common@11.1.13(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.13) + '@nestjs/platform-express': 11.1.13(@nestjs/common@11.1.13(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.13) '@noble/hashes@1.8.0': {} @@ -4672,6 +4821,8 @@ snapshots: react: 19.2.4 react-dom: 19.2.4(react@19.2.4) + '@scarf/scarf@1.4.0': {} + '@sinclair/typebox@0.27.10': {} '@sindresorhus/is@5.6.0': {} @@ -4868,8 +5019,15 @@ snapshots: '@types/json-schema@7.0.15': {} + '@types/jsonwebtoken@9.0.10': + dependencies: + '@types/ms': 2.1.0 + '@types/node': 22.19.10 + '@types/methods@1.1.4': {} + '@types/ms@2.1.0': {} + '@types/node@22.19.10': dependencies: undici-types: 6.21.0 @@ -4911,6 +5069,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': @@ -5401,6 +5561,8 @@ snapshots: buffer-crc32@0.2.13: {} + buffer-equal-constant-time@1.0.1: {} + buffer-from@1.1.2: {} buffer@5.7.1: @@ -5493,6 +5655,14 @@ snapshots: cjs-module-lexer@1.4.3: {} + class-transformer@0.5.1: {} + + class-validator@0.14.3: + dependencies: + '@types/validator': 13.15.10 + libphonenumber-js: 1.12.37 + validator: 13.15.26 + cli-cursor@3.1.0: dependencies: restore-cursor: 3.1.0 @@ -5674,6 +5844,10 @@ snapshots: es-errors: 1.3.0 gopd: 1.2.0 + ecdsa-sig-formatter@1.0.11: + dependencies: + safe-buffer: 5.2.1 + ee-first@1.1.1: {} effect@3.18.4: @@ -6649,6 +6823,30 @@ snapshots: optionalDependencies: graceful-fs: 4.2.11 + jsonwebtoken@9.0.3: + dependencies: + jws: 4.0.1 + lodash.includes: 4.3.0 + lodash.isboolean: 3.0.3 + lodash.isinteger: 4.0.4 + lodash.isnumber: 3.0.3 + lodash.isplainobject: 4.0.6 + lodash.isstring: 4.0.1 + lodash.once: 4.1.1 + ms: 2.1.3 + semver: 7.7.4 + + jwa@2.0.1: + dependencies: + buffer-equal-constant-time: 1.0.1 + ecdsa-sig-formatter: 1.0.11 + safe-buffer: 5.2.1 + + jws@4.0.1: + dependencies: + jwa: 2.0.1 + safe-buffer: 5.2.1 + keyv@4.5.4: dependencies: json-buffer: 3.0.1 @@ -6664,6 +6862,8 @@ snapshots: prelude-ls: 1.2.1 type-check: 0.4.0 + libphonenumber-js@1.12.37: {} + lilconfig@2.1.0: {} lines-and-columns@1.2.4: {} @@ -6680,10 +6880,24 @@ snapshots: dependencies: p-locate: 5.0.0 + lodash.includes@4.3.0: {} + + lodash.isboolean@3.0.3: {} + + lodash.isinteger@4.0.4: {} + + lodash.isnumber@3.0.3: {} + + lodash.isplainobject@4.0.6: {} + + lodash.isstring@4.0.1: {} + lodash.memoize@4.1.2: {} lodash.merge@4.6.2: {} + lodash.once@4.1.1: {} + lodash@4.17.21: {} lodash@4.17.23: {} @@ -7395,6 +7609,10 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} + swagger-ui-dist@5.31.0: + dependencies: + '@scarf/scarf': 1.4.0 + symbol-observable@4.0.0: {} synckit@0.11.12: @@ -7614,6 +7832,8 @@ snapshots: optionalDependencies: typescript: 5.9.3 + validator@13.15.26: {} + vary@1.1.2: {} walker@1.0.8: diff --git a/prisma/generated/prisma/browser.ts b/prisma/generated/prisma/browser.ts index 1a6dee3..709f652 100644 --- a/prisma/generated/prisma/browser.ts +++ b/prisma/generated/prisma/browser.ts @@ -17,4 +17,23 @@ import * as Prisma from './internal/prismaNamespaceBrowser' export { Prisma } export * as $Enums from './enums' export * from './enums'; - +/** + * Model OrganizationJoinRequest + * + */ +export type OrganizationJoinRequest = Prisma.OrganizationJoinRequestModel +/** + * Model OrganizationUserJoinTable + * + */ +export type OrganizationUserJoinTable = Prisma.OrganizationUserJoinTableModel +/** + * Model Organization + * + */ +export type Organization = Prisma.OrganizationModel +/** + * Model User + * + */ +export type User = Prisma.UserModel diff --git a/prisma/generated/prisma/client.ts b/prisma/generated/prisma/client.ts index 168d770..954c9ae 100644 --- a/prisma/generated/prisma/client.ts +++ b/prisma/generated/prisma/client.ts @@ -27,8 +27,8 @@ export * from "./enums" * @example * ``` * const prisma = new PrismaClient() - * // Fetch zero or more Users - * const users = await prisma.user.findMany() + * // Fetch zero or more OrganizationJoinRequests + * const organizationJoinRequests = await prisma.organizationJoinRequest.findMany() * ``` * * Read more in our [docs](https://pris.ly/d/client). @@ -37,4 +37,23 @@ export const PrismaClient = $Class.getPrismaClientClass() export type PrismaClient = $Class.PrismaClient export { Prisma } - +/** + * Model OrganizationJoinRequest + * + */ +export type OrganizationJoinRequest = Prisma.OrganizationJoinRequestModel +/** + * Model OrganizationUserJoinTable + * + */ +export type OrganizationUserJoinTable = Prisma.OrganizationUserJoinTableModel +/** + * Model Organization + * + */ +export type Organization = Prisma.OrganizationModel +/** + * Model User + * + */ +export type User = Prisma.UserModel diff --git a/prisma/generated/prisma/commonInputTypes.ts b/prisma/generated/prisma/commonInputTypes.ts index a905683..5d74916 100644 --- a/prisma/generated/prisma/commonInputTypes.ts +++ b/prisma/generated/prisma/commonInputTypes.ts @@ -14,5 +14,387 @@ import * as $Enums from "./enums" import type * as Prisma from "./internal/prismaNamespace" +export type StringFilter<$PrismaModel = never> = { + equals?: string | Prisma.StringFieldRefInput<$PrismaModel> + in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> + notIn?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> + lt?: string | Prisma.StringFieldRefInput<$PrismaModel> + lte?: string | Prisma.StringFieldRefInput<$PrismaModel> + gt?: string | Prisma.StringFieldRefInput<$PrismaModel> + gte?: string | Prisma.StringFieldRefInput<$PrismaModel> + contains?: string | Prisma.StringFieldRefInput<$PrismaModel> + startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + mode?: Prisma.QueryMode + not?: Prisma.NestedStringFilter<$PrismaModel> | string +} + +export type EnumORGANIZATION_JOIN_REQUESTFilter<$PrismaModel = never> = { + equals?: $Enums.ORGANIZATION_JOIN_REQUEST | Prisma.EnumORGANIZATION_JOIN_REQUESTFieldRefInput<$PrismaModel> + in?: $Enums.ORGANIZATION_JOIN_REQUEST[] | Prisma.ListEnumORGANIZATION_JOIN_REQUESTFieldRefInput<$PrismaModel> + notIn?: $Enums.ORGANIZATION_JOIN_REQUEST[] | Prisma.ListEnumORGANIZATION_JOIN_REQUESTFieldRefInput<$PrismaModel> + not?: Prisma.NestedEnumORGANIZATION_JOIN_REQUESTFilter<$PrismaModel> | $Enums.ORGANIZATION_JOIN_REQUEST +} + +export type DateTimeFilter<$PrismaModel = never> = { + equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + in?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> + notIn?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> + lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + not?: Prisma.NestedDateTimeFilter<$PrismaModel> | Date | string +} + +export type StringNullableFilter<$PrismaModel = never> = { + equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null + in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> | null + notIn?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> | null + lt?: string | Prisma.StringFieldRefInput<$PrismaModel> + lte?: string | Prisma.StringFieldRefInput<$PrismaModel> + gt?: string | Prisma.StringFieldRefInput<$PrismaModel> + gte?: string | Prisma.StringFieldRefInput<$PrismaModel> + contains?: string | Prisma.StringFieldRefInput<$PrismaModel> + startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + mode?: Prisma.QueryMode + not?: Prisma.NestedStringNullableFilter<$PrismaModel> | string | null +} + +export type SortOrderInput = { + sort: Prisma.SortOrder + nulls?: Prisma.NullsOrder +} + +export type StringWithAggregatesFilter<$PrismaModel = never> = { + equals?: string | Prisma.StringFieldRefInput<$PrismaModel> + in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> + notIn?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> + lt?: string | Prisma.StringFieldRefInput<$PrismaModel> + lte?: string | Prisma.StringFieldRefInput<$PrismaModel> + gt?: string | Prisma.StringFieldRefInput<$PrismaModel> + gte?: string | Prisma.StringFieldRefInput<$PrismaModel> + contains?: string | Prisma.StringFieldRefInput<$PrismaModel> + startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + mode?: Prisma.QueryMode + not?: Prisma.NestedStringWithAggregatesFilter<$PrismaModel> | string + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedStringFilter<$PrismaModel> + _max?: Prisma.NestedStringFilter<$PrismaModel> +} + +export type EnumORGANIZATION_JOIN_REQUESTWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.ORGANIZATION_JOIN_REQUEST | Prisma.EnumORGANIZATION_JOIN_REQUESTFieldRefInput<$PrismaModel> + in?: $Enums.ORGANIZATION_JOIN_REQUEST[] | Prisma.ListEnumORGANIZATION_JOIN_REQUESTFieldRefInput<$PrismaModel> + notIn?: $Enums.ORGANIZATION_JOIN_REQUEST[] | Prisma.ListEnumORGANIZATION_JOIN_REQUESTFieldRefInput<$PrismaModel> + not?: Prisma.NestedEnumORGANIZATION_JOIN_REQUESTWithAggregatesFilter<$PrismaModel> | $Enums.ORGANIZATION_JOIN_REQUEST + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedEnumORGANIZATION_JOIN_REQUESTFilter<$PrismaModel> + _max?: Prisma.NestedEnumORGANIZATION_JOIN_REQUESTFilter<$PrismaModel> +} + +export type DateTimeWithAggregatesFilter<$PrismaModel = never> = { + equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + in?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> + notIn?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> + lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + not?: Prisma.NestedDateTimeWithAggregatesFilter<$PrismaModel> | Date | string + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedDateTimeFilter<$PrismaModel> + _max?: Prisma.NestedDateTimeFilter<$PrismaModel> +} + +export type StringNullableWithAggregatesFilter<$PrismaModel = never> = { + equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null + in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> | null + notIn?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> | null + lt?: string | Prisma.StringFieldRefInput<$PrismaModel> + lte?: string | Prisma.StringFieldRefInput<$PrismaModel> + gt?: string | Prisma.StringFieldRefInput<$PrismaModel> + gte?: string | Prisma.StringFieldRefInput<$PrismaModel> + contains?: string | Prisma.StringFieldRefInput<$PrismaModel> + startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + mode?: Prisma.QueryMode + not?: Prisma.NestedStringNullableWithAggregatesFilter<$PrismaModel> | string | null + _count?: Prisma.NestedIntNullableFilter<$PrismaModel> + _min?: Prisma.NestedStringNullableFilter<$PrismaModel> + _max?: Prisma.NestedStringNullableFilter<$PrismaModel> +} + +export type EnumORG_ROLEFilter<$PrismaModel = never> = { + equals?: $Enums.ORG_ROLE | Prisma.EnumORG_ROLEFieldRefInput<$PrismaModel> + in?: $Enums.ORG_ROLE[] | Prisma.ListEnumORG_ROLEFieldRefInput<$PrismaModel> + notIn?: $Enums.ORG_ROLE[] | Prisma.ListEnumORG_ROLEFieldRefInput<$PrismaModel> + not?: Prisma.NestedEnumORG_ROLEFilter<$PrismaModel> | $Enums.ORG_ROLE +} + +export type EnumORG_ROLEWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.ORG_ROLE | Prisma.EnumORG_ROLEFieldRefInput<$PrismaModel> + in?: $Enums.ORG_ROLE[] | Prisma.ListEnumORG_ROLEFieldRefInput<$PrismaModel> + notIn?: $Enums.ORG_ROLE[] | Prisma.ListEnumORG_ROLEFieldRefInput<$PrismaModel> + not?: Prisma.NestedEnumORG_ROLEWithAggregatesFilter<$PrismaModel> | $Enums.ORG_ROLE + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedEnumORG_ROLEFilter<$PrismaModel> + _max?: Prisma.NestedEnumORG_ROLEFilter<$PrismaModel> +} + +export type EnumUSER_ROLEFilter<$PrismaModel = never> = { + equals?: $Enums.USER_ROLE | Prisma.EnumUSER_ROLEFieldRefInput<$PrismaModel> + in?: $Enums.USER_ROLE[] | Prisma.ListEnumUSER_ROLEFieldRefInput<$PrismaModel> + notIn?: $Enums.USER_ROLE[] | Prisma.ListEnumUSER_ROLEFieldRefInput<$PrismaModel> + not?: Prisma.NestedEnumUSER_ROLEFilter<$PrismaModel> | $Enums.USER_ROLE +} + +export type BoolNullableFilter<$PrismaModel = never> = { + equals?: boolean | Prisma.BooleanFieldRefInput<$PrismaModel> | null + not?: Prisma.NestedBoolNullableFilter<$PrismaModel> | boolean | null +} + +export type DateTimeNullableFilter<$PrismaModel = never> = { + equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null + in?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | null + notIn?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | null + lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + not?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> | Date | string | null +} + +export type EnumUSER_ROLEWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.USER_ROLE | Prisma.EnumUSER_ROLEFieldRefInput<$PrismaModel> + in?: $Enums.USER_ROLE[] | Prisma.ListEnumUSER_ROLEFieldRefInput<$PrismaModel> + notIn?: $Enums.USER_ROLE[] | Prisma.ListEnumUSER_ROLEFieldRefInput<$PrismaModel> + not?: Prisma.NestedEnumUSER_ROLEWithAggregatesFilter<$PrismaModel> | $Enums.USER_ROLE + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedEnumUSER_ROLEFilter<$PrismaModel> + _max?: Prisma.NestedEnumUSER_ROLEFilter<$PrismaModel> +} + +export type BoolNullableWithAggregatesFilter<$PrismaModel = never> = { + equals?: boolean | Prisma.BooleanFieldRefInput<$PrismaModel> | null + not?: Prisma.NestedBoolNullableWithAggregatesFilter<$PrismaModel> | boolean | null + _count?: Prisma.NestedIntNullableFilter<$PrismaModel> + _min?: Prisma.NestedBoolNullableFilter<$PrismaModel> + _max?: Prisma.NestedBoolNullableFilter<$PrismaModel> +} + +export type DateTimeNullableWithAggregatesFilter<$PrismaModel = never> = { + equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null + in?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | null + notIn?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | null + lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + not?: Prisma.NestedDateTimeNullableWithAggregatesFilter<$PrismaModel> | Date | string | null + _count?: Prisma.NestedIntNullableFilter<$PrismaModel> + _min?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> + _max?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> +} + +export type NestedStringFilter<$PrismaModel = never> = { + equals?: string | Prisma.StringFieldRefInput<$PrismaModel> + in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> + notIn?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> + lt?: string | Prisma.StringFieldRefInput<$PrismaModel> + lte?: string | Prisma.StringFieldRefInput<$PrismaModel> + gt?: string | Prisma.StringFieldRefInput<$PrismaModel> + gte?: string | Prisma.StringFieldRefInput<$PrismaModel> + contains?: string | Prisma.StringFieldRefInput<$PrismaModel> + startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + not?: Prisma.NestedStringFilter<$PrismaModel> | string +} + +export type NestedEnumORGANIZATION_JOIN_REQUESTFilter<$PrismaModel = never> = { + equals?: $Enums.ORGANIZATION_JOIN_REQUEST | Prisma.EnumORGANIZATION_JOIN_REQUESTFieldRefInput<$PrismaModel> + in?: $Enums.ORGANIZATION_JOIN_REQUEST[] | Prisma.ListEnumORGANIZATION_JOIN_REQUESTFieldRefInput<$PrismaModel> + notIn?: $Enums.ORGANIZATION_JOIN_REQUEST[] | Prisma.ListEnumORGANIZATION_JOIN_REQUESTFieldRefInput<$PrismaModel> + not?: Prisma.NestedEnumORGANIZATION_JOIN_REQUESTFilter<$PrismaModel> | $Enums.ORGANIZATION_JOIN_REQUEST +} + +export type NestedDateTimeFilter<$PrismaModel = never> = { + equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + in?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> + notIn?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> + lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + not?: Prisma.NestedDateTimeFilter<$PrismaModel> | Date | string +} + +export type NestedStringNullableFilter<$PrismaModel = never> = { + equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null + in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> | null + notIn?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> | null + lt?: string | Prisma.StringFieldRefInput<$PrismaModel> + lte?: string | Prisma.StringFieldRefInput<$PrismaModel> + gt?: string | Prisma.StringFieldRefInput<$PrismaModel> + gte?: string | Prisma.StringFieldRefInput<$PrismaModel> + contains?: string | Prisma.StringFieldRefInput<$PrismaModel> + startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + not?: Prisma.NestedStringNullableFilter<$PrismaModel> | string | null +} + +export type NestedStringWithAggregatesFilter<$PrismaModel = never> = { + equals?: string | Prisma.StringFieldRefInput<$PrismaModel> + in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> + notIn?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> + lt?: string | Prisma.StringFieldRefInput<$PrismaModel> + lte?: string | Prisma.StringFieldRefInput<$PrismaModel> + gt?: string | Prisma.StringFieldRefInput<$PrismaModel> + gte?: string | Prisma.StringFieldRefInput<$PrismaModel> + contains?: string | Prisma.StringFieldRefInput<$PrismaModel> + startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + not?: Prisma.NestedStringWithAggregatesFilter<$PrismaModel> | string + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedStringFilter<$PrismaModel> + _max?: Prisma.NestedStringFilter<$PrismaModel> +} + +export type NestedIntFilter<$PrismaModel = never> = { + equals?: number | Prisma.IntFieldRefInput<$PrismaModel> + in?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel> + notIn?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel> + lt?: number | Prisma.IntFieldRefInput<$PrismaModel> + lte?: number | Prisma.IntFieldRefInput<$PrismaModel> + gt?: number | Prisma.IntFieldRefInput<$PrismaModel> + gte?: number | Prisma.IntFieldRefInput<$PrismaModel> + not?: Prisma.NestedIntFilter<$PrismaModel> | number +} + +export type NestedEnumORGANIZATION_JOIN_REQUESTWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.ORGANIZATION_JOIN_REQUEST | Prisma.EnumORGANIZATION_JOIN_REQUESTFieldRefInput<$PrismaModel> + in?: $Enums.ORGANIZATION_JOIN_REQUEST[] | Prisma.ListEnumORGANIZATION_JOIN_REQUESTFieldRefInput<$PrismaModel> + notIn?: $Enums.ORGANIZATION_JOIN_REQUEST[] | Prisma.ListEnumORGANIZATION_JOIN_REQUESTFieldRefInput<$PrismaModel> + not?: Prisma.NestedEnumORGANIZATION_JOIN_REQUESTWithAggregatesFilter<$PrismaModel> | $Enums.ORGANIZATION_JOIN_REQUEST + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedEnumORGANIZATION_JOIN_REQUESTFilter<$PrismaModel> + _max?: Prisma.NestedEnumORGANIZATION_JOIN_REQUESTFilter<$PrismaModel> +} + +export type NestedDateTimeWithAggregatesFilter<$PrismaModel = never> = { + equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + in?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> + notIn?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> + lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + not?: Prisma.NestedDateTimeWithAggregatesFilter<$PrismaModel> | Date | string + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedDateTimeFilter<$PrismaModel> + _max?: Prisma.NestedDateTimeFilter<$PrismaModel> +} + +export type NestedStringNullableWithAggregatesFilter<$PrismaModel = never> = { + equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null + in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> | null + notIn?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> | null + lt?: string | Prisma.StringFieldRefInput<$PrismaModel> + lte?: string | Prisma.StringFieldRefInput<$PrismaModel> + gt?: string | Prisma.StringFieldRefInput<$PrismaModel> + gte?: string | Prisma.StringFieldRefInput<$PrismaModel> + contains?: string | Prisma.StringFieldRefInput<$PrismaModel> + startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + not?: Prisma.NestedStringNullableWithAggregatesFilter<$PrismaModel> | string | null + _count?: Prisma.NestedIntNullableFilter<$PrismaModel> + _min?: Prisma.NestedStringNullableFilter<$PrismaModel> + _max?: Prisma.NestedStringNullableFilter<$PrismaModel> +} + +export type NestedIntNullableFilter<$PrismaModel = never> = { + equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null + in?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel> | null + notIn?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel> | null + lt?: number | Prisma.IntFieldRefInput<$PrismaModel> + lte?: number | Prisma.IntFieldRefInput<$PrismaModel> + gt?: number | Prisma.IntFieldRefInput<$PrismaModel> + gte?: number | Prisma.IntFieldRefInput<$PrismaModel> + not?: Prisma.NestedIntNullableFilter<$PrismaModel> | number | null +} + +export type NestedEnumORG_ROLEFilter<$PrismaModel = never> = { + equals?: $Enums.ORG_ROLE | Prisma.EnumORG_ROLEFieldRefInput<$PrismaModel> + in?: $Enums.ORG_ROLE[] | Prisma.ListEnumORG_ROLEFieldRefInput<$PrismaModel> + notIn?: $Enums.ORG_ROLE[] | Prisma.ListEnumORG_ROLEFieldRefInput<$PrismaModel> + not?: Prisma.NestedEnumORG_ROLEFilter<$PrismaModel> | $Enums.ORG_ROLE +} + +export type NestedEnumORG_ROLEWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.ORG_ROLE | Prisma.EnumORG_ROLEFieldRefInput<$PrismaModel> + in?: $Enums.ORG_ROLE[] | Prisma.ListEnumORG_ROLEFieldRefInput<$PrismaModel> + notIn?: $Enums.ORG_ROLE[] | Prisma.ListEnumORG_ROLEFieldRefInput<$PrismaModel> + not?: Prisma.NestedEnumORG_ROLEWithAggregatesFilter<$PrismaModel> | $Enums.ORG_ROLE + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedEnumORG_ROLEFilter<$PrismaModel> + _max?: Prisma.NestedEnumORG_ROLEFilter<$PrismaModel> +} + +export type NestedEnumUSER_ROLEFilter<$PrismaModel = never> = { + equals?: $Enums.USER_ROLE | Prisma.EnumUSER_ROLEFieldRefInput<$PrismaModel> + in?: $Enums.USER_ROLE[] | Prisma.ListEnumUSER_ROLEFieldRefInput<$PrismaModel> + notIn?: $Enums.USER_ROLE[] | Prisma.ListEnumUSER_ROLEFieldRefInput<$PrismaModel> + not?: Prisma.NestedEnumUSER_ROLEFilter<$PrismaModel> | $Enums.USER_ROLE +} + +export type NestedBoolNullableFilter<$PrismaModel = never> = { + equals?: boolean | Prisma.BooleanFieldRefInput<$PrismaModel> | null + not?: Prisma.NestedBoolNullableFilter<$PrismaModel> | boolean | null +} + +export type NestedDateTimeNullableFilter<$PrismaModel = never> = { + equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null + in?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | null + notIn?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | null + lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + not?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> | Date | string | null +} + +export type NestedEnumUSER_ROLEWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.USER_ROLE | Prisma.EnumUSER_ROLEFieldRefInput<$PrismaModel> + in?: $Enums.USER_ROLE[] | Prisma.ListEnumUSER_ROLEFieldRefInput<$PrismaModel> + notIn?: $Enums.USER_ROLE[] | Prisma.ListEnumUSER_ROLEFieldRefInput<$PrismaModel> + not?: Prisma.NestedEnumUSER_ROLEWithAggregatesFilter<$PrismaModel> | $Enums.USER_ROLE + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedEnumUSER_ROLEFilter<$PrismaModel> + _max?: Prisma.NestedEnumUSER_ROLEFilter<$PrismaModel> +} + +export type NestedBoolNullableWithAggregatesFilter<$PrismaModel = never> = { + equals?: boolean | Prisma.BooleanFieldRefInput<$PrismaModel> | null + not?: Prisma.NestedBoolNullableWithAggregatesFilter<$PrismaModel> | boolean | null + _count?: Prisma.NestedIntNullableFilter<$PrismaModel> + _min?: Prisma.NestedBoolNullableFilter<$PrismaModel> + _max?: Prisma.NestedBoolNullableFilter<$PrismaModel> +} + +export type NestedDateTimeNullableWithAggregatesFilter<$PrismaModel = never> = { + equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null + in?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | null + notIn?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | null + lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> + not?: Prisma.NestedDateTimeNullableWithAggregatesFilter<$PrismaModel> | Date | string | null + _count?: Prisma.NestedIntNullableFilter<$PrismaModel> + _min?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> + _max?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> +} diff --git a/prisma/generated/prisma/enums.ts b/prisma/generated/prisma/enums.ts index 043572d..e0c7674 100644 --- a/prisma/generated/prisma/enums.ts +++ b/prisma/generated/prisma/enums.ts @@ -9,7 +9,26 @@ * 🟢 You can import this file directly. */ +export const ORGANIZATION_JOIN_REQUEST = { + PENDING: 'PENDING', + ACCEPTED: 'ACCEPTED', + REJECTED: 'REJECTED' +} as const + +export type ORGANIZATION_JOIN_REQUEST = (typeof ORGANIZATION_JOIN_REQUEST)[keyof typeof ORGANIZATION_JOIN_REQUEST] -// This file is empty because there are no enums in the schema. -export {} +export const ORG_ROLE = { + admin: 'admin', + user: 'user' +} as const + +export type ORG_ROLE = (typeof ORG_ROLE)[keyof typeof ORG_ROLE] + + +export const USER_ROLE = { + superadmin: 'superadmin', + ordinary: 'ordinary' +} as const + +export type USER_ROLE = (typeof USER_ROLE)[keyof typeof USER_ROLE] diff --git a/prisma/generated/prisma/internal/class.ts b/prisma/generated/prisma/internal/class.ts index a70b14e..8c43ca0 100644 --- a/prisma/generated/prisma/internal/class.ts +++ b/prisma/generated/prisma/internal/class.ts @@ -20,7 +20,7 @@ const config: runtime.GetPrismaClientConfig = { "clientVersion": "7.3.0", "engineVersion": "9d6ad21cbbceab97458517b147a6a09ff43aa735", "activeProvider": "postgresql", - "inlineSchema": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\n// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?\n// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init\n\ngenerator client {\n provider = \"prisma-client\"\n output = \"../generated/prisma\"\n}\n\ndatasource db {\n provider = \"postgresql\"\n}\n", + "inlineSchema": "model OrganizationJoinRequest {\n userId String\n orgId String\n status ORGANIZATION_JOIN_REQUEST @default(PENDING)\n requestedOn DateTime @default(now())\n rejectReason String?\n\n @@unique([userId, orgId])\n @@map(\"organization_join_request\")\n}\n\nenum ORGANIZATION_JOIN_REQUEST {\n PENDING\n ACCEPTED\n REJECTED\n}\n\nmodel OrganizationUserJoinTable {\n userId String\n orgId String\n role ORG_ROLE @default(user)\n joinedDate DateTime @default(now())\n\n @@unique([userId, orgId])\n @@map(\"organization_user_join\")\n}\n\nenum ORG_ROLE {\n admin\n user\n}\n\nmodel Organization {\n id String @id @default(uuid())\n name String\n description String?\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@map(\"organization\")\n}\n\n// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\n// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?\n// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init\n\ngenerator client {\n provider = \"prisma-client\"\n output = \"../generated/prisma\"\n}\n\ndatasource db {\n provider = \"postgresql\"\n}\n\nmodel User {\n id String @id @default(uuid())\n firstName String\n middleName String?\n lastName String\n email String @unique\n password String\n role USER_ROLE @default(ordinary)\n isVerified Boolean? @default(false) // TODO: Email using queue\n refreshToken String?\n profilePicture String?\n isDeleted Boolean? @default(false)\n deletedAt DateTime?\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@map(\"user\")\n}\n\nenum USER_ROLE {\n superadmin\n ordinary\n}\n", "runtimeDataModel": { "models": {}, "enums": {}, @@ -28,7 +28,7 @@ const config: runtime.GetPrismaClientConfig = { } } -config.runtimeDataModel = JSON.parse("{\"models\":{},\"enums\":{},\"types\":{}}") +config.runtimeDataModel = JSON.parse("{\"models\":{\"OrganizationJoinRequest\":{\"fields\":[{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"orgId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"status\",\"kind\":\"enum\",\"type\":\"ORGANIZATION_JOIN_REQUEST\"},{\"name\":\"requestedOn\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"rejectReason\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":\"organization_join_request\"},\"OrganizationUserJoinTable\":{\"fields\":[{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"orgId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"role\",\"kind\":\"enum\",\"type\":\"ORG_ROLE\"},{\"name\":\"joinedDate\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"organization_user_join\"},\"Organization\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"organization\"},\"User\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"firstName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"middleName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"lastName\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"role\",\"kind\":\"enum\",\"type\":\"USER_ROLE\"},{\"name\":\"isVerified\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"refreshToken\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"profilePicture\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"isDeleted\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"deletedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":\"user\"}},\"enums\":{},\"types\":{}}") async function decodeBase64AsWasm(wasmBase64: string): Promise { const { Buffer } = await import('node:buffer') @@ -60,8 +60,8 @@ export interface PrismaClientConstructor { * @example * ``` * const prisma = new PrismaClient() - * // Fetch zero or more Users - * const users = await prisma.user.findMany() + * // Fetch zero or more OrganizationJoinRequests + * const organizationJoinRequests = await prisma.organizationJoinRequest.findMany() * ``` * * Read more in our [docs](https://pris.ly/d/client). @@ -82,8 +82,8 @@ export interface PrismaClientConstructor { * @example * ``` * const prisma = new PrismaClient() - * // Fetch zero or more Users - * const users = await prisma.user.findMany() + * // Fetch zero or more OrganizationJoinRequests + * const organizationJoinRequests = await prisma.organizationJoinRequest.findMany() * ``` * * Read more in our [docs](https://pris.ly/d/client). @@ -176,7 +176,45 @@ export interface PrismaClient< extArgs: ExtArgs }>> - + /** + * `prisma.organizationJoinRequest`: Exposes CRUD operations for the **OrganizationJoinRequest** model. + * Example usage: + * ```ts + * // Fetch zero or more OrganizationJoinRequests + * const organizationJoinRequests = await prisma.organizationJoinRequest.findMany() + * ``` + */ + get organizationJoinRequest(): Prisma.OrganizationJoinRequestDelegate; + + /** + * `prisma.organizationUserJoinTable`: Exposes CRUD operations for the **OrganizationUserJoinTable** model. + * Example usage: + * ```ts + * // Fetch zero or more OrganizationUserJoinTables + * const organizationUserJoinTables = await prisma.organizationUserJoinTable.findMany() + * ``` + */ + get organizationUserJoinTable(): Prisma.OrganizationUserJoinTableDelegate; + + /** + * `prisma.organization`: Exposes CRUD operations for the **Organization** model. + * Example usage: + * ```ts + * // Fetch zero or more Organizations + * const organizations = await prisma.organization.findMany() + * ``` + */ + get organization(): Prisma.OrganizationDelegate; + + /** + * `prisma.user`: Exposes CRUD operations for the **User** model. + * Example usage: + * ```ts + * // Fetch zero or more Users + * const users = await prisma.user.findMany() + * ``` + */ + get user(): Prisma.UserDelegate; } export function getPrismaClientClass(): PrismaClientConstructor { diff --git a/prisma/generated/prisma/internal/prismaNamespace.ts b/prisma/generated/prisma/internal/prismaNamespace.ts index 028c02f..32f3dbe 100644 --- a/prisma/generated/prisma/internal/prismaNamespace.ts +++ b/prisma/generated/prisma/internal/prismaNamespace.ts @@ -384,7 +384,10 @@ type FieldRefInputType = Model extends never ? never : FieldRe export const ModelName = { - + OrganizationJoinRequest: 'OrganizationJoinRequest', + OrganizationUserJoinTable: 'OrganizationUserJoinTable', + Organization: 'Organization', + User: 'User' } as const export type ModelName = (typeof ModelName)[keyof typeof ModelName] @@ -400,10 +403,307 @@ export type TypeMap + fields: Prisma.OrganizationJoinRequestFieldRefs + operations: { + findUnique: { + args: Prisma.OrganizationJoinRequestFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.OrganizationJoinRequestFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.OrganizationJoinRequestFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.OrganizationJoinRequestFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.OrganizationJoinRequestFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.OrganizationJoinRequestCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.OrganizationJoinRequestCreateManyArgs + result: BatchPayload + } + createManyAndReturn: { + args: Prisma.OrganizationJoinRequestCreateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + delete: { + args: Prisma.OrganizationJoinRequestDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.OrganizationJoinRequestUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.OrganizationJoinRequestDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.OrganizationJoinRequestUpdateManyArgs + result: BatchPayload + } + updateManyAndReturn: { + args: Prisma.OrganizationJoinRequestUpdateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + upsert: { + args: Prisma.OrganizationJoinRequestUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.OrganizationJoinRequestAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.OrganizationJoinRequestGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.OrganizationJoinRequestCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } + OrganizationUserJoinTable: { + payload: Prisma.$OrganizationUserJoinTablePayload + fields: Prisma.OrganizationUserJoinTableFieldRefs + operations: { + findUnique: { + args: Prisma.OrganizationUserJoinTableFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.OrganizationUserJoinTableFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.OrganizationUserJoinTableFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.OrganizationUserJoinTableFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.OrganizationUserJoinTableFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.OrganizationUserJoinTableCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.OrganizationUserJoinTableCreateManyArgs + result: BatchPayload + } + createManyAndReturn: { + args: Prisma.OrganizationUserJoinTableCreateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + delete: { + args: Prisma.OrganizationUserJoinTableDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.OrganizationUserJoinTableUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.OrganizationUserJoinTableDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.OrganizationUserJoinTableUpdateManyArgs + result: BatchPayload + } + updateManyAndReturn: { + args: Prisma.OrganizationUserJoinTableUpdateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + upsert: { + args: Prisma.OrganizationUserJoinTableUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.OrganizationUserJoinTableAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.OrganizationUserJoinTableGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.OrganizationUserJoinTableCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } + Organization: { + payload: Prisma.$OrganizationPayload + fields: Prisma.OrganizationFieldRefs + operations: { + findUnique: { + args: Prisma.OrganizationFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.OrganizationFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.OrganizationFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.OrganizationFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.OrganizationFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.OrganizationCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.OrganizationCreateManyArgs + result: BatchPayload + } + createManyAndReturn: { + args: Prisma.OrganizationCreateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + delete: { + args: Prisma.OrganizationDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.OrganizationUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.OrganizationDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.OrganizationUpdateManyArgs + result: BatchPayload + } + updateManyAndReturn: { + args: Prisma.OrganizationUpdateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + upsert: { + args: Prisma.OrganizationUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.OrganizationAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.OrganizationGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.OrganizationCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } + User: { + payload: Prisma.$UserPayload + fields: Prisma.UserFieldRefs + operations: { + findUnique: { + args: Prisma.UserFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.UserFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.UserFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.UserFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.UserFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.UserCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.UserCreateManyArgs + result: BatchPayload + } + createManyAndReturn: { + args: Prisma.UserCreateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + delete: { + args: Prisma.UserDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.UserUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.UserDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.UserUpdateManyArgs + result: BatchPayload + } + updateManyAndReturn: { + args: Prisma.UserUpdateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + upsert: { + args: Prisma.UserUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.UserAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.UserGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.UserCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } + } } & { other: { payload: any @@ -442,7 +742,177 @@ export const TransactionIsolationLevel = runtime.makeStrictEnum({ export type TransactionIsolationLevel = (typeof TransactionIsolationLevel)[keyof typeof TransactionIsolationLevel] +export const OrganizationJoinRequestScalarFieldEnum = { + userId: 'userId', + orgId: 'orgId', + status: 'status', + requestedOn: 'requestedOn', + rejectReason: 'rejectReason' +} as const +export type OrganizationJoinRequestScalarFieldEnum = (typeof OrganizationJoinRequestScalarFieldEnum)[keyof typeof OrganizationJoinRequestScalarFieldEnum] + + +export const OrganizationUserJoinTableScalarFieldEnum = { + userId: 'userId', + orgId: 'orgId', + role: 'role', + joinedDate: 'joinedDate' +} as const + +export type OrganizationUserJoinTableScalarFieldEnum = (typeof OrganizationUserJoinTableScalarFieldEnum)[keyof typeof OrganizationUserJoinTableScalarFieldEnum] + + +export const OrganizationScalarFieldEnum = { + id: 'id', + name: 'name', + description: 'description', + createdAt: 'createdAt', + updatedAt: 'updatedAt' +} as const + +export type OrganizationScalarFieldEnum = (typeof OrganizationScalarFieldEnum)[keyof typeof OrganizationScalarFieldEnum] + + +export const UserScalarFieldEnum = { + id: 'id', + firstName: 'firstName', + middleName: 'middleName', + lastName: 'lastName', + email: 'email', + password: 'password', + role: 'role', + isVerified: 'isVerified', + refreshToken: 'refreshToken', + profilePicture: 'profilePicture', + isDeleted: 'isDeleted', + deletedAt: 'deletedAt', + createdAt: 'createdAt', + updatedAt: 'updatedAt' +} as const + +export type UserScalarFieldEnum = (typeof UserScalarFieldEnum)[keyof typeof UserScalarFieldEnum] + + +export const SortOrder = { + asc: 'asc', + desc: 'desc' +} as const + +export type SortOrder = (typeof SortOrder)[keyof typeof SortOrder] + + +export const QueryMode = { + default: 'default', + insensitive: 'insensitive' +} as const + +export type QueryMode = (typeof QueryMode)[keyof typeof QueryMode] + + +export const NullsOrder = { + first: 'first', + last: 'last' +} as const + +export type NullsOrder = (typeof NullsOrder)[keyof typeof NullsOrder] + + + +/** + * Field references + */ + + +/** + * Reference to a field of type 'String' + */ +export type StringFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'String'> + + + +/** + * Reference to a field of type 'String[]' + */ +export type ListStringFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'String[]'> + + + +/** + * Reference to a field of type 'ORGANIZATION_JOIN_REQUEST' + */ +export type EnumORGANIZATION_JOIN_REQUESTFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'ORGANIZATION_JOIN_REQUEST'> + + + +/** + * Reference to a field of type 'ORGANIZATION_JOIN_REQUEST[]' + */ +export type ListEnumORGANIZATION_JOIN_REQUESTFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'ORGANIZATION_JOIN_REQUEST[]'> + + + +/** + * Reference to a field of type 'DateTime' + */ +export type DateTimeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'DateTime'> + + + +/** + * Reference to a field of type 'DateTime[]' + */ +export type ListDateTimeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'DateTime[]'> + + + +/** + * Reference to a field of type 'ORG_ROLE' + */ +export type EnumORG_ROLEFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'ORG_ROLE'> + + + +/** + * Reference to a field of type 'ORG_ROLE[]' + */ +export type ListEnumORG_ROLEFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'ORG_ROLE[]'> + + + +/** + * Reference to a field of type 'USER_ROLE' + */ +export type EnumUSER_ROLEFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'USER_ROLE'> + + + +/** + * Reference to a field of type 'USER_ROLE[]' + */ +export type ListEnumUSER_ROLEFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'USER_ROLE[]'> + + + +/** + * Reference to a field of type 'Boolean' + */ +export type BooleanFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Boolean'> + + + +/** + * Reference to a field of type 'Int' + */ +export type IntFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Int'> + + + +/** + * Reference to a field of type 'Int[]' + */ +export type ListIntFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Int[]'> + /** * Batch Payload for updateMany & deleteMany & createMany @@ -538,7 +1008,12 @@ export type PrismaClientOptions = ({ */ comments?: runtime.SqlCommenterPlugin[] } -export type GlobalOmitConfig = {} +export type GlobalOmitConfig = { + organizationJoinRequest?: Prisma.OrganizationJoinRequestOmit + organizationUserJoinTable?: Prisma.OrganizationUserJoinTableOmit + organization?: Prisma.OrganizationOmit + user?: Prisma.UserOmit +} /* Types for Logging */ export type LogLevel = 'info' | 'query' | 'warn' | 'error' diff --git a/prisma/generated/prisma/internal/prismaNamespaceBrowser.ts b/prisma/generated/prisma/internal/prismaNamespaceBrowser.ts index 56a91cf..3f79be1 100644 --- a/prisma/generated/prisma/internal/prismaNamespaceBrowser.ts +++ b/prisma/generated/prisma/internal/prismaNamespaceBrowser.ts @@ -51,7 +51,10 @@ export const AnyNull = runtime.AnyNull export const ModelName = { - + OrganizationJoinRequest: 'OrganizationJoinRequest', + OrganizationUserJoinTable: 'OrganizationUserJoinTable', + Organization: 'Organization', + User: 'User' } as const export type ModelName = (typeof ModelName)[keyof typeof ModelName] @@ -69,3 +72,79 @@ export const TransactionIsolationLevel = runtime.makeStrictEnum({ export type TransactionIsolationLevel = (typeof TransactionIsolationLevel)[keyof typeof TransactionIsolationLevel] + +export const OrganizationJoinRequestScalarFieldEnum = { + userId: 'userId', + orgId: 'orgId', + status: 'status', + requestedOn: 'requestedOn', + rejectReason: 'rejectReason' +} as const + +export type OrganizationJoinRequestScalarFieldEnum = (typeof OrganizationJoinRequestScalarFieldEnum)[keyof typeof OrganizationJoinRequestScalarFieldEnum] + + +export const OrganizationUserJoinTableScalarFieldEnum = { + userId: 'userId', + orgId: 'orgId', + role: 'role', + joinedDate: 'joinedDate' +} as const + +export type OrganizationUserJoinTableScalarFieldEnum = (typeof OrganizationUserJoinTableScalarFieldEnum)[keyof typeof OrganizationUserJoinTableScalarFieldEnum] + + +export const OrganizationScalarFieldEnum = { + id: 'id', + name: 'name', + description: 'description', + createdAt: 'createdAt', + updatedAt: 'updatedAt' +} as const + +export type OrganizationScalarFieldEnum = (typeof OrganizationScalarFieldEnum)[keyof typeof OrganizationScalarFieldEnum] + + +export const UserScalarFieldEnum = { + id: 'id', + firstName: 'firstName', + middleName: 'middleName', + lastName: 'lastName', + email: 'email', + password: 'password', + role: 'role', + isVerified: 'isVerified', + refreshToken: 'refreshToken', + profilePicture: 'profilePicture', + isDeleted: 'isDeleted', + deletedAt: 'deletedAt', + createdAt: 'createdAt', + updatedAt: 'updatedAt' +} as const + +export type UserScalarFieldEnum = (typeof UserScalarFieldEnum)[keyof typeof UserScalarFieldEnum] + + +export const SortOrder = { + asc: 'asc', + desc: 'desc' +} as const + +export type SortOrder = (typeof SortOrder)[keyof typeof SortOrder] + + +export const QueryMode = { + default: 'default', + insensitive: 'insensitive' +} as const + +export type QueryMode = (typeof QueryMode)[keyof typeof QueryMode] + + +export const NullsOrder = { + first: 'first', + last: 'last' +} as const + +export type NullsOrder = (typeof NullsOrder)[keyof typeof NullsOrder] + diff --git a/prisma/generated/prisma/models.ts b/prisma/generated/prisma/models.ts index 8c04a25..620fb12 100644 --- a/prisma/generated/prisma/models.ts +++ b/prisma/generated/prisma/models.ts @@ -8,4 +8,8 @@ * * 🟢 You can import this file directly. */ +export type * from './models/OrganizationJoinRequest' +export type * from './models/OrganizationUserJoinTable' +export type * from './models/Organization' +export type * from './models/User' export type * from './commonInputTypes' \ No newline at end of file diff --git a/prisma/generated/prisma/models/Organization.ts b/prisma/generated/prisma/models/Organization.ts new file mode 100644 index 0000000..894bb62 --- /dev/null +++ b/prisma/generated/prisma/models/Organization.ts @@ -0,0 +1,1144 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `Organization` 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" +import type * as Prisma from "../internal/prismaNamespace" + +/** + * Model Organization + * + */ +export type OrganizationModel = runtime.Types.Result.DefaultSelection + +export type AggregateOrganization = { + _count: OrganizationCountAggregateOutputType | null + _min: OrganizationMinAggregateOutputType | null + _max: OrganizationMaxAggregateOutputType | null +} + +export type OrganizationMinAggregateOutputType = { + id: string | null + name: string | null + description: string | null + createdAt: Date | null + updatedAt: Date | null +} + +export type OrganizationMaxAggregateOutputType = { + id: string | null + name: string | null + description: string | null + createdAt: Date | null + updatedAt: Date | null +} + +export type OrganizationCountAggregateOutputType = { + id: number + name: number + description: number + createdAt: number + updatedAt: number + _all: number +} + + +export type OrganizationMinAggregateInputType = { + id?: true + name?: true + description?: true + createdAt?: true + updatedAt?: true +} + +export type OrganizationMaxAggregateInputType = { + id?: true + name?: true + description?: true + createdAt?: true + updatedAt?: true +} + +export type OrganizationCountAggregateInputType = { + id?: true + name?: true + description?: true + createdAt?: true + updatedAt?: true + _all?: true +} + +export type OrganizationAggregateArgs = { + /** + * Filter which Organization to aggregate. + */ + where?: Prisma.OrganizationWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Organizations to fetch. + */ + orderBy?: Prisma.OrganizationOrderByWithRelationInput | Prisma.OrganizationOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.OrganizationWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Organizations 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` Organizations. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned Organizations + **/ + _count?: true | OrganizationCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: OrganizationMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: OrganizationMaxAggregateInputType +} + +export type GetOrganizationAggregateType = { + [P in keyof T & keyof AggregateOrganization]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type OrganizationGroupByArgs = { + where?: Prisma.OrganizationWhereInput + orderBy?: Prisma.OrganizationOrderByWithAggregationInput | Prisma.OrganizationOrderByWithAggregationInput[] + by: Prisma.OrganizationScalarFieldEnum[] | Prisma.OrganizationScalarFieldEnum + having?: Prisma.OrganizationScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: OrganizationCountAggregateInputType | true + _min?: OrganizationMinAggregateInputType + _max?: OrganizationMaxAggregateInputType +} + +export type OrganizationGroupByOutputType = { + id: string + name: string + description: string | null + createdAt: Date + updatedAt: Date + _count: OrganizationCountAggregateOutputType | null + _min: OrganizationMinAggregateOutputType | null + _max: OrganizationMaxAggregateOutputType | null +} + +type GetOrganizationGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof OrganizationGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type OrganizationWhereInput = { + AND?: Prisma.OrganizationWhereInput | Prisma.OrganizationWhereInput[] + OR?: Prisma.OrganizationWhereInput[] + NOT?: Prisma.OrganizationWhereInput | Prisma.OrganizationWhereInput[] + id?: Prisma.StringFilter<"Organization"> | string + name?: Prisma.StringFilter<"Organization"> | string + description?: Prisma.StringNullableFilter<"Organization"> | string | null + createdAt?: Prisma.DateTimeFilter<"Organization"> | Date | string + updatedAt?: Prisma.DateTimeFilter<"Organization"> | Date | string +} + +export type OrganizationOrderByWithRelationInput = { + id?: Prisma.SortOrder + name?: Prisma.SortOrder + description?: Prisma.SortOrderInput | Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type OrganizationWhereUniqueInput = Prisma.AtLeast<{ + id?: string + AND?: Prisma.OrganizationWhereInput | Prisma.OrganizationWhereInput[] + OR?: Prisma.OrganizationWhereInput[] + NOT?: Prisma.OrganizationWhereInput | Prisma.OrganizationWhereInput[] + name?: Prisma.StringFilter<"Organization"> | string + description?: Prisma.StringNullableFilter<"Organization"> | string | null + createdAt?: Prisma.DateTimeFilter<"Organization"> | Date | string + updatedAt?: Prisma.DateTimeFilter<"Organization"> | Date | string +}, "id"> + +export type OrganizationOrderByWithAggregationInput = { + id?: Prisma.SortOrder + name?: Prisma.SortOrder + description?: Prisma.SortOrderInput | Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder + _count?: Prisma.OrganizationCountOrderByAggregateInput + _max?: Prisma.OrganizationMaxOrderByAggregateInput + _min?: Prisma.OrganizationMinOrderByAggregateInput +} + +export type OrganizationScalarWhereWithAggregatesInput = { + AND?: Prisma.OrganizationScalarWhereWithAggregatesInput | Prisma.OrganizationScalarWhereWithAggregatesInput[] + OR?: Prisma.OrganizationScalarWhereWithAggregatesInput[] + NOT?: Prisma.OrganizationScalarWhereWithAggregatesInput | Prisma.OrganizationScalarWhereWithAggregatesInput[] + id?: Prisma.StringWithAggregatesFilter<"Organization"> | string + name?: Prisma.StringWithAggregatesFilter<"Organization"> | string + description?: Prisma.StringNullableWithAggregatesFilter<"Organization"> | string | null + createdAt?: Prisma.DateTimeWithAggregatesFilter<"Organization"> | Date | string + updatedAt?: Prisma.DateTimeWithAggregatesFilter<"Organization"> | Date | string +} + +export type OrganizationCreateInput = { + id?: string + name: string + description?: string | null + createdAt?: Date | string + updatedAt?: Date | string +} + +export type OrganizationUncheckedCreateInput = { + id?: string + name: string + description?: string | null + createdAt?: Date | string + updatedAt?: Date | string +} + +export type OrganizationUpdateInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + name?: Prisma.StringFieldUpdateOperationsInput | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type OrganizationUncheckedUpdateInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + name?: Prisma.StringFieldUpdateOperationsInput | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type OrganizationCreateManyInput = { + id?: string + name: string + description?: string | null + createdAt?: Date | string + updatedAt?: Date | string +} + +export type OrganizationUpdateManyMutationInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + name?: Prisma.StringFieldUpdateOperationsInput | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type OrganizationUncheckedUpdateManyInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + name?: Prisma.StringFieldUpdateOperationsInput | string + description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type OrganizationCountOrderByAggregateInput = { + id?: Prisma.SortOrder + name?: Prisma.SortOrder + description?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type OrganizationMaxOrderByAggregateInput = { + id?: Prisma.SortOrder + name?: Prisma.SortOrder + description?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type OrganizationMinOrderByAggregateInput = { + id?: Prisma.SortOrder + name?: Prisma.SortOrder + description?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + + + +export type OrganizationSelect = runtime.Types.Extensions.GetSelect<{ + id?: boolean + name?: boolean + description?: boolean + createdAt?: boolean + updatedAt?: boolean +}, ExtArgs["result"]["organization"]> + +export type OrganizationSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + name?: boolean + description?: boolean + createdAt?: boolean + updatedAt?: boolean +}, ExtArgs["result"]["organization"]> + +export type OrganizationSelectUpdateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + name?: boolean + description?: boolean + createdAt?: boolean + updatedAt?: boolean +}, ExtArgs["result"]["organization"]> + +export type OrganizationSelectScalar = { + id?: boolean + name?: boolean + description?: boolean + createdAt?: boolean + updatedAt?: boolean +} + +export type OrganizationOmit = runtime.Types.Extensions.GetOmit<"id" | "name" | "description" | "createdAt" | "updatedAt", ExtArgs["result"]["organization"]> + +export type $OrganizationPayload = { + name: "Organization" + objects: {} + scalars: runtime.Types.Extensions.GetPayloadResult<{ + id: string + name: string + description: string | null + createdAt: Date + updatedAt: Date + }, ExtArgs["result"]["organization"]> + composites: {} +} + +export type OrganizationGetPayload = runtime.Types.Result.GetResult + +export type OrganizationCountArgs = + Omit & { + select?: OrganizationCountAggregateInputType | true + } + +export interface OrganizationDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['Organization'], meta: { name: 'Organization' } } + /** + * Find zero or one Organization that matches the filter. + * @param {OrganizationFindUniqueArgs} args - Arguments to find a Organization + * @example + * // Get one Organization + * const organization = await prisma.organization.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__OrganizationClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one Organization that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {OrganizationFindUniqueOrThrowArgs} args - Arguments to find a Organization + * @example + * // Get one Organization + * const organization = await prisma.organization.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__OrganizationClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first Organization 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 {OrganizationFindFirstArgs} args - Arguments to find a Organization + * @example + * // Get one Organization + * const organization = await prisma.organization.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__OrganizationClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first Organization 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 {OrganizationFindFirstOrThrowArgs} args - Arguments to find a Organization + * @example + * // Get one Organization + * const organization = await prisma.organization.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__OrganizationClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more Organizations 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 {OrganizationFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all Organizations + * const organizations = await prisma.organization.findMany() + * + * // Get first 10 Organizations + * const organizations = await prisma.organization.findMany({ take: 10 }) + * + * // Only select the `id` + * const organizationWithIdOnly = await prisma.organization.findMany({ select: { id: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a Organization. + * @param {OrganizationCreateArgs} args - Arguments to create a Organization. + * @example + * // Create one Organization + * const Organization = await prisma.organization.create({ + * data: { + * // ... data to create a Organization + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__OrganizationClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many Organizations. + * @param {OrganizationCreateManyArgs} args - Arguments to create many Organizations. + * @example + * // Create many Organizations + * const organization = await prisma.organization.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create many Organizations and returns the data saved in the database. + * @param {OrganizationCreateManyAndReturnArgs} args - Arguments to create many Organizations. + * @example + * // Create many Organizations + * const organization = await prisma.organization.createManyAndReturn({ + * data: [ + * // ... provide data here + * ] + * }) + * + * // Create many Organizations and only return the `id` + * const organizationWithIdOnly = await prisma.organization.createManyAndReturn({ + * select: { id: true }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + createManyAndReturn(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "createManyAndReturn", GlobalOmitOptions>> + + /** + * Delete a Organization. + * @param {OrganizationDeleteArgs} args - Arguments to delete one Organization. + * @example + * // Delete one Organization + * const Organization = await prisma.organization.delete({ + * where: { + * // ... filter to delete one Organization + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__OrganizationClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one Organization. + * @param {OrganizationUpdateArgs} args - Arguments to update one Organization. + * @example + * // Update one Organization + * const organization = await prisma.organization.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__OrganizationClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more Organizations. + * @param {OrganizationDeleteManyArgs} args - Arguments to filter Organizations to delete. + * @example + * // Delete a few Organizations + * const { count } = await prisma.organization.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more Organizations. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {OrganizationUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many Organizations + * const organization = await prisma.organization.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more Organizations and returns the data updated in the database. + * @param {OrganizationUpdateManyAndReturnArgs} args - Arguments to update many Organizations. + * @example + * // Update many Organizations + * const organization = await prisma.organization.updateManyAndReturn({ + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * + * // Update zero or more Organizations and only return the `id` + * const organizationWithIdOnly = await prisma.organization.updateManyAndReturn({ + * select: { id: true }, + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + updateManyAndReturn(args: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "updateManyAndReturn", GlobalOmitOptions>> + + /** + * Create or update one Organization. + * @param {OrganizationUpsertArgs} args - Arguments to update or create a Organization. + * @example + * // Update or create a Organization + * const organization = await prisma.organization.upsert({ + * create: { + * // ... data to create a Organization + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the Organization we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__OrganizationClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of Organizations. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {OrganizationCountArgs} args - Arguments to filter Organizations to count. + * @example + * // Count the number of Organizations + * const count = await prisma.organization.count({ + * where: { + * // ... the filter for the Organizations 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 Organization. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {OrganizationAggregateArgs} 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 Organization. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {OrganizationGroupByArgs} 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 OrganizationGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: OrganizationGroupByArgs['orderBy'] } + : { orderBy?: OrganizationGroupByArgs['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 ? GetOrganizationGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the Organization model + */ +readonly fields: OrganizationFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for Organization. + * 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__OrganizationClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + /** + * 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 Organization model + */ +export interface OrganizationFieldRefs { + readonly id: Prisma.FieldRef<"Organization", 'String'> + readonly name: Prisma.FieldRef<"Organization", 'String'> + readonly description: Prisma.FieldRef<"Organization", 'String'> + readonly createdAt: Prisma.FieldRef<"Organization", 'DateTime'> + readonly updatedAt: Prisma.FieldRef<"Organization", 'DateTime'> +} + + +// Custom InputTypes +/** + * Organization findUnique + */ +export type OrganizationFindUniqueArgs = { + /** + * Select specific fields to fetch from the Organization + */ + select?: Prisma.OrganizationSelect | null + /** + * Omit specific fields from the Organization + */ + omit?: Prisma.OrganizationOmit | null + /** + * Filter, which Organization to fetch. + */ + where: Prisma.OrganizationWhereUniqueInput +} + +/** + * Organization findUniqueOrThrow + */ +export type OrganizationFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the Organization + */ + select?: Prisma.OrganizationSelect | null + /** + * Omit specific fields from the Organization + */ + omit?: Prisma.OrganizationOmit | null + /** + * Filter, which Organization to fetch. + */ + where: Prisma.OrganizationWhereUniqueInput +} + +/** + * Organization findFirst + */ +export type OrganizationFindFirstArgs = { + /** + * Select specific fields to fetch from the Organization + */ + select?: Prisma.OrganizationSelect | null + /** + * Omit specific fields from the Organization + */ + omit?: Prisma.OrganizationOmit | null + /** + * Filter, which Organization to fetch. + */ + where?: Prisma.OrganizationWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Organizations to fetch. + */ + orderBy?: Prisma.OrganizationOrderByWithRelationInput | Prisma.OrganizationOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for Organizations. + */ + cursor?: Prisma.OrganizationWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Organizations 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` Organizations. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of Organizations. + */ + distinct?: Prisma.OrganizationScalarFieldEnum | Prisma.OrganizationScalarFieldEnum[] +} + +/** + * Organization findFirstOrThrow + */ +export type OrganizationFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the Organization + */ + select?: Prisma.OrganizationSelect | null + /** + * Omit specific fields from the Organization + */ + omit?: Prisma.OrganizationOmit | null + /** + * Filter, which Organization to fetch. + */ + where?: Prisma.OrganizationWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Organizations to fetch. + */ + orderBy?: Prisma.OrganizationOrderByWithRelationInput | Prisma.OrganizationOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for Organizations. + */ + cursor?: Prisma.OrganizationWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Organizations 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` Organizations. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of Organizations. + */ + distinct?: Prisma.OrganizationScalarFieldEnum | Prisma.OrganizationScalarFieldEnum[] +} + +/** + * Organization findMany + */ +export type OrganizationFindManyArgs = { + /** + * Select specific fields to fetch from the Organization + */ + select?: Prisma.OrganizationSelect | null + /** + * Omit specific fields from the Organization + */ + omit?: Prisma.OrganizationOmit | null + /** + * Filter, which Organizations to fetch. + */ + where?: Prisma.OrganizationWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Organizations to fetch. + */ + orderBy?: Prisma.OrganizationOrderByWithRelationInput | Prisma.OrganizationOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing Organizations. + */ + cursor?: Prisma.OrganizationWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Organizations 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` Organizations. + */ + skip?: number + distinct?: Prisma.OrganizationScalarFieldEnum | Prisma.OrganizationScalarFieldEnum[] +} + +/** + * Organization create + */ +export type OrganizationCreateArgs = { + /** + * Select specific fields to fetch from the Organization + */ + select?: Prisma.OrganizationSelect | null + /** + * Omit specific fields from the Organization + */ + omit?: Prisma.OrganizationOmit | null + /** + * The data needed to create a Organization. + */ + data: Prisma.XOR +} + +/** + * Organization createMany + */ +export type OrganizationCreateManyArgs = { + /** + * The data used to create many Organizations. + */ + data: Prisma.OrganizationCreateManyInput | Prisma.OrganizationCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * Organization createManyAndReturn + */ +export type OrganizationCreateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the Organization + */ + select?: Prisma.OrganizationSelectCreateManyAndReturn | null + /** + * Omit specific fields from the Organization + */ + omit?: Prisma.OrganizationOmit | null + /** + * The data used to create many Organizations. + */ + data: Prisma.OrganizationCreateManyInput | Prisma.OrganizationCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * Organization update + */ +export type OrganizationUpdateArgs = { + /** + * Select specific fields to fetch from the Organization + */ + select?: Prisma.OrganizationSelect | null + /** + * Omit specific fields from the Organization + */ + omit?: Prisma.OrganizationOmit | null + /** + * The data needed to update a Organization. + */ + data: Prisma.XOR + /** + * Choose, which Organization to update. + */ + where: Prisma.OrganizationWhereUniqueInput +} + +/** + * Organization updateMany + */ +export type OrganizationUpdateManyArgs = { + /** + * The data used to update Organizations. + */ + data: Prisma.XOR + /** + * Filter which Organizations to update + */ + where?: Prisma.OrganizationWhereInput + /** + * Limit how many Organizations to update. + */ + limit?: number +} + +/** + * Organization updateManyAndReturn + */ +export type OrganizationUpdateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the Organization + */ + select?: Prisma.OrganizationSelectUpdateManyAndReturn | null + /** + * Omit specific fields from the Organization + */ + omit?: Prisma.OrganizationOmit | null + /** + * The data used to update Organizations. + */ + data: Prisma.XOR + /** + * Filter which Organizations to update + */ + where?: Prisma.OrganizationWhereInput + /** + * Limit how many Organizations to update. + */ + limit?: number +} + +/** + * Organization upsert + */ +export type OrganizationUpsertArgs = { + /** + * Select specific fields to fetch from the Organization + */ + select?: Prisma.OrganizationSelect | null + /** + * Omit specific fields from the Organization + */ + omit?: Prisma.OrganizationOmit | null + /** + * The filter to search for the Organization to update in case it exists. + */ + where: Prisma.OrganizationWhereUniqueInput + /** + * In case the Organization found by the `where` argument doesn't exist, create a new Organization with this data. + */ + create: Prisma.XOR + /** + * In case the Organization was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * Organization delete + */ +export type OrganizationDeleteArgs = { + /** + * Select specific fields to fetch from the Organization + */ + select?: Prisma.OrganizationSelect | null + /** + * Omit specific fields from the Organization + */ + omit?: Prisma.OrganizationOmit | null + /** + * Filter which Organization to delete. + */ + where: Prisma.OrganizationWhereUniqueInput +} + +/** + * Organization deleteMany + */ +export type OrganizationDeleteManyArgs = { + /** + * Filter which Organizations to delete + */ + where?: Prisma.OrganizationWhereInput + /** + * Limit how many Organizations to delete. + */ + limit?: number +} + +/** + * Organization without action + */ +export type OrganizationDefaultArgs = { + /** + * Select specific fields to fetch from the Organization + */ + select?: Prisma.OrganizationSelect | null + /** + * Omit specific fields from the Organization + */ + omit?: Prisma.OrganizationOmit | null +} diff --git a/prisma/generated/prisma/models/OrganizationJoinRequest.ts b/prisma/generated/prisma/models/OrganizationJoinRequest.ts new file mode 100644 index 0000000..9993820 --- /dev/null +++ b/prisma/generated/prisma/models/OrganizationJoinRequest.ts @@ -0,0 +1,1166 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `OrganizationJoinRequest` 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" +import type * as Prisma from "../internal/prismaNamespace" + +/** + * Model OrganizationJoinRequest + * + */ +export type OrganizationJoinRequestModel = runtime.Types.Result.DefaultSelection + +export type AggregateOrganizationJoinRequest = { + _count: OrganizationJoinRequestCountAggregateOutputType | null + _min: OrganizationJoinRequestMinAggregateOutputType | null + _max: OrganizationJoinRequestMaxAggregateOutputType | null +} + +export type OrganizationJoinRequestMinAggregateOutputType = { + userId: string | null + orgId: string | null + status: $Enums.ORGANIZATION_JOIN_REQUEST | null + requestedOn: Date | null + rejectReason: string | null +} + +export type OrganizationJoinRequestMaxAggregateOutputType = { + userId: string | null + orgId: string | null + status: $Enums.ORGANIZATION_JOIN_REQUEST | null + requestedOn: Date | null + rejectReason: string | null +} + +export type OrganizationJoinRequestCountAggregateOutputType = { + userId: number + orgId: number + status: number + requestedOn: number + rejectReason: number + _all: number +} + + +export type OrganizationJoinRequestMinAggregateInputType = { + userId?: true + orgId?: true + status?: true + requestedOn?: true + rejectReason?: true +} + +export type OrganizationJoinRequestMaxAggregateInputType = { + userId?: true + orgId?: true + status?: true + requestedOn?: true + rejectReason?: true +} + +export type OrganizationJoinRequestCountAggregateInputType = { + userId?: true + orgId?: true + status?: true + requestedOn?: true + rejectReason?: true + _all?: true +} + +export type OrganizationJoinRequestAggregateArgs = { + /** + * Filter which OrganizationJoinRequest to aggregate. + */ + where?: Prisma.OrganizationJoinRequestWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of OrganizationJoinRequests to fetch. + */ + orderBy?: Prisma.OrganizationJoinRequestOrderByWithRelationInput | Prisma.OrganizationJoinRequestOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.OrganizationJoinRequestWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` OrganizationJoinRequests 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` OrganizationJoinRequests. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned OrganizationJoinRequests + **/ + _count?: true | OrganizationJoinRequestCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: OrganizationJoinRequestMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: OrganizationJoinRequestMaxAggregateInputType +} + +export type GetOrganizationJoinRequestAggregateType = { + [P in keyof T & keyof AggregateOrganizationJoinRequest]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type OrganizationJoinRequestGroupByArgs = { + where?: Prisma.OrganizationJoinRequestWhereInput + orderBy?: Prisma.OrganizationJoinRequestOrderByWithAggregationInput | Prisma.OrganizationJoinRequestOrderByWithAggregationInput[] + by: Prisma.OrganizationJoinRequestScalarFieldEnum[] | Prisma.OrganizationJoinRequestScalarFieldEnum + having?: Prisma.OrganizationJoinRequestScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: OrganizationJoinRequestCountAggregateInputType | true + _min?: OrganizationJoinRequestMinAggregateInputType + _max?: OrganizationJoinRequestMaxAggregateInputType +} + +export type OrganizationJoinRequestGroupByOutputType = { + userId: string + orgId: string + status: $Enums.ORGANIZATION_JOIN_REQUEST + requestedOn: Date + rejectReason: string | null + _count: OrganizationJoinRequestCountAggregateOutputType | null + _min: OrganizationJoinRequestMinAggregateOutputType | null + _max: OrganizationJoinRequestMaxAggregateOutputType | null +} + +type GetOrganizationJoinRequestGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof OrganizationJoinRequestGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type OrganizationJoinRequestWhereInput = { + AND?: Prisma.OrganizationJoinRequestWhereInput | Prisma.OrganizationJoinRequestWhereInput[] + OR?: Prisma.OrganizationJoinRequestWhereInput[] + NOT?: Prisma.OrganizationJoinRequestWhereInput | Prisma.OrganizationJoinRequestWhereInput[] + userId?: Prisma.StringFilter<"OrganizationJoinRequest"> | string + orgId?: Prisma.StringFilter<"OrganizationJoinRequest"> | string + status?: Prisma.EnumORGANIZATION_JOIN_REQUESTFilter<"OrganizationJoinRequest"> | $Enums.ORGANIZATION_JOIN_REQUEST + requestedOn?: Prisma.DateTimeFilter<"OrganizationJoinRequest"> | Date | string + rejectReason?: Prisma.StringNullableFilter<"OrganizationJoinRequest"> | string | null +} + +export type OrganizationJoinRequestOrderByWithRelationInput = { + userId?: Prisma.SortOrder + orgId?: Prisma.SortOrder + status?: Prisma.SortOrder + requestedOn?: Prisma.SortOrder + rejectReason?: Prisma.SortOrderInput | Prisma.SortOrder +} + +export type OrganizationJoinRequestWhereUniqueInput = Prisma.AtLeast<{ + userId_orgId?: Prisma.OrganizationJoinRequestUserIdOrgIdCompoundUniqueInput + AND?: Prisma.OrganizationJoinRequestWhereInput | Prisma.OrganizationJoinRequestWhereInput[] + OR?: Prisma.OrganizationJoinRequestWhereInput[] + NOT?: Prisma.OrganizationJoinRequestWhereInput | Prisma.OrganizationJoinRequestWhereInput[] + userId?: Prisma.StringFilter<"OrganizationJoinRequest"> | string + orgId?: Prisma.StringFilter<"OrganizationJoinRequest"> | string + status?: Prisma.EnumORGANIZATION_JOIN_REQUESTFilter<"OrganizationJoinRequest"> | $Enums.ORGANIZATION_JOIN_REQUEST + requestedOn?: Prisma.DateTimeFilter<"OrganizationJoinRequest"> | Date | string + rejectReason?: Prisma.StringNullableFilter<"OrganizationJoinRequest"> | string | null +}, "userId_orgId"> + +export type OrganizationJoinRequestOrderByWithAggregationInput = { + userId?: Prisma.SortOrder + orgId?: Prisma.SortOrder + status?: Prisma.SortOrder + requestedOn?: Prisma.SortOrder + rejectReason?: Prisma.SortOrderInput | Prisma.SortOrder + _count?: Prisma.OrganizationJoinRequestCountOrderByAggregateInput + _max?: Prisma.OrganizationJoinRequestMaxOrderByAggregateInput + _min?: Prisma.OrganizationJoinRequestMinOrderByAggregateInput +} + +export type OrganizationJoinRequestScalarWhereWithAggregatesInput = { + AND?: Prisma.OrganizationJoinRequestScalarWhereWithAggregatesInput | Prisma.OrganizationJoinRequestScalarWhereWithAggregatesInput[] + OR?: Prisma.OrganizationJoinRequestScalarWhereWithAggregatesInput[] + NOT?: Prisma.OrganizationJoinRequestScalarWhereWithAggregatesInput | Prisma.OrganizationJoinRequestScalarWhereWithAggregatesInput[] + userId?: Prisma.StringWithAggregatesFilter<"OrganizationJoinRequest"> | string + orgId?: Prisma.StringWithAggregatesFilter<"OrganizationJoinRequest"> | string + status?: Prisma.EnumORGANIZATION_JOIN_REQUESTWithAggregatesFilter<"OrganizationJoinRequest"> | $Enums.ORGANIZATION_JOIN_REQUEST + requestedOn?: Prisma.DateTimeWithAggregatesFilter<"OrganizationJoinRequest"> | Date | string + rejectReason?: Prisma.StringNullableWithAggregatesFilter<"OrganizationJoinRequest"> | string | null +} + +export type OrganizationJoinRequestCreateInput = { + userId: string + orgId: string + status?: $Enums.ORGANIZATION_JOIN_REQUEST + requestedOn?: Date | string + rejectReason?: string | null +} + +export type OrganizationJoinRequestUncheckedCreateInput = { + userId: string + orgId: string + status?: $Enums.ORGANIZATION_JOIN_REQUEST + requestedOn?: Date | string + rejectReason?: string | null +} + +export type OrganizationJoinRequestUpdateInput = { + userId?: Prisma.StringFieldUpdateOperationsInput | string + orgId?: Prisma.StringFieldUpdateOperationsInput | string + status?: Prisma.EnumORGANIZATION_JOIN_REQUESTFieldUpdateOperationsInput | $Enums.ORGANIZATION_JOIN_REQUEST + requestedOn?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + rejectReason?: Prisma.NullableStringFieldUpdateOperationsInput | string | null +} + +export type OrganizationJoinRequestUncheckedUpdateInput = { + userId?: Prisma.StringFieldUpdateOperationsInput | string + orgId?: Prisma.StringFieldUpdateOperationsInput | string + status?: Prisma.EnumORGANIZATION_JOIN_REQUESTFieldUpdateOperationsInput | $Enums.ORGANIZATION_JOIN_REQUEST + requestedOn?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + rejectReason?: Prisma.NullableStringFieldUpdateOperationsInput | string | null +} + +export type OrganizationJoinRequestCreateManyInput = { + userId: string + orgId: string + status?: $Enums.ORGANIZATION_JOIN_REQUEST + requestedOn?: Date | string + rejectReason?: string | null +} + +export type OrganizationJoinRequestUpdateManyMutationInput = { + userId?: Prisma.StringFieldUpdateOperationsInput | string + orgId?: Prisma.StringFieldUpdateOperationsInput | string + status?: Prisma.EnumORGANIZATION_JOIN_REQUESTFieldUpdateOperationsInput | $Enums.ORGANIZATION_JOIN_REQUEST + requestedOn?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + rejectReason?: Prisma.NullableStringFieldUpdateOperationsInput | string | null +} + +export type OrganizationJoinRequestUncheckedUpdateManyInput = { + userId?: Prisma.StringFieldUpdateOperationsInput | string + orgId?: Prisma.StringFieldUpdateOperationsInput | string + status?: Prisma.EnumORGANIZATION_JOIN_REQUESTFieldUpdateOperationsInput | $Enums.ORGANIZATION_JOIN_REQUEST + requestedOn?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + rejectReason?: Prisma.NullableStringFieldUpdateOperationsInput | string | null +} + +export type OrganizationJoinRequestUserIdOrgIdCompoundUniqueInput = { + userId: string + orgId: string +} + +export type OrganizationJoinRequestCountOrderByAggregateInput = { + userId?: Prisma.SortOrder + orgId?: Prisma.SortOrder + status?: Prisma.SortOrder + requestedOn?: Prisma.SortOrder + rejectReason?: Prisma.SortOrder +} + +export type OrganizationJoinRequestMaxOrderByAggregateInput = { + userId?: Prisma.SortOrder + orgId?: Prisma.SortOrder + status?: Prisma.SortOrder + requestedOn?: Prisma.SortOrder + rejectReason?: Prisma.SortOrder +} + +export type OrganizationJoinRequestMinOrderByAggregateInput = { + userId?: Prisma.SortOrder + orgId?: Prisma.SortOrder + status?: Prisma.SortOrder + requestedOn?: Prisma.SortOrder + rejectReason?: Prisma.SortOrder +} + +export type StringFieldUpdateOperationsInput = { + set?: string +} + +export type EnumORGANIZATION_JOIN_REQUESTFieldUpdateOperationsInput = { + set?: $Enums.ORGANIZATION_JOIN_REQUEST +} + +export type DateTimeFieldUpdateOperationsInput = { + set?: Date | string +} + +export type NullableStringFieldUpdateOperationsInput = { + set?: string | null +} + + + +export type OrganizationJoinRequestSelect = runtime.Types.Extensions.GetSelect<{ + userId?: boolean + orgId?: boolean + status?: boolean + requestedOn?: boolean + rejectReason?: boolean +}, ExtArgs["result"]["organizationJoinRequest"]> + +export type OrganizationJoinRequestSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + userId?: boolean + orgId?: boolean + status?: boolean + requestedOn?: boolean + rejectReason?: boolean +}, ExtArgs["result"]["organizationJoinRequest"]> + +export type OrganizationJoinRequestSelectUpdateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + userId?: boolean + orgId?: boolean + status?: boolean + requestedOn?: boolean + rejectReason?: boolean +}, ExtArgs["result"]["organizationJoinRequest"]> + +export type OrganizationJoinRequestSelectScalar = { + userId?: boolean + orgId?: boolean + status?: boolean + requestedOn?: boolean + rejectReason?: boolean +} + +export type OrganizationJoinRequestOmit = runtime.Types.Extensions.GetOmit<"userId" | "orgId" | "status" | "requestedOn" | "rejectReason", ExtArgs["result"]["organizationJoinRequest"]> + +export type $OrganizationJoinRequestPayload = { + name: "OrganizationJoinRequest" + objects: {} + scalars: runtime.Types.Extensions.GetPayloadResult<{ + userId: string + orgId: string + status: $Enums.ORGANIZATION_JOIN_REQUEST + requestedOn: Date + rejectReason: string | null + }, ExtArgs["result"]["organizationJoinRequest"]> + composites: {} +} + +export type OrganizationJoinRequestGetPayload = runtime.Types.Result.GetResult + +export type OrganizationJoinRequestCountArgs = + Omit & { + select?: OrganizationJoinRequestCountAggregateInputType | true + } + +export interface OrganizationJoinRequestDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['OrganizationJoinRequest'], meta: { name: 'OrganizationJoinRequest' } } + /** + * Find zero or one OrganizationJoinRequest that matches the filter. + * @param {OrganizationJoinRequestFindUniqueArgs} args - Arguments to find a OrganizationJoinRequest + * @example + * // Get one OrganizationJoinRequest + * const organizationJoinRequest = await prisma.organizationJoinRequest.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__OrganizationJoinRequestClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one OrganizationJoinRequest that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {OrganizationJoinRequestFindUniqueOrThrowArgs} args - Arguments to find a OrganizationJoinRequest + * @example + * // Get one OrganizationJoinRequest + * const organizationJoinRequest = await prisma.organizationJoinRequest.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__OrganizationJoinRequestClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first OrganizationJoinRequest 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 {OrganizationJoinRequestFindFirstArgs} args - Arguments to find a OrganizationJoinRequest + * @example + * // Get one OrganizationJoinRequest + * const organizationJoinRequest = await prisma.organizationJoinRequest.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__OrganizationJoinRequestClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first OrganizationJoinRequest 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 {OrganizationJoinRequestFindFirstOrThrowArgs} args - Arguments to find a OrganizationJoinRequest + * @example + * // Get one OrganizationJoinRequest + * const organizationJoinRequest = await prisma.organizationJoinRequest.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__OrganizationJoinRequestClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more OrganizationJoinRequests 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 {OrganizationJoinRequestFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all OrganizationJoinRequests + * const organizationJoinRequests = await prisma.organizationJoinRequest.findMany() + * + * // Get first 10 OrganizationJoinRequests + * const organizationJoinRequests = await prisma.organizationJoinRequest.findMany({ take: 10 }) + * + * // Only select the `userId` + * const organizationJoinRequestWithUserIdOnly = await prisma.organizationJoinRequest.findMany({ select: { userId: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a OrganizationJoinRequest. + * @param {OrganizationJoinRequestCreateArgs} args - Arguments to create a OrganizationJoinRequest. + * @example + * // Create one OrganizationJoinRequest + * const OrganizationJoinRequest = await prisma.organizationJoinRequest.create({ + * data: { + * // ... data to create a OrganizationJoinRequest + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__OrganizationJoinRequestClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many OrganizationJoinRequests. + * @param {OrganizationJoinRequestCreateManyArgs} args - Arguments to create many OrganizationJoinRequests. + * @example + * // Create many OrganizationJoinRequests + * const organizationJoinRequest = await prisma.organizationJoinRequest.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create many OrganizationJoinRequests and returns the data saved in the database. + * @param {OrganizationJoinRequestCreateManyAndReturnArgs} args - Arguments to create many OrganizationJoinRequests. + * @example + * // Create many OrganizationJoinRequests + * const organizationJoinRequest = await prisma.organizationJoinRequest.createManyAndReturn({ + * data: [ + * // ... provide data here + * ] + * }) + * + * // Create many OrganizationJoinRequests and only return the `userId` + * const organizationJoinRequestWithUserIdOnly = await prisma.organizationJoinRequest.createManyAndReturn({ + * select: { userId: true }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + createManyAndReturn(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "createManyAndReturn", GlobalOmitOptions>> + + /** + * Delete a OrganizationJoinRequest. + * @param {OrganizationJoinRequestDeleteArgs} args - Arguments to delete one OrganizationJoinRequest. + * @example + * // Delete one OrganizationJoinRequest + * const OrganizationJoinRequest = await prisma.organizationJoinRequest.delete({ + * where: { + * // ... filter to delete one OrganizationJoinRequest + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__OrganizationJoinRequestClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one OrganizationJoinRequest. + * @param {OrganizationJoinRequestUpdateArgs} args - Arguments to update one OrganizationJoinRequest. + * @example + * // Update one OrganizationJoinRequest + * const organizationJoinRequest = await prisma.organizationJoinRequest.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__OrganizationJoinRequestClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more OrganizationJoinRequests. + * @param {OrganizationJoinRequestDeleteManyArgs} args - Arguments to filter OrganizationJoinRequests to delete. + * @example + * // Delete a few OrganizationJoinRequests + * const { count } = await prisma.organizationJoinRequest.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more OrganizationJoinRequests. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {OrganizationJoinRequestUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many OrganizationJoinRequests + * const organizationJoinRequest = await prisma.organizationJoinRequest.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more OrganizationJoinRequests and returns the data updated in the database. + * @param {OrganizationJoinRequestUpdateManyAndReturnArgs} args - Arguments to update many OrganizationJoinRequests. + * @example + * // Update many OrganizationJoinRequests + * const organizationJoinRequest = await prisma.organizationJoinRequest.updateManyAndReturn({ + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * + * // Update zero or more OrganizationJoinRequests and only return the `userId` + * const organizationJoinRequestWithUserIdOnly = await prisma.organizationJoinRequest.updateManyAndReturn({ + * select: { userId: true }, + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + updateManyAndReturn(args: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "updateManyAndReturn", GlobalOmitOptions>> + + /** + * Create or update one OrganizationJoinRequest. + * @param {OrganizationJoinRequestUpsertArgs} args - Arguments to update or create a OrganizationJoinRequest. + * @example + * // Update or create a OrganizationJoinRequest + * const organizationJoinRequest = await prisma.organizationJoinRequest.upsert({ + * create: { + * // ... data to create a OrganizationJoinRequest + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the OrganizationJoinRequest we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__OrganizationJoinRequestClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of OrganizationJoinRequests. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {OrganizationJoinRequestCountArgs} args - Arguments to filter OrganizationJoinRequests to count. + * @example + * // Count the number of OrganizationJoinRequests + * const count = await prisma.organizationJoinRequest.count({ + * where: { + * // ... the filter for the OrganizationJoinRequests 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 OrganizationJoinRequest. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {OrganizationJoinRequestAggregateArgs} 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 OrganizationJoinRequest. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {OrganizationJoinRequestGroupByArgs} 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 OrganizationJoinRequestGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: OrganizationJoinRequestGroupByArgs['orderBy'] } + : { orderBy?: OrganizationJoinRequestGroupByArgs['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 ? GetOrganizationJoinRequestGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the OrganizationJoinRequest model + */ +readonly fields: OrganizationJoinRequestFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for OrganizationJoinRequest. + * 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__OrganizationJoinRequestClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + /** + * 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 OrganizationJoinRequest model + */ +export interface OrganizationJoinRequestFieldRefs { + readonly userId: Prisma.FieldRef<"OrganizationJoinRequest", 'String'> + readonly orgId: Prisma.FieldRef<"OrganizationJoinRequest", 'String'> + readonly status: Prisma.FieldRef<"OrganizationJoinRequest", 'ORGANIZATION_JOIN_REQUEST'> + readonly requestedOn: Prisma.FieldRef<"OrganizationJoinRequest", 'DateTime'> + readonly rejectReason: Prisma.FieldRef<"OrganizationJoinRequest", 'String'> +} + + +// Custom InputTypes +/** + * OrganizationJoinRequest findUnique + */ +export type OrganizationJoinRequestFindUniqueArgs = { + /** + * Select specific fields to fetch from the OrganizationJoinRequest + */ + select?: Prisma.OrganizationJoinRequestSelect | null + /** + * Omit specific fields from the OrganizationJoinRequest + */ + omit?: Prisma.OrganizationJoinRequestOmit | null + /** + * Filter, which OrganizationJoinRequest to fetch. + */ + where: Prisma.OrganizationJoinRequestWhereUniqueInput +} + +/** + * OrganizationJoinRequest findUniqueOrThrow + */ +export type OrganizationJoinRequestFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the OrganizationJoinRequest + */ + select?: Prisma.OrganizationJoinRequestSelect | null + /** + * Omit specific fields from the OrganizationJoinRequest + */ + omit?: Prisma.OrganizationJoinRequestOmit | null + /** + * Filter, which OrganizationJoinRequest to fetch. + */ + where: Prisma.OrganizationJoinRequestWhereUniqueInput +} + +/** + * OrganizationJoinRequest findFirst + */ +export type OrganizationJoinRequestFindFirstArgs = { + /** + * Select specific fields to fetch from the OrganizationJoinRequest + */ + select?: Prisma.OrganizationJoinRequestSelect | null + /** + * Omit specific fields from the OrganizationJoinRequest + */ + omit?: Prisma.OrganizationJoinRequestOmit | null + /** + * Filter, which OrganizationJoinRequest to fetch. + */ + where?: Prisma.OrganizationJoinRequestWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of OrganizationJoinRequests to fetch. + */ + orderBy?: Prisma.OrganizationJoinRequestOrderByWithRelationInput | Prisma.OrganizationJoinRequestOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for OrganizationJoinRequests. + */ + cursor?: Prisma.OrganizationJoinRequestWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` OrganizationJoinRequests 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` OrganizationJoinRequests. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of OrganizationJoinRequests. + */ + distinct?: Prisma.OrganizationJoinRequestScalarFieldEnum | Prisma.OrganizationJoinRequestScalarFieldEnum[] +} + +/** + * OrganizationJoinRequest findFirstOrThrow + */ +export type OrganizationJoinRequestFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the OrganizationJoinRequest + */ + select?: Prisma.OrganizationJoinRequestSelect | null + /** + * Omit specific fields from the OrganizationJoinRequest + */ + omit?: Prisma.OrganizationJoinRequestOmit | null + /** + * Filter, which OrganizationJoinRequest to fetch. + */ + where?: Prisma.OrganizationJoinRequestWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of OrganizationJoinRequests to fetch. + */ + orderBy?: Prisma.OrganizationJoinRequestOrderByWithRelationInput | Prisma.OrganizationJoinRequestOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for OrganizationJoinRequests. + */ + cursor?: Prisma.OrganizationJoinRequestWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` OrganizationJoinRequests 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` OrganizationJoinRequests. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of OrganizationJoinRequests. + */ + distinct?: Prisma.OrganizationJoinRequestScalarFieldEnum | Prisma.OrganizationJoinRequestScalarFieldEnum[] +} + +/** + * OrganizationJoinRequest findMany + */ +export type OrganizationJoinRequestFindManyArgs = { + /** + * Select specific fields to fetch from the OrganizationJoinRequest + */ + select?: Prisma.OrganizationJoinRequestSelect | null + /** + * Omit specific fields from the OrganizationJoinRequest + */ + omit?: Prisma.OrganizationJoinRequestOmit | null + /** + * Filter, which OrganizationJoinRequests to fetch. + */ + where?: Prisma.OrganizationJoinRequestWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of OrganizationJoinRequests to fetch. + */ + orderBy?: Prisma.OrganizationJoinRequestOrderByWithRelationInput | Prisma.OrganizationJoinRequestOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing OrganizationJoinRequests. + */ + cursor?: Prisma.OrganizationJoinRequestWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` OrganizationJoinRequests 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` OrganizationJoinRequests. + */ + skip?: number + distinct?: Prisma.OrganizationJoinRequestScalarFieldEnum | Prisma.OrganizationJoinRequestScalarFieldEnum[] +} + +/** + * OrganizationJoinRequest create + */ +export type OrganizationJoinRequestCreateArgs = { + /** + * Select specific fields to fetch from the OrganizationJoinRequest + */ + select?: Prisma.OrganizationJoinRequestSelect | null + /** + * Omit specific fields from the OrganizationJoinRequest + */ + omit?: Prisma.OrganizationJoinRequestOmit | null + /** + * The data needed to create a OrganizationJoinRequest. + */ + data: Prisma.XOR +} + +/** + * OrganizationJoinRequest createMany + */ +export type OrganizationJoinRequestCreateManyArgs = { + /** + * The data used to create many OrganizationJoinRequests. + */ + data: Prisma.OrganizationJoinRequestCreateManyInput | Prisma.OrganizationJoinRequestCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * OrganizationJoinRequest createManyAndReturn + */ +export type OrganizationJoinRequestCreateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the OrganizationJoinRequest + */ + select?: Prisma.OrganizationJoinRequestSelectCreateManyAndReturn | null + /** + * Omit specific fields from the OrganizationJoinRequest + */ + omit?: Prisma.OrganizationJoinRequestOmit | null + /** + * The data used to create many OrganizationJoinRequests. + */ + data: Prisma.OrganizationJoinRequestCreateManyInput | Prisma.OrganizationJoinRequestCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * OrganizationJoinRequest update + */ +export type OrganizationJoinRequestUpdateArgs = { + /** + * Select specific fields to fetch from the OrganizationJoinRequest + */ + select?: Prisma.OrganizationJoinRequestSelect | null + /** + * Omit specific fields from the OrganizationJoinRequest + */ + omit?: Prisma.OrganizationJoinRequestOmit | null + /** + * The data needed to update a OrganizationJoinRequest. + */ + data: Prisma.XOR + /** + * Choose, which OrganizationJoinRequest to update. + */ + where: Prisma.OrganizationJoinRequestWhereUniqueInput +} + +/** + * OrganizationJoinRequest updateMany + */ +export type OrganizationJoinRequestUpdateManyArgs = { + /** + * The data used to update OrganizationJoinRequests. + */ + data: Prisma.XOR + /** + * Filter which OrganizationJoinRequests to update + */ + where?: Prisma.OrganizationJoinRequestWhereInput + /** + * Limit how many OrganizationJoinRequests to update. + */ + limit?: number +} + +/** + * OrganizationJoinRequest updateManyAndReturn + */ +export type OrganizationJoinRequestUpdateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the OrganizationJoinRequest + */ + select?: Prisma.OrganizationJoinRequestSelectUpdateManyAndReturn | null + /** + * Omit specific fields from the OrganizationJoinRequest + */ + omit?: Prisma.OrganizationJoinRequestOmit | null + /** + * The data used to update OrganizationJoinRequests. + */ + data: Prisma.XOR + /** + * Filter which OrganizationJoinRequests to update + */ + where?: Prisma.OrganizationJoinRequestWhereInput + /** + * Limit how many OrganizationJoinRequests to update. + */ + limit?: number +} + +/** + * OrganizationJoinRequest upsert + */ +export type OrganizationJoinRequestUpsertArgs = { + /** + * Select specific fields to fetch from the OrganizationJoinRequest + */ + select?: Prisma.OrganizationJoinRequestSelect | null + /** + * Omit specific fields from the OrganizationJoinRequest + */ + omit?: Prisma.OrganizationJoinRequestOmit | null + /** + * The filter to search for the OrganizationJoinRequest to update in case it exists. + */ + where: Prisma.OrganizationJoinRequestWhereUniqueInput + /** + * In case the OrganizationJoinRequest found by the `where` argument doesn't exist, create a new OrganizationJoinRequest with this data. + */ + create: Prisma.XOR + /** + * In case the OrganizationJoinRequest was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * OrganizationJoinRequest delete + */ +export type OrganizationJoinRequestDeleteArgs = { + /** + * Select specific fields to fetch from the OrganizationJoinRequest + */ + select?: Prisma.OrganizationJoinRequestSelect | null + /** + * Omit specific fields from the OrganizationJoinRequest + */ + omit?: Prisma.OrganizationJoinRequestOmit | null + /** + * Filter which OrganizationJoinRequest to delete. + */ + where: Prisma.OrganizationJoinRequestWhereUniqueInput +} + +/** + * OrganizationJoinRequest deleteMany + */ +export type OrganizationJoinRequestDeleteManyArgs = { + /** + * Filter which OrganizationJoinRequests to delete + */ + where?: Prisma.OrganizationJoinRequestWhereInput + /** + * Limit how many OrganizationJoinRequests to delete. + */ + limit?: number +} + +/** + * OrganizationJoinRequest without action + */ +export type OrganizationJoinRequestDefaultArgs = { + /** + * Select specific fields to fetch from the OrganizationJoinRequest + */ + select?: Prisma.OrganizationJoinRequestSelect | null + /** + * Omit specific fields from the OrganizationJoinRequest + */ + omit?: Prisma.OrganizationJoinRequestOmit | null +} diff --git a/prisma/generated/prisma/models/OrganizationUserJoinTable.ts b/prisma/generated/prisma/models/OrganizationUserJoinTable.ts new file mode 100644 index 0000000..c4f664f --- /dev/null +++ b/prisma/generated/prisma/models/OrganizationUserJoinTable.ts @@ -0,0 +1,1126 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `OrganizationUserJoinTable` 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" +import type * as Prisma from "../internal/prismaNamespace" + +/** + * Model OrganizationUserJoinTable + * + */ +export type OrganizationUserJoinTableModel = runtime.Types.Result.DefaultSelection + +export type AggregateOrganizationUserJoinTable = { + _count: OrganizationUserJoinTableCountAggregateOutputType | null + _min: OrganizationUserJoinTableMinAggregateOutputType | null + _max: OrganizationUserJoinTableMaxAggregateOutputType | null +} + +export type OrganizationUserJoinTableMinAggregateOutputType = { + userId: string | null + orgId: string | null + role: $Enums.ORG_ROLE | null + joinedDate: Date | null +} + +export type OrganizationUserJoinTableMaxAggregateOutputType = { + userId: string | null + orgId: string | null + role: $Enums.ORG_ROLE | null + joinedDate: Date | null +} + +export type OrganizationUserJoinTableCountAggregateOutputType = { + userId: number + orgId: number + role: number + joinedDate: number + _all: number +} + + +export type OrganizationUserJoinTableMinAggregateInputType = { + userId?: true + orgId?: true + role?: true + joinedDate?: true +} + +export type OrganizationUserJoinTableMaxAggregateInputType = { + userId?: true + orgId?: true + role?: true + joinedDate?: true +} + +export type OrganizationUserJoinTableCountAggregateInputType = { + userId?: true + orgId?: true + role?: true + joinedDate?: true + _all?: true +} + +export type OrganizationUserJoinTableAggregateArgs = { + /** + * Filter which OrganizationUserJoinTable to aggregate. + */ + where?: Prisma.OrganizationUserJoinTableWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of OrganizationUserJoinTables to fetch. + */ + orderBy?: Prisma.OrganizationUserJoinTableOrderByWithRelationInput | Prisma.OrganizationUserJoinTableOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.OrganizationUserJoinTableWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` OrganizationUserJoinTables 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` OrganizationUserJoinTables. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned OrganizationUserJoinTables + **/ + _count?: true | OrganizationUserJoinTableCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: OrganizationUserJoinTableMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: OrganizationUserJoinTableMaxAggregateInputType +} + +export type GetOrganizationUserJoinTableAggregateType = { + [P in keyof T & keyof AggregateOrganizationUserJoinTable]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type OrganizationUserJoinTableGroupByArgs = { + where?: Prisma.OrganizationUserJoinTableWhereInput + orderBy?: Prisma.OrganizationUserJoinTableOrderByWithAggregationInput | Prisma.OrganizationUserJoinTableOrderByWithAggregationInput[] + by: Prisma.OrganizationUserJoinTableScalarFieldEnum[] | Prisma.OrganizationUserJoinTableScalarFieldEnum + having?: Prisma.OrganizationUserJoinTableScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: OrganizationUserJoinTableCountAggregateInputType | true + _min?: OrganizationUserJoinTableMinAggregateInputType + _max?: OrganizationUserJoinTableMaxAggregateInputType +} + +export type OrganizationUserJoinTableGroupByOutputType = { + userId: string + orgId: string + role: $Enums.ORG_ROLE + joinedDate: Date + _count: OrganizationUserJoinTableCountAggregateOutputType | null + _min: OrganizationUserJoinTableMinAggregateOutputType | null + _max: OrganizationUserJoinTableMaxAggregateOutputType | null +} + +type GetOrganizationUserJoinTableGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof OrganizationUserJoinTableGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type OrganizationUserJoinTableWhereInput = { + AND?: Prisma.OrganizationUserJoinTableWhereInput | Prisma.OrganizationUserJoinTableWhereInput[] + OR?: Prisma.OrganizationUserJoinTableWhereInput[] + NOT?: Prisma.OrganizationUserJoinTableWhereInput | Prisma.OrganizationUserJoinTableWhereInput[] + userId?: Prisma.StringFilter<"OrganizationUserJoinTable"> | string + orgId?: Prisma.StringFilter<"OrganizationUserJoinTable"> | string + role?: Prisma.EnumORG_ROLEFilter<"OrganizationUserJoinTable"> | $Enums.ORG_ROLE + joinedDate?: Prisma.DateTimeFilter<"OrganizationUserJoinTable"> | Date | string +} + +export type OrganizationUserJoinTableOrderByWithRelationInput = { + userId?: Prisma.SortOrder + orgId?: Prisma.SortOrder + role?: Prisma.SortOrder + joinedDate?: Prisma.SortOrder +} + +export type OrganizationUserJoinTableWhereUniqueInput = Prisma.AtLeast<{ + userId_orgId?: Prisma.OrganizationUserJoinTableUserIdOrgIdCompoundUniqueInput + AND?: Prisma.OrganizationUserJoinTableWhereInput | Prisma.OrganizationUserJoinTableWhereInput[] + OR?: Prisma.OrganizationUserJoinTableWhereInput[] + NOT?: Prisma.OrganizationUserJoinTableWhereInput | Prisma.OrganizationUserJoinTableWhereInput[] + userId?: Prisma.StringFilter<"OrganizationUserJoinTable"> | string + orgId?: Prisma.StringFilter<"OrganizationUserJoinTable"> | string + role?: Prisma.EnumORG_ROLEFilter<"OrganizationUserJoinTable"> | $Enums.ORG_ROLE + joinedDate?: Prisma.DateTimeFilter<"OrganizationUserJoinTable"> | Date | string +}, "userId_orgId"> + +export type OrganizationUserJoinTableOrderByWithAggregationInput = { + userId?: Prisma.SortOrder + orgId?: Prisma.SortOrder + role?: Prisma.SortOrder + joinedDate?: Prisma.SortOrder + _count?: Prisma.OrganizationUserJoinTableCountOrderByAggregateInput + _max?: Prisma.OrganizationUserJoinTableMaxOrderByAggregateInput + _min?: Prisma.OrganizationUserJoinTableMinOrderByAggregateInput +} + +export type OrganizationUserJoinTableScalarWhereWithAggregatesInput = { + AND?: Prisma.OrganizationUserJoinTableScalarWhereWithAggregatesInput | Prisma.OrganizationUserJoinTableScalarWhereWithAggregatesInput[] + OR?: Prisma.OrganizationUserJoinTableScalarWhereWithAggregatesInput[] + NOT?: Prisma.OrganizationUserJoinTableScalarWhereWithAggregatesInput | Prisma.OrganizationUserJoinTableScalarWhereWithAggregatesInput[] + userId?: Prisma.StringWithAggregatesFilter<"OrganizationUserJoinTable"> | string + orgId?: Prisma.StringWithAggregatesFilter<"OrganizationUserJoinTable"> | string + role?: Prisma.EnumORG_ROLEWithAggregatesFilter<"OrganizationUserJoinTable"> | $Enums.ORG_ROLE + joinedDate?: Prisma.DateTimeWithAggregatesFilter<"OrganizationUserJoinTable"> | Date | string +} + +export type OrganizationUserJoinTableCreateInput = { + userId: string + orgId: string + role?: $Enums.ORG_ROLE + joinedDate?: Date | string +} + +export type OrganizationUserJoinTableUncheckedCreateInput = { + userId: string + orgId: string + role?: $Enums.ORG_ROLE + joinedDate?: Date | string +} + +export type OrganizationUserJoinTableUpdateInput = { + userId?: Prisma.StringFieldUpdateOperationsInput | string + orgId?: Prisma.StringFieldUpdateOperationsInput | string + role?: Prisma.EnumORG_ROLEFieldUpdateOperationsInput | $Enums.ORG_ROLE + joinedDate?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type OrganizationUserJoinTableUncheckedUpdateInput = { + userId?: Prisma.StringFieldUpdateOperationsInput | string + orgId?: Prisma.StringFieldUpdateOperationsInput | string + role?: Prisma.EnumORG_ROLEFieldUpdateOperationsInput | $Enums.ORG_ROLE + joinedDate?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type OrganizationUserJoinTableCreateManyInput = { + userId: string + orgId: string + role?: $Enums.ORG_ROLE + joinedDate?: Date | string +} + +export type OrganizationUserJoinTableUpdateManyMutationInput = { + userId?: Prisma.StringFieldUpdateOperationsInput | string + orgId?: Prisma.StringFieldUpdateOperationsInput | string + role?: Prisma.EnumORG_ROLEFieldUpdateOperationsInput | $Enums.ORG_ROLE + joinedDate?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type OrganizationUserJoinTableUncheckedUpdateManyInput = { + userId?: Prisma.StringFieldUpdateOperationsInput | string + orgId?: Prisma.StringFieldUpdateOperationsInput | string + role?: Prisma.EnumORG_ROLEFieldUpdateOperationsInput | $Enums.ORG_ROLE + joinedDate?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type OrganizationUserJoinTableUserIdOrgIdCompoundUniqueInput = { + userId: string + orgId: string +} + +export type OrganizationUserJoinTableCountOrderByAggregateInput = { + userId?: Prisma.SortOrder + orgId?: Prisma.SortOrder + role?: Prisma.SortOrder + joinedDate?: Prisma.SortOrder +} + +export type OrganizationUserJoinTableMaxOrderByAggregateInput = { + userId?: Prisma.SortOrder + orgId?: Prisma.SortOrder + role?: Prisma.SortOrder + joinedDate?: Prisma.SortOrder +} + +export type OrganizationUserJoinTableMinOrderByAggregateInput = { + userId?: Prisma.SortOrder + orgId?: Prisma.SortOrder + role?: Prisma.SortOrder + joinedDate?: Prisma.SortOrder +} + +export type EnumORG_ROLEFieldUpdateOperationsInput = { + set?: $Enums.ORG_ROLE +} + + + +export type OrganizationUserJoinTableSelect = runtime.Types.Extensions.GetSelect<{ + userId?: boolean + orgId?: boolean + role?: boolean + joinedDate?: boolean +}, ExtArgs["result"]["organizationUserJoinTable"]> + +export type OrganizationUserJoinTableSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + userId?: boolean + orgId?: boolean + role?: boolean + joinedDate?: boolean +}, ExtArgs["result"]["organizationUserJoinTable"]> + +export type OrganizationUserJoinTableSelectUpdateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + userId?: boolean + orgId?: boolean + role?: boolean + joinedDate?: boolean +}, ExtArgs["result"]["organizationUserJoinTable"]> + +export type OrganizationUserJoinTableSelectScalar = { + userId?: boolean + orgId?: boolean + role?: boolean + joinedDate?: boolean +} + +export type OrganizationUserJoinTableOmit = runtime.Types.Extensions.GetOmit<"userId" | "orgId" | "role" | "joinedDate", ExtArgs["result"]["organizationUserJoinTable"]> + +export type $OrganizationUserJoinTablePayload = { + name: "OrganizationUserJoinTable" + objects: {} + scalars: runtime.Types.Extensions.GetPayloadResult<{ + userId: string + orgId: string + role: $Enums.ORG_ROLE + joinedDate: Date + }, ExtArgs["result"]["organizationUserJoinTable"]> + composites: {} +} + +export type OrganizationUserJoinTableGetPayload = runtime.Types.Result.GetResult + +export type OrganizationUserJoinTableCountArgs = + Omit & { + select?: OrganizationUserJoinTableCountAggregateInputType | true + } + +export interface OrganizationUserJoinTableDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['OrganizationUserJoinTable'], meta: { name: 'OrganizationUserJoinTable' } } + /** + * Find zero or one OrganizationUserJoinTable that matches the filter. + * @param {OrganizationUserJoinTableFindUniqueArgs} args - Arguments to find a OrganizationUserJoinTable + * @example + * // Get one OrganizationUserJoinTable + * const organizationUserJoinTable = await prisma.organizationUserJoinTable.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__OrganizationUserJoinTableClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one OrganizationUserJoinTable that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {OrganizationUserJoinTableFindUniqueOrThrowArgs} args - Arguments to find a OrganizationUserJoinTable + * @example + * // Get one OrganizationUserJoinTable + * const organizationUserJoinTable = await prisma.organizationUserJoinTable.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__OrganizationUserJoinTableClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first OrganizationUserJoinTable 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 {OrganizationUserJoinTableFindFirstArgs} args - Arguments to find a OrganizationUserJoinTable + * @example + * // Get one OrganizationUserJoinTable + * const organizationUserJoinTable = await prisma.organizationUserJoinTable.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__OrganizationUserJoinTableClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first OrganizationUserJoinTable 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 {OrganizationUserJoinTableFindFirstOrThrowArgs} args - Arguments to find a OrganizationUserJoinTable + * @example + * // Get one OrganizationUserJoinTable + * const organizationUserJoinTable = await prisma.organizationUserJoinTable.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__OrganizationUserJoinTableClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more OrganizationUserJoinTables 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 {OrganizationUserJoinTableFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all OrganizationUserJoinTables + * const organizationUserJoinTables = await prisma.organizationUserJoinTable.findMany() + * + * // Get first 10 OrganizationUserJoinTables + * const organizationUserJoinTables = await prisma.organizationUserJoinTable.findMany({ take: 10 }) + * + * // Only select the `userId` + * const organizationUserJoinTableWithUserIdOnly = await prisma.organizationUserJoinTable.findMany({ select: { userId: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a OrganizationUserJoinTable. + * @param {OrganizationUserJoinTableCreateArgs} args - Arguments to create a OrganizationUserJoinTable. + * @example + * // Create one OrganizationUserJoinTable + * const OrganizationUserJoinTable = await prisma.organizationUserJoinTable.create({ + * data: { + * // ... data to create a OrganizationUserJoinTable + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__OrganizationUserJoinTableClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many OrganizationUserJoinTables. + * @param {OrganizationUserJoinTableCreateManyArgs} args - Arguments to create many OrganizationUserJoinTables. + * @example + * // Create many OrganizationUserJoinTables + * const organizationUserJoinTable = await prisma.organizationUserJoinTable.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create many OrganizationUserJoinTables and returns the data saved in the database. + * @param {OrganizationUserJoinTableCreateManyAndReturnArgs} args - Arguments to create many OrganizationUserJoinTables. + * @example + * // Create many OrganizationUserJoinTables + * const organizationUserJoinTable = await prisma.organizationUserJoinTable.createManyAndReturn({ + * data: [ + * // ... provide data here + * ] + * }) + * + * // Create many OrganizationUserJoinTables and only return the `userId` + * const organizationUserJoinTableWithUserIdOnly = await prisma.organizationUserJoinTable.createManyAndReturn({ + * select: { userId: true }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + createManyAndReturn(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "createManyAndReturn", GlobalOmitOptions>> + + /** + * Delete a OrganizationUserJoinTable. + * @param {OrganizationUserJoinTableDeleteArgs} args - Arguments to delete one OrganizationUserJoinTable. + * @example + * // Delete one OrganizationUserJoinTable + * const OrganizationUserJoinTable = await prisma.organizationUserJoinTable.delete({ + * where: { + * // ... filter to delete one OrganizationUserJoinTable + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__OrganizationUserJoinTableClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one OrganizationUserJoinTable. + * @param {OrganizationUserJoinTableUpdateArgs} args - Arguments to update one OrganizationUserJoinTable. + * @example + * // Update one OrganizationUserJoinTable + * const organizationUserJoinTable = await prisma.organizationUserJoinTable.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__OrganizationUserJoinTableClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more OrganizationUserJoinTables. + * @param {OrganizationUserJoinTableDeleteManyArgs} args - Arguments to filter OrganizationUserJoinTables to delete. + * @example + * // Delete a few OrganizationUserJoinTables + * const { count } = await prisma.organizationUserJoinTable.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more OrganizationUserJoinTables. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {OrganizationUserJoinTableUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many OrganizationUserJoinTables + * const organizationUserJoinTable = await prisma.organizationUserJoinTable.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more OrganizationUserJoinTables and returns the data updated in the database. + * @param {OrganizationUserJoinTableUpdateManyAndReturnArgs} args - Arguments to update many OrganizationUserJoinTables. + * @example + * // Update many OrganizationUserJoinTables + * const organizationUserJoinTable = await prisma.organizationUserJoinTable.updateManyAndReturn({ + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * + * // Update zero or more OrganizationUserJoinTables and only return the `userId` + * const organizationUserJoinTableWithUserIdOnly = await prisma.organizationUserJoinTable.updateManyAndReturn({ + * select: { userId: true }, + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + updateManyAndReturn(args: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "updateManyAndReturn", GlobalOmitOptions>> + + /** + * Create or update one OrganizationUserJoinTable. + * @param {OrganizationUserJoinTableUpsertArgs} args - Arguments to update or create a OrganizationUserJoinTable. + * @example + * // Update or create a OrganizationUserJoinTable + * const organizationUserJoinTable = await prisma.organizationUserJoinTable.upsert({ + * create: { + * // ... data to create a OrganizationUserJoinTable + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the OrganizationUserJoinTable we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__OrganizationUserJoinTableClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of OrganizationUserJoinTables. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {OrganizationUserJoinTableCountArgs} args - Arguments to filter OrganizationUserJoinTables to count. + * @example + * // Count the number of OrganizationUserJoinTables + * const count = await prisma.organizationUserJoinTable.count({ + * where: { + * // ... the filter for the OrganizationUserJoinTables 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 OrganizationUserJoinTable. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {OrganizationUserJoinTableAggregateArgs} 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 OrganizationUserJoinTable. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {OrganizationUserJoinTableGroupByArgs} 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 OrganizationUserJoinTableGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: OrganizationUserJoinTableGroupByArgs['orderBy'] } + : { orderBy?: OrganizationUserJoinTableGroupByArgs['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 ? GetOrganizationUserJoinTableGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the OrganizationUserJoinTable model + */ +readonly fields: OrganizationUserJoinTableFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for OrganizationUserJoinTable. + * 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__OrganizationUserJoinTableClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + /** + * 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 OrganizationUserJoinTable model + */ +export interface OrganizationUserJoinTableFieldRefs { + readonly userId: Prisma.FieldRef<"OrganizationUserJoinTable", 'String'> + readonly orgId: Prisma.FieldRef<"OrganizationUserJoinTable", 'String'> + readonly role: Prisma.FieldRef<"OrganizationUserJoinTable", 'ORG_ROLE'> + readonly joinedDate: Prisma.FieldRef<"OrganizationUserJoinTable", 'DateTime'> +} + + +// Custom InputTypes +/** + * OrganizationUserJoinTable findUnique + */ +export type OrganizationUserJoinTableFindUniqueArgs = { + /** + * Select specific fields to fetch from the OrganizationUserJoinTable + */ + select?: Prisma.OrganizationUserJoinTableSelect | null + /** + * Omit specific fields from the OrganizationUserJoinTable + */ + omit?: Prisma.OrganizationUserJoinTableOmit | null + /** + * Filter, which OrganizationUserJoinTable to fetch. + */ + where: Prisma.OrganizationUserJoinTableWhereUniqueInput +} + +/** + * OrganizationUserJoinTable findUniqueOrThrow + */ +export type OrganizationUserJoinTableFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the OrganizationUserJoinTable + */ + select?: Prisma.OrganizationUserJoinTableSelect | null + /** + * Omit specific fields from the OrganizationUserJoinTable + */ + omit?: Prisma.OrganizationUserJoinTableOmit | null + /** + * Filter, which OrganizationUserJoinTable to fetch. + */ + where: Prisma.OrganizationUserJoinTableWhereUniqueInput +} + +/** + * OrganizationUserJoinTable findFirst + */ +export type OrganizationUserJoinTableFindFirstArgs = { + /** + * Select specific fields to fetch from the OrganizationUserJoinTable + */ + select?: Prisma.OrganizationUserJoinTableSelect | null + /** + * Omit specific fields from the OrganizationUserJoinTable + */ + omit?: Prisma.OrganizationUserJoinTableOmit | null + /** + * Filter, which OrganizationUserJoinTable to fetch. + */ + where?: Prisma.OrganizationUserJoinTableWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of OrganizationUserJoinTables to fetch. + */ + orderBy?: Prisma.OrganizationUserJoinTableOrderByWithRelationInput | Prisma.OrganizationUserJoinTableOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for OrganizationUserJoinTables. + */ + cursor?: Prisma.OrganizationUserJoinTableWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` OrganizationUserJoinTables 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` OrganizationUserJoinTables. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of OrganizationUserJoinTables. + */ + distinct?: Prisma.OrganizationUserJoinTableScalarFieldEnum | Prisma.OrganizationUserJoinTableScalarFieldEnum[] +} + +/** + * OrganizationUserJoinTable findFirstOrThrow + */ +export type OrganizationUserJoinTableFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the OrganizationUserJoinTable + */ + select?: Prisma.OrganizationUserJoinTableSelect | null + /** + * Omit specific fields from the OrganizationUserJoinTable + */ + omit?: Prisma.OrganizationUserJoinTableOmit | null + /** + * Filter, which OrganizationUserJoinTable to fetch. + */ + where?: Prisma.OrganizationUserJoinTableWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of OrganizationUserJoinTables to fetch. + */ + orderBy?: Prisma.OrganizationUserJoinTableOrderByWithRelationInput | Prisma.OrganizationUserJoinTableOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for OrganizationUserJoinTables. + */ + cursor?: Prisma.OrganizationUserJoinTableWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` OrganizationUserJoinTables 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` OrganizationUserJoinTables. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of OrganizationUserJoinTables. + */ + distinct?: Prisma.OrganizationUserJoinTableScalarFieldEnum | Prisma.OrganizationUserJoinTableScalarFieldEnum[] +} + +/** + * OrganizationUserJoinTable findMany + */ +export type OrganizationUserJoinTableFindManyArgs = { + /** + * Select specific fields to fetch from the OrganizationUserJoinTable + */ + select?: Prisma.OrganizationUserJoinTableSelect | null + /** + * Omit specific fields from the OrganizationUserJoinTable + */ + omit?: Prisma.OrganizationUserJoinTableOmit | null + /** + * Filter, which OrganizationUserJoinTables to fetch. + */ + where?: Prisma.OrganizationUserJoinTableWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of OrganizationUserJoinTables to fetch. + */ + orderBy?: Prisma.OrganizationUserJoinTableOrderByWithRelationInput | Prisma.OrganizationUserJoinTableOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing OrganizationUserJoinTables. + */ + cursor?: Prisma.OrganizationUserJoinTableWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` OrganizationUserJoinTables 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` OrganizationUserJoinTables. + */ + skip?: number + distinct?: Prisma.OrganizationUserJoinTableScalarFieldEnum | Prisma.OrganizationUserJoinTableScalarFieldEnum[] +} + +/** + * OrganizationUserJoinTable create + */ +export type OrganizationUserJoinTableCreateArgs = { + /** + * Select specific fields to fetch from the OrganizationUserJoinTable + */ + select?: Prisma.OrganizationUserJoinTableSelect | null + /** + * Omit specific fields from the OrganizationUserJoinTable + */ + omit?: Prisma.OrganizationUserJoinTableOmit | null + /** + * The data needed to create a OrganizationUserJoinTable. + */ + data: Prisma.XOR +} + +/** + * OrganizationUserJoinTable createMany + */ +export type OrganizationUserJoinTableCreateManyArgs = { + /** + * The data used to create many OrganizationUserJoinTables. + */ + data: Prisma.OrganizationUserJoinTableCreateManyInput | Prisma.OrganizationUserJoinTableCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * OrganizationUserJoinTable createManyAndReturn + */ +export type OrganizationUserJoinTableCreateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the OrganizationUserJoinTable + */ + select?: Prisma.OrganizationUserJoinTableSelectCreateManyAndReturn | null + /** + * Omit specific fields from the OrganizationUserJoinTable + */ + omit?: Prisma.OrganizationUserJoinTableOmit | null + /** + * The data used to create many OrganizationUserJoinTables. + */ + data: Prisma.OrganizationUserJoinTableCreateManyInput | Prisma.OrganizationUserJoinTableCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * OrganizationUserJoinTable update + */ +export type OrganizationUserJoinTableUpdateArgs = { + /** + * Select specific fields to fetch from the OrganizationUserJoinTable + */ + select?: Prisma.OrganizationUserJoinTableSelect | null + /** + * Omit specific fields from the OrganizationUserJoinTable + */ + omit?: Prisma.OrganizationUserJoinTableOmit | null + /** + * The data needed to update a OrganizationUserJoinTable. + */ + data: Prisma.XOR + /** + * Choose, which OrganizationUserJoinTable to update. + */ + where: Prisma.OrganizationUserJoinTableWhereUniqueInput +} + +/** + * OrganizationUserJoinTable updateMany + */ +export type OrganizationUserJoinTableUpdateManyArgs = { + /** + * The data used to update OrganizationUserJoinTables. + */ + data: Prisma.XOR + /** + * Filter which OrganizationUserJoinTables to update + */ + where?: Prisma.OrganizationUserJoinTableWhereInput + /** + * Limit how many OrganizationUserJoinTables to update. + */ + limit?: number +} + +/** + * OrganizationUserJoinTable updateManyAndReturn + */ +export type OrganizationUserJoinTableUpdateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the OrganizationUserJoinTable + */ + select?: Prisma.OrganizationUserJoinTableSelectUpdateManyAndReturn | null + /** + * Omit specific fields from the OrganizationUserJoinTable + */ + omit?: Prisma.OrganizationUserJoinTableOmit | null + /** + * The data used to update OrganizationUserJoinTables. + */ + data: Prisma.XOR + /** + * Filter which OrganizationUserJoinTables to update + */ + where?: Prisma.OrganizationUserJoinTableWhereInput + /** + * Limit how many OrganizationUserJoinTables to update. + */ + limit?: number +} + +/** + * OrganizationUserJoinTable upsert + */ +export type OrganizationUserJoinTableUpsertArgs = { + /** + * Select specific fields to fetch from the OrganizationUserJoinTable + */ + select?: Prisma.OrganizationUserJoinTableSelect | null + /** + * Omit specific fields from the OrganizationUserJoinTable + */ + omit?: Prisma.OrganizationUserJoinTableOmit | null + /** + * The filter to search for the OrganizationUserJoinTable to update in case it exists. + */ + where: Prisma.OrganizationUserJoinTableWhereUniqueInput + /** + * In case the OrganizationUserJoinTable found by the `where` argument doesn't exist, create a new OrganizationUserJoinTable with this data. + */ + create: Prisma.XOR + /** + * In case the OrganizationUserJoinTable was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * OrganizationUserJoinTable delete + */ +export type OrganizationUserJoinTableDeleteArgs = { + /** + * Select specific fields to fetch from the OrganizationUserJoinTable + */ + select?: Prisma.OrganizationUserJoinTableSelect | null + /** + * Omit specific fields from the OrganizationUserJoinTable + */ + omit?: Prisma.OrganizationUserJoinTableOmit | null + /** + * Filter which OrganizationUserJoinTable to delete. + */ + where: Prisma.OrganizationUserJoinTableWhereUniqueInput +} + +/** + * OrganizationUserJoinTable deleteMany + */ +export type OrganizationUserJoinTableDeleteManyArgs = { + /** + * Filter which OrganizationUserJoinTables to delete + */ + where?: Prisma.OrganizationUserJoinTableWhereInput + /** + * Limit how many OrganizationUserJoinTables to delete. + */ + limit?: number +} + +/** + * OrganizationUserJoinTable without action + */ +export type OrganizationUserJoinTableDefaultArgs = { + /** + * Select specific fields to fetch from the OrganizationUserJoinTable + */ + select?: Prisma.OrganizationUserJoinTableSelect | null + /** + * Omit specific fields from the OrganizationUserJoinTable + */ + omit?: Prisma.OrganizationUserJoinTableOmit | null +} diff --git a/prisma/generated/prisma/models/User.ts b/prisma/generated/prisma/models/User.ts new file mode 100644 index 0000000..88f62da --- /dev/null +++ b/prisma/generated/prisma/models/User.ts @@ -0,0 +1,1408 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `User` 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" +import type * as Prisma from "../internal/prismaNamespace" + +/** + * Model User + * + */ +export type UserModel = runtime.Types.Result.DefaultSelection + +export type AggregateUser = { + _count: UserCountAggregateOutputType | null + _min: UserMinAggregateOutputType | null + _max: UserMaxAggregateOutputType | null +} + +export type UserMinAggregateOutputType = { + id: string | null + firstName: string | null + middleName: string | null + lastName: string | null + email: string | null + password: string | null + role: $Enums.USER_ROLE | null + isVerified: boolean | null + refreshToken: string | null + profilePicture: string | null + isDeleted: boolean | null + deletedAt: Date | null + createdAt: Date | null + updatedAt: Date | null +} + +export type UserMaxAggregateOutputType = { + id: string | null + firstName: string | null + middleName: string | null + lastName: string | null + email: string | null + password: string | null + role: $Enums.USER_ROLE | null + isVerified: boolean | null + refreshToken: string | null + profilePicture: string | null + isDeleted: boolean | null + deletedAt: Date | null + createdAt: Date | null + updatedAt: Date | null +} + +export type UserCountAggregateOutputType = { + id: number + firstName: number + middleName: number + lastName: number + email: number + password: number + role: number + isVerified: number + refreshToken: number + profilePicture: number + isDeleted: number + deletedAt: number + createdAt: number + updatedAt: number + _all: number +} + + +export type UserMinAggregateInputType = { + id?: true + firstName?: true + middleName?: true + lastName?: true + email?: true + password?: true + role?: true + isVerified?: true + refreshToken?: true + profilePicture?: true + isDeleted?: true + deletedAt?: true + createdAt?: true + updatedAt?: true +} + +export type UserMaxAggregateInputType = { + id?: true + firstName?: true + middleName?: true + lastName?: true + email?: true + password?: true + role?: true + isVerified?: true + refreshToken?: true + profilePicture?: true + isDeleted?: true + deletedAt?: true + createdAt?: true + updatedAt?: true +} + +export type UserCountAggregateInputType = { + id?: true + firstName?: true + middleName?: true + lastName?: true + email?: true + password?: true + role?: true + isVerified?: true + refreshToken?: true + profilePicture?: true + isDeleted?: true + deletedAt?: true + createdAt?: true + updatedAt?: true + _all?: true +} + +export type UserAggregateArgs = { + /** + * Filter which User to aggregate. + */ + where?: Prisma.UserWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Users to fetch. + */ + orderBy?: Prisma.UserOrderByWithRelationInput | Prisma.UserOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.UserWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Users 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` Users. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned Users + **/ + _count?: true | UserCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: UserMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: UserMaxAggregateInputType +} + +export type GetUserAggregateType = { + [P in keyof T & keyof AggregateUser]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type UserGroupByArgs = { + where?: Prisma.UserWhereInput + orderBy?: Prisma.UserOrderByWithAggregationInput | Prisma.UserOrderByWithAggregationInput[] + by: Prisma.UserScalarFieldEnum[] | Prisma.UserScalarFieldEnum + having?: Prisma.UserScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: UserCountAggregateInputType | true + _min?: UserMinAggregateInputType + _max?: UserMaxAggregateInputType +} + +export type UserGroupByOutputType = { + id: string + firstName: string + middleName: string | null + lastName: string + email: string + password: string + role: $Enums.USER_ROLE + isVerified: boolean | null + refreshToken: string | null + profilePicture: string | null + isDeleted: boolean | null + deletedAt: Date | null + createdAt: Date + updatedAt: Date + _count: UserCountAggregateOutputType | null + _min: UserMinAggregateOutputType | null + _max: UserMaxAggregateOutputType | null +} + +type GetUserGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof UserGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type UserWhereInput = { + AND?: Prisma.UserWhereInput | Prisma.UserWhereInput[] + OR?: Prisma.UserWhereInput[] + NOT?: Prisma.UserWhereInput | Prisma.UserWhereInput[] + id?: Prisma.StringFilter<"User"> | string + firstName?: Prisma.StringFilter<"User"> | string + middleName?: Prisma.StringNullableFilter<"User"> | string | null + lastName?: Prisma.StringFilter<"User"> | string + email?: Prisma.StringFilter<"User"> | string + password?: Prisma.StringFilter<"User"> | string + role?: Prisma.EnumUSER_ROLEFilter<"User"> | $Enums.USER_ROLE + isVerified?: Prisma.BoolNullableFilter<"User"> | boolean | null + refreshToken?: Prisma.StringNullableFilter<"User"> | string | null + profilePicture?: Prisma.StringNullableFilter<"User"> | string | null + isDeleted?: Prisma.BoolNullableFilter<"User"> | boolean | null + deletedAt?: Prisma.DateTimeNullableFilter<"User"> | Date | string | null + createdAt?: Prisma.DateTimeFilter<"User"> | Date | string + updatedAt?: Prisma.DateTimeFilter<"User"> | Date | string +} + +export type UserOrderByWithRelationInput = { + id?: Prisma.SortOrder + firstName?: Prisma.SortOrder + middleName?: Prisma.SortOrderInput | Prisma.SortOrder + lastName?: Prisma.SortOrder + email?: Prisma.SortOrder + password?: Prisma.SortOrder + role?: Prisma.SortOrder + isVerified?: Prisma.SortOrderInput | Prisma.SortOrder + refreshToken?: Prisma.SortOrderInput | Prisma.SortOrder + profilePicture?: Prisma.SortOrderInput | Prisma.SortOrder + isDeleted?: Prisma.SortOrderInput | Prisma.SortOrder + deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type UserWhereUniqueInput = Prisma.AtLeast<{ + id?: string + email?: string + AND?: Prisma.UserWhereInput | Prisma.UserWhereInput[] + OR?: Prisma.UserWhereInput[] + NOT?: Prisma.UserWhereInput | Prisma.UserWhereInput[] + firstName?: Prisma.StringFilter<"User"> | string + middleName?: Prisma.StringNullableFilter<"User"> | string | null + lastName?: Prisma.StringFilter<"User"> | string + password?: Prisma.StringFilter<"User"> | string + role?: Prisma.EnumUSER_ROLEFilter<"User"> | $Enums.USER_ROLE + isVerified?: Prisma.BoolNullableFilter<"User"> | boolean | null + refreshToken?: Prisma.StringNullableFilter<"User"> | string | null + profilePicture?: Prisma.StringNullableFilter<"User"> | string | null + isDeleted?: Prisma.BoolNullableFilter<"User"> | boolean | null + deletedAt?: Prisma.DateTimeNullableFilter<"User"> | Date | string | null + createdAt?: Prisma.DateTimeFilter<"User"> | Date | string + updatedAt?: Prisma.DateTimeFilter<"User"> | Date | string +}, "id" | "email"> + +export type UserOrderByWithAggregationInput = { + id?: Prisma.SortOrder + firstName?: Prisma.SortOrder + middleName?: Prisma.SortOrderInput | Prisma.SortOrder + lastName?: Prisma.SortOrder + email?: Prisma.SortOrder + password?: Prisma.SortOrder + role?: Prisma.SortOrder + isVerified?: Prisma.SortOrderInput | Prisma.SortOrder + refreshToken?: Prisma.SortOrderInput | Prisma.SortOrder + profilePicture?: Prisma.SortOrderInput | Prisma.SortOrder + isDeleted?: Prisma.SortOrderInput | Prisma.SortOrder + deletedAt?: Prisma.SortOrderInput | Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder + _count?: Prisma.UserCountOrderByAggregateInput + _max?: Prisma.UserMaxOrderByAggregateInput + _min?: Prisma.UserMinOrderByAggregateInput +} + +export type UserScalarWhereWithAggregatesInput = { + AND?: Prisma.UserScalarWhereWithAggregatesInput | Prisma.UserScalarWhereWithAggregatesInput[] + OR?: Prisma.UserScalarWhereWithAggregatesInput[] + NOT?: Prisma.UserScalarWhereWithAggregatesInput | Prisma.UserScalarWhereWithAggregatesInput[] + id?: Prisma.StringWithAggregatesFilter<"User"> | string + firstName?: Prisma.StringWithAggregatesFilter<"User"> | string + middleName?: Prisma.StringNullableWithAggregatesFilter<"User"> | string | null + lastName?: Prisma.StringWithAggregatesFilter<"User"> | string + email?: Prisma.StringWithAggregatesFilter<"User"> | string + password?: Prisma.StringWithAggregatesFilter<"User"> | string + role?: Prisma.EnumUSER_ROLEWithAggregatesFilter<"User"> | $Enums.USER_ROLE + isVerified?: Prisma.BoolNullableWithAggregatesFilter<"User"> | boolean | null + refreshToken?: Prisma.StringNullableWithAggregatesFilter<"User"> | string | null + profilePicture?: Prisma.StringNullableWithAggregatesFilter<"User"> | string | null + isDeleted?: Prisma.BoolNullableWithAggregatesFilter<"User"> | boolean | null + deletedAt?: Prisma.DateTimeNullableWithAggregatesFilter<"User"> | Date | string | null + createdAt?: Prisma.DateTimeWithAggregatesFilter<"User"> | Date | string + updatedAt?: Prisma.DateTimeWithAggregatesFilter<"User"> | Date | string +} + +export type UserCreateInput = { + id?: string + firstName: string + middleName?: string | null + lastName: string + email: string + password: string + role?: $Enums.USER_ROLE + isVerified?: boolean | null + refreshToken?: string | null + profilePicture?: string | null + isDeleted?: boolean | null + deletedAt?: Date | string | null + createdAt?: Date | string + updatedAt?: Date | string +} + +export type UserUncheckedCreateInput = { + id?: string + firstName: string + middleName?: string | null + lastName: string + email: string + password: string + role?: $Enums.USER_ROLE + isVerified?: boolean | null + refreshToken?: string | null + profilePicture?: string | null + isDeleted?: boolean | null + deletedAt?: Date | string | null + createdAt?: Date | string + updatedAt?: Date | string +} + +export type UserUpdateInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + firstName?: Prisma.StringFieldUpdateOperationsInput | string + middleName?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + lastName?: Prisma.StringFieldUpdateOperationsInput | string + email?: Prisma.StringFieldUpdateOperationsInput | string + password?: Prisma.StringFieldUpdateOperationsInput | string + role?: Prisma.EnumUSER_ROLEFieldUpdateOperationsInput | $Enums.USER_ROLE + isVerified?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null + refreshToken?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + profilePicture?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + isDeleted?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type UserUncheckedUpdateInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + firstName?: Prisma.StringFieldUpdateOperationsInput | string + middleName?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + lastName?: Prisma.StringFieldUpdateOperationsInput | string + email?: Prisma.StringFieldUpdateOperationsInput | string + password?: Prisma.StringFieldUpdateOperationsInput | string + role?: Prisma.EnumUSER_ROLEFieldUpdateOperationsInput | $Enums.USER_ROLE + isVerified?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null + refreshToken?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + profilePicture?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + isDeleted?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type UserCreateManyInput = { + id?: string + firstName: string + middleName?: string | null + lastName: string + email: string + password: string + role?: $Enums.USER_ROLE + isVerified?: boolean | null + refreshToken?: string | null + profilePicture?: string | null + isDeleted?: boolean | null + deletedAt?: Date | string | null + createdAt?: Date | string + updatedAt?: Date | string +} + +export type UserUpdateManyMutationInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + firstName?: Prisma.StringFieldUpdateOperationsInput | string + middleName?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + lastName?: Prisma.StringFieldUpdateOperationsInput | string + email?: Prisma.StringFieldUpdateOperationsInput | string + password?: Prisma.StringFieldUpdateOperationsInput | string + role?: Prisma.EnumUSER_ROLEFieldUpdateOperationsInput | $Enums.USER_ROLE + isVerified?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null + refreshToken?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + profilePicture?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + isDeleted?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type UserUncheckedUpdateManyInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + firstName?: Prisma.StringFieldUpdateOperationsInput | string + middleName?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + lastName?: Prisma.StringFieldUpdateOperationsInput | string + email?: Prisma.StringFieldUpdateOperationsInput | string + password?: Prisma.StringFieldUpdateOperationsInput | string + role?: Prisma.EnumUSER_ROLEFieldUpdateOperationsInput | $Enums.USER_ROLE + isVerified?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null + refreshToken?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + profilePicture?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + isDeleted?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null + deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type UserCountOrderByAggregateInput = { + id?: Prisma.SortOrder + firstName?: Prisma.SortOrder + middleName?: Prisma.SortOrder + lastName?: Prisma.SortOrder + email?: Prisma.SortOrder + password?: Prisma.SortOrder + role?: Prisma.SortOrder + isVerified?: Prisma.SortOrder + refreshToken?: Prisma.SortOrder + profilePicture?: Prisma.SortOrder + isDeleted?: Prisma.SortOrder + deletedAt?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type UserMaxOrderByAggregateInput = { + id?: Prisma.SortOrder + firstName?: Prisma.SortOrder + middleName?: Prisma.SortOrder + lastName?: Prisma.SortOrder + email?: Prisma.SortOrder + password?: Prisma.SortOrder + role?: Prisma.SortOrder + isVerified?: Prisma.SortOrder + refreshToken?: Prisma.SortOrder + profilePicture?: Prisma.SortOrder + isDeleted?: Prisma.SortOrder + deletedAt?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type UserMinOrderByAggregateInput = { + id?: Prisma.SortOrder + firstName?: Prisma.SortOrder + middleName?: Prisma.SortOrder + lastName?: Prisma.SortOrder + email?: Prisma.SortOrder + password?: Prisma.SortOrder + role?: Prisma.SortOrder + isVerified?: Prisma.SortOrder + refreshToken?: Prisma.SortOrder + profilePicture?: Prisma.SortOrder + isDeleted?: Prisma.SortOrder + deletedAt?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type EnumUSER_ROLEFieldUpdateOperationsInput = { + set?: $Enums.USER_ROLE +} + +export type NullableBoolFieldUpdateOperationsInput = { + set?: boolean | null +} + +export type NullableDateTimeFieldUpdateOperationsInput = { + set?: Date | string | null +} + + + +export type UserSelect = runtime.Types.Extensions.GetSelect<{ + id?: boolean + firstName?: boolean + middleName?: boolean + lastName?: boolean + email?: boolean + password?: boolean + role?: boolean + isVerified?: boolean + refreshToken?: boolean + profilePicture?: boolean + isDeleted?: boolean + deletedAt?: boolean + createdAt?: boolean + updatedAt?: boolean +}, ExtArgs["result"]["user"]> + +export type UserSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + firstName?: boolean + middleName?: boolean + lastName?: boolean + email?: boolean + password?: boolean + role?: boolean + isVerified?: boolean + refreshToken?: boolean + profilePicture?: boolean + isDeleted?: boolean + deletedAt?: boolean + createdAt?: boolean + updatedAt?: boolean +}, ExtArgs["result"]["user"]> + +export type UserSelectUpdateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + firstName?: boolean + middleName?: boolean + lastName?: boolean + email?: boolean + password?: boolean + role?: boolean + isVerified?: boolean + refreshToken?: boolean + profilePicture?: boolean + isDeleted?: boolean + deletedAt?: boolean + createdAt?: boolean + updatedAt?: boolean +}, ExtArgs["result"]["user"]> + +export type UserSelectScalar = { + id?: boolean + firstName?: boolean + middleName?: boolean + lastName?: boolean + email?: boolean + password?: boolean + role?: boolean + isVerified?: boolean + refreshToken?: boolean + profilePicture?: boolean + isDeleted?: boolean + deletedAt?: boolean + createdAt?: boolean + updatedAt?: boolean +} + +export type UserOmit = runtime.Types.Extensions.GetOmit<"id" | "firstName" | "middleName" | "lastName" | "email" | "password" | "role" | "isVerified" | "refreshToken" | "profilePicture" | "isDeleted" | "deletedAt" | "createdAt" | "updatedAt", ExtArgs["result"]["user"]> + +export type $UserPayload = { + name: "User" + objects: {} + scalars: runtime.Types.Extensions.GetPayloadResult<{ + id: string + firstName: string + middleName: string | null + lastName: string + email: string + password: string + role: $Enums.USER_ROLE + isVerified: boolean | null + refreshToken: string | null + profilePicture: string | null + isDeleted: boolean | null + deletedAt: Date | null + createdAt: Date + updatedAt: Date + }, ExtArgs["result"]["user"]> + composites: {} +} + +export type UserGetPayload = runtime.Types.Result.GetResult + +export type UserCountArgs = + Omit & { + select?: UserCountAggregateInputType | true + } + +export interface UserDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['User'], meta: { name: 'User' } } + /** + * Find zero or one User that matches the filter. + * @param {UserFindUniqueArgs} args - Arguments to find a User + * @example + * // Get one User + * const user = await prisma.user.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__UserClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one User that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {UserFindUniqueOrThrowArgs} args - Arguments to find a User + * @example + * // Get one User + * const user = await prisma.user.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__UserClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first User 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 {UserFindFirstArgs} args - Arguments to find a User + * @example + * // Get one User + * const user = await prisma.user.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__UserClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first User 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 {UserFindFirstOrThrowArgs} args - Arguments to find a User + * @example + * // Get one User + * const user = await prisma.user.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__UserClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more Users 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 {UserFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all Users + * const users = await prisma.user.findMany() + * + * // Get first 10 Users + * const users = await prisma.user.findMany({ take: 10 }) + * + * // Only select the `id` + * const userWithIdOnly = await prisma.user.findMany({ select: { id: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a User. + * @param {UserCreateArgs} args - Arguments to create a User. + * @example + * // Create one User + * const User = await prisma.user.create({ + * data: { + * // ... data to create a User + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__UserClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many Users. + * @param {UserCreateManyArgs} args - Arguments to create many Users. + * @example + * // Create many Users + * const user = await prisma.user.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create many Users and returns the data saved in the database. + * @param {UserCreateManyAndReturnArgs} args - Arguments to create many Users. + * @example + * // Create many Users + * const user = await prisma.user.createManyAndReturn({ + * data: [ + * // ... provide data here + * ] + * }) + * + * // Create many Users and only return the `id` + * const userWithIdOnly = await prisma.user.createManyAndReturn({ + * select: { id: true }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + createManyAndReturn(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "createManyAndReturn", GlobalOmitOptions>> + + /** + * Delete a User. + * @param {UserDeleteArgs} args - Arguments to delete one User. + * @example + * // Delete one User + * const User = await prisma.user.delete({ + * where: { + * // ... filter to delete one User + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__UserClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one User. + * @param {UserUpdateArgs} args - Arguments to update one User. + * @example + * // Update one User + * const user = await prisma.user.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__UserClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more Users. + * @param {UserDeleteManyArgs} args - Arguments to filter Users to delete. + * @example + * // Delete a few Users + * const { count } = await prisma.user.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more Users. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {UserUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many Users + * const user = await prisma.user.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more Users and returns the data updated in the database. + * @param {UserUpdateManyAndReturnArgs} args - Arguments to update many Users. + * @example + * // Update many Users + * const user = await prisma.user.updateManyAndReturn({ + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * + * // Update zero or more Users and only return the `id` + * const userWithIdOnly = await prisma.user.updateManyAndReturn({ + * select: { id: true }, + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + updateManyAndReturn(args: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "updateManyAndReturn", GlobalOmitOptions>> + + /** + * Create or update one User. + * @param {UserUpsertArgs} args - Arguments to update or create a User. + * @example + * // Update or create a User + * const user = await prisma.user.upsert({ + * create: { + * // ... data to create a User + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the User we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__UserClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of Users. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {UserCountArgs} args - Arguments to filter Users to count. + * @example + * // Count the number of Users + * const count = await prisma.user.count({ + * where: { + * // ... the filter for the Users 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 User. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {UserAggregateArgs} 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 User. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {UserGroupByArgs} 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 UserGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: UserGroupByArgs['orderBy'] } + : { orderBy?: UserGroupByArgs['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 ? GetUserGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the User model + */ +readonly fields: UserFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for User. + * 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__UserClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + /** + * 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 User model + */ +export interface UserFieldRefs { + readonly id: Prisma.FieldRef<"User", 'String'> + readonly firstName: Prisma.FieldRef<"User", 'String'> + readonly middleName: Prisma.FieldRef<"User", 'String'> + readonly lastName: Prisma.FieldRef<"User", 'String'> + readonly email: Prisma.FieldRef<"User", 'String'> + readonly password: Prisma.FieldRef<"User", 'String'> + readonly role: Prisma.FieldRef<"User", 'USER_ROLE'> + readonly isVerified: Prisma.FieldRef<"User", 'Boolean'> + readonly refreshToken: Prisma.FieldRef<"User", 'String'> + readonly profilePicture: Prisma.FieldRef<"User", 'String'> + readonly isDeleted: Prisma.FieldRef<"User", 'Boolean'> + readonly deletedAt: Prisma.FieldRef<"User", 'DateTime'> + readonly createdAt: Prisma.FieldRef<"User", 'DateTime'> + readonly updatedAt: Prisma.FieldRef<"User", 'DateTime'> +} + + +// Custom InputTypes +/** + * User findUnique + */ +export type UserFindUniqueArgs = { + /** + * Select specific fields to fetch from the User + */ + select?: Prisma.UserSelect | null + /** + * Omit specific fields from the User + */ + omit?: Prisma.UserOmit | null + /** + * Filter, which User to fetch. + */ + where: Prisma.UserWhereUniqueInput +} + +/** + * User findUniqueOrThrow + */ +export type UserFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the User + */ + select?: Prisma.UserSelect | null + /** + * Omit specific fields from the User + */ + omit?: Prisma.UserOmit | null + /** + * Filter, which User to fetch. + */ + where: Prisma.UserWhereUniqueInput +} + +/** + * User findFirst + */ +export type UserFindFirstArgs = { + /** + * Select specific fields to fetch from the User + */ + select?: Prisma.UserSelect | null + /** + * Omit specific fields from the User + */ + omit?: Prisma.UserOmit | null + /** + * Filter, which User to fetch. + */ + where?: Prisma.UserWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Users to fetch. + */ + orderBy?: Prisma.UserOrderByWithRelationInput | Prisma.UserOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for Users. + */ + cursor?: Prisma.UserWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Users 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` Users. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of Users. + */ + distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[] +} + +/** + * User findFirstOrThrow + */ +export type UserFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the User + */ + select?: Prisma.UserSelect | null + /** + * Omit specific fields from the User + */ + omit?: Prisma.UserOmit | null + /** + * Filter, which User to fetch. + */ + where?: Prisma.UserWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Users to fetch. + */ + orderBy?: Prisma.UserOrderByWithRelationInput | Prisma.UserOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for Users. + */ + cursor?: Prisma.UserWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Users 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` Users. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of Users. + */ + distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[] +} + +/** + * User findMany + */ +export type UserFindManyArgs = { + /** + * Select specific fields to fetch from the User + */ + select?: Prisma.UserSelect | null + /** + * Omit specific fields from the User + */ + omit?: Prisma.UserOmit | null + /** + * Filter, which Users to fetch. + */ + where?: Prisma.UserWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of Users to fetch. + */ + orderBy?: Prisma.UserOrderByWithRelationInput | Prisma.UserOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing Users. + */ + cursor?: Prisma.UserWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` Users 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` Users. + */ + skip?: number + distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[] +} + +/** + * User create + */ +export type UserCreateArgs = { + /** + * Select specific fields to fetch from the User + */ + select?: Prisma.UserSelect | null + /** + * Omit specific fields from the User + */ + omit?: Prisma.UserOmit | null + /** + * The data needed to create a User. + */ + data: Prisma.XOR +} + +/** + * User createMany + */ +export type UserCreateManyArgs = { + /** + * The data used to create many Users. + */ + data: Prisma.UserCreateManyInput | Prisma.UserCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * User createManyAndReturn + */ +export type UserCreateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the User + */ + select?: Prisma.UserSelectCreateManyAndReturn | null + /** + * Omit specific fields from the User + */ + omit?: Prisma.UserOmit | null + /** + * The data used to create many Users. + */ + data: Prisma.UserCreateManyInput | Prisma.UserCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * User update + */ +export type UserUpdateArgs = { + /** + * Select specific fields to fetch from the User + */ + select?: Prisma.UserSelect | null + /** + * Omit specific fields from the User + */ + omit?: Prisma.UserOmit | null + /** + * The data needed to update a User. + */ + data: Prisma.XOR + /** + * Choose, which User to update. + */ + where: Prisma.UserWhereUniqueInput +} + +/** + * User updateMany + */ +export type UserUpdateManyArgs = { + /** + * The data used to update Users. + */ + data: Prisma.XOR + /** + * Filter which Users to update + */ + where?: Prisma.UserWhereInput + /** + * Limit how many Users to update. + */ + limit?: number +} + +/** + * User updateManyAndReturn + */ +export type UserUpdateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the User + */ + select?: Prisma.UserSelectUpdateManyAndReturn | null + /** + * Omit specific fields from the User + */ + omit?: Prisma.UserOmit | null + /** + * The data used to update Users. + */ + data: Prisma.XOR + /** + * Filter which Users to update + */ + where?: Prisma.UserWhereInput + /** + * Limit how many Users to update. + */ + limit?: number +} + +/** + * User upsert + */ +export type UserUpsertArgs = { + /** + * Select specific fields to fetch from the User + */ + select?: Prisma.UserSelect | null + /** + * Omit specific fields from the User + */ + omit?: Prisma.UserOmit | null + /** + * The filter to search for the User to update in case it exists. + */ + where: Prisma.UserWhereUniqueInput + /** + * In case the User found by the `where` argument doesn't exist, create a new User with this data. + */ + create: Prisma.XOR + /** + * In case the User was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * User delete + */ +export type UserDeleteArgs = { + /** + * Select specific fields to fetch from the User + */ + select?: Prisma.UserSelect | null + /** + * Omit specific fields from the User + */ + omit?: Prisma.UserOmit | null + /** + * Filter which User to delete. + */ + where: Prisma.UserWhereUniqueInput +} + +/** + * User deleteMany + */ +export type UserDeleteManyArgs = { + /** + * Filter which Users to delete + */ + where?: Prisma.UserWhereInput + /** + * Limit how many Users to delete. + */ + limit?: number +} + +/** + * User without action + */ +export type UserDefaultArgs = { + /** + * Select specific fields to fetch from the User + */ + select?: Prisma.UserSelect | null + /** + * Omit specific fields from the User + */ + omit?: Prisma.UserOmit | null +} diff --git a/prisma/migrations/20260210153746_model_for_user_org_and_join/migration.sql b/prisma/migrations/20260210153746_model_for_user_org_and_join/migration.sql new file mode 100644 index 0000000..9fb4bdf --- /dev/null +++ b/prisma/migrations/20260210153746_model_for_user_org_and_join/migration.sql @@ -0,0 +1,65 @@ +-- CreateEnum +CREATE TYPE "ORGANIZATION_JOIN_REQUEST" AS ENUM ('PENDING', 'ACCEPTED', 'REJECTED'); + +-- CreateEnum +CREATE TYPE "ORG_ROLE" AS ENUM ('admin', 'user'); + +-- CreateEnum +CREATE TYPE "USER_ROLE" AS ENUM ('superadmin', 'ordinary'); + +-- CreateTable +CREATE TABLE "organization_join_request" ( + "userId" TEXT NOT NULL, + "orgId" TEXT NOT NULL, + "status" "ORGANIZATION_JOIN_REQUEST" NOT NULL DEFAULT 'PENDING', + "requestedOn" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "rejectReason" TEXT +); + +-- CreateTable +CREATE TABLE "organization_user_join" ( + "userId" TEXT NOT NULL, + "orgId" TEXT NOT NULL, + "role" "ORG_ROLE" NOT NULL DEFAULT 'user', + "joinedDate" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +-- CreateTable +CREATE TABLE "organization" ( + "id" TEXT NOT NULL, + "name" TEXT NOT NULL, + "description" TEXT, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "organization_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "user" ( + "id" TEXT NOT NULL, + "firstName" TEXT NOT NULL, + "middleName" TEXT, + "lastName" TEXT NOT NULL, + "email" TEXT NOT NULL, + "password" TEXT NOT NULL, + "role" "USER_ROLE" NOT NULL DEFAULT 'ordinary', + "isVerified" BOOLEAN DEFAULT false, + "refreshToken" TEXT, + "profilePicture" TEXT, + "isDeleted" BOOLEAN DEFAULT false, + "deletedAt" TIMESTAMP(3), + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + + CONSTRAINT "user_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "organization_join_request_userId_orgId_key" ON "organization_join_request"("userId", "orgId"); + +-- CreateIndex +CREATE UNIQUE INDEX "organization_user_join_userId_orgId_key" ON "organization_user_join"("userId", "orgId"); + +-- CreateIndex +CREATE UNIQUE INDEX "user_email_key" ON "user"("email"); diff --git a/prisma/migrations/migration_lock.toml b/prisma/migrations/migration_lock.toml new file mode 100644 index 0000000..044d57c --- /dev/null +++ b/prisma/migrations/migration_lock.toml @@ -0,0 +1,3 @@ +# Please do not edit this file manually +# It should be added in your version-control system (e.g., Git) +provider = "postgresql" diff --git a/prisma/models/organization-join-request.prisma b/prisma/models/organization-join-request.prisma new file mode 100644 index 0000000..473d025 --- /dev/null +++ b/prisma/models/organization-join-request.prisma @@ -0,0 +1,16 @@ +model OrganizationJoinRequest { + userId String + orgId String + status ORGANIZATION_JOIN_REQUEST @default(PENDING) + requestedOn DateTime @default(now()) + rejectReason String? + + @@unique([userId, orgId]) + @@map("organization_join_request") +} + +enum ORGANIZATION_JOIN_REQUEST { + PENDING + ACCEPTED + REJECTED +} diff --git a/prisma/models/organization-user-join.prisma b/prisma/models/organization-user-join.prisma new file mode 100644 index 0000000..6d2b919 --- /dev/null +++ b/prisma/models/organization-user-join.prisma @@ -0,0 +1,14 @@ +model OrganizationUserJoinTable { + userId String + orgId String + role ORG_ROLE @default(user) + joinedDate DateTime @default(now()) + + @@unique([userId, orgId]) + @@map("organization_user_join") +} + +enum ORG_ROLE { + admin + user +} diff --git a/prisma/models/organization.prisma b/prisma/models/organization.prisma new file mode 100644 index 0000000..6428ca9 --- /dev/null +++ b/prisma/models/organization.prisma @@ -0,0 +1,10 @@ +model Organization { + id String @id @default(uuid()) + name String + description String? + + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + @@map("organization") +} diff --git a/prisma/models/user.prisma b/prisma/models/user.prisma new file mode 100644 index 0000000..e9f8a0a --- /dev/null +++ b/prisma/models/user.prisma @@ -0,0 +1,24 @@ +model User { + id String @id @default(uuid()) + firstName String + middleName String? + lastName String + email String @unique + password String + role USER_ROLE @default(ordinary) + isVerified Boolean? @default(false) // TODO: Email using queue + refreshToken String? + profilePicture String? + isDeleted Boolean? @default(false) + deletedAt DateTime? + + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + @@map("user") +} + +enum USER_ROLE { + superadmin + ordinary +} diff --git a/src/auth/auth.module.ts b/src/auth/auth.module.ts index 27faccb..9a1b40a 100644 --- a/src/auth/auth.module.ts +++ b/src/auth/auth.module.ts @@ -1,9 +1,17 @@ import { Module } from '@nestjs/common'; import { AuthService } from './auth.service'; import { AuthController } from './auth.controller'; +import { APP_GUARD } from '@nestjs/core'; +import { AuthGuard } from './guards/auth.guard'; @Module({ - providers: [AuthService], - controllers: [AuthController] + providers: [ + AuthService, + { + provide: APP_GUARD, + useClass: AuthGuard, + }, + ], + controllers: [AuthController], }) export class AuthModule {} diff --git a/src/auth/auth.service.ts b/src/auth/auth.service.ts index a41c649..7a2bad1 100644 --- a/src/auth/auth.service.ts +++ b/src/auth/auth.service.ts @@ -1,4 +1,13 @@ import { Injectable } from '@nestjs/common'; +import { Public } from './decorators'; @Injectable() -export class AuthService {} +@Public() +export class AuthService { + async login() {} + + async signup() {} + + @Public(false) + async logout() {} +} diff --git a/src/auth/decorators/index.ts b/src/auth/decorators/index.ts new file mode 100644 index 0000000..ca7ce96 --- /dev/null +++ b/src/auth/decorators/index.ts @@ -0,0 +1,2 @@ +export * from './public.decorator'; +export * from './role.decorator'; diff --git a/src/auth/decorators/public.decorator.ts b/src/auth/decorators/public.decorator.ts new file mode 100644 index 0000000..a47ef22 --- /dev/null +++ b/src/auth/decorators/public.decorator.ts @@ -0,0 +1,5 @@ +import { SetMetadata } from '@nestjs/common'; +import { PUBLIC_KEY } from 'common/keys'; + +export const Public = (isPublic?: boolean) => + SetMetadata(PUBLIC_KEY, isPublic ?? true); diff --git a/src/auth/decorators/role.decorator.ts b/src/auth/decorators/role.decorator.ts new file mode 100644 index 0000000..f0c0b2c --- /dev/null +++ b/src/auth/decorators/role.decorator.ts @@ -0,0 +1,4 @@ +import { SetMetadata } from '@nestjs/common'; +import { ROLE_KEY } from 'common/keys'; + +export const Roles = (role: string) => SetMetadata(ROLE_KEY, role); diff --git a/src/auth/dto/index.ts b/src/auth/dto/index.ts new file mode 100644 index 0000000..dbdf61a --- /dev/null +++ b/src/auth/dto/index.ts @@ -0,0 +1 @@ +export * from './register-user.dto'; diff --git a/src/auth/dto/register-user.dto.ts b/src/auth/dto/register-user.dto.ts new file mode 100644 index 0000000..aee295b --- /dev/null +++ b/src/auth/dto/register-user.dto.ts @@ -0,0 +1,57 @@ +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { + IsEmail, + IsNotEmpty, + IsOptional, + IsString, + MinLength, +} from 'class-validator'; + +export class RegisterUserRequestDTO { + @ApiProperty({ + description: "User's firstName", + example: 'John', + type: 'string', + }) + @IsString() + @IsNotEmpty() + firstName: string; + + @ApiPropertyOptional({ + description: "User's middleName", + example: 'Kumar', + type: 'string', + }) + @IsString() + @IsOptional() + middleName?: string; + + @ApiProperty({ + description: "User's lastName", + example: 'Doe', + type: 'string', + }) + @IsString() + @IsNotEmpty() + lastName: string; + + @ApiProperty({ + description: "User's email", + example: 'user@example.com', + type: 'string', + }) + @IsEmail() + @IsNotEmpty() + email: string; + + @ApiProperty({ + description: "User's password", + example: '123456', + type: 'string', + minLength: 6, + }) + @IsString() + @IsNotEmpty() + @MinLength(6) + password: string; +} diff --git a/src/auth/guards/auth.guard.ts b/src/auth/guards/auth.guard.ts new file mode 100644 index 0000000..8727f0a --- /dev/null +++ b/src/auth/guards/auth.guard.ts @@ -0,0 +1,46 @@ +import { + CanActivate, + ExecutionContext, + UnauthorizedException, +} from '@nestjs/common'; +import { RequestContextService } from 'core/als/request-context.service'; +import { JwtService } from '@nestjs/jwt'; +import { JwtPayload } from '../types'; +import { Request } from 'express'; +import { Reflector } from '@nestjs/core'; +import { PUBLIC_KEY } from 'common/keys'; + +export class AuthGuard implements CanActivate { + constructor( + private readonly jwtService: JwtService, + private readonly requestContext: RequestContextService, + private readonly reflector: Reflector, + ) {} + + async canActivate(context: ExecutionContext) { + const request = context.switchToHttp().getRequest(); + + const isPublicRoute = this.reflector.getAllAndOverride( + PUBLIC_KEY, + [context.getHandler(), context.getClass()], + ); + if (isPublicRoute) return true; + + const token = this.extractTokenFromHeader(request); + if (!token) throw new UnauthorizedException(); + + try { + const payload: JwtPayload = await this.jwtService.verifyAsync(token); + this.requestContext.set('user', payload); + + return true; + } catch (err) { + throw new UnauthorizedException(); + } + } + + private extractTokenFromHeader(request: Request): string | undefined { + const [type, token] = request.headers.authorization?.split(' ') ?? []; + return type === 'Bearer' ? token : undefined; + } +} diff --git a/src/auth/guards/index.ts b/src/auth/guards/index.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/auth/guards/rbac.guard.ts b/src/auth/guards/rbac.guard.ts new file mode 100644 index 0000000..5b9be30 --- /dev/null +++ b/src/auth/guards/rbac.guard.ts @@ -0,0 +1,26 @@ +import { + CanActivate, + ExecutionContext, + UnauthorizedException, +} from '@nestjs/common'; +import { Reflector } from '@nestjs/core'; +import { ROLE_KEY } from 'common/keys'; +import { RequestContextService } from 'core/als/request-context.service'; + +export class RbacGuard implements CanActivate { + constructor( + private readonly reflector: Reflector, + private readonly requestContext: RequestContextService, + ) {} + canActivate(context: ExecutionContext) { + const requiredRole = this.reflector.getAllAndOverride(ROLE_KEY, [ + context.getHandler(), + context.getClass(), + ]); + + const user = this.requestContext.user; + if (!user) throw new UnauthorizedException(); + + return user.role === requiredRole; + } +} diff --git a/src/auth/types/index.ts b/src/auth/types/index.ts index 511b15a..684e2e5 100644 --- a/src/auth/types/index.ts +++ b/src/auth/types/index.ts @@ -1 +1,2 @@ export * from './jwt'; +export * from './role'; diff --git a/src/auth/types/jwt.ts b/src/auth/types/jwt.ts index b98eb88..31e5137 100644 --- a/src/auth/types/jwt.ts +++ b/src/auth/types/jwt.ts @@ -1,26 +1,11 @@ -export interface UserPayload { +import { UserRoleType } from './role'; + +export interface JwtPayload { iat?: number; exp?: number; + orgId?: string; userId: string; email: string; - role: 'user'; + role: UserRoleType; + permission?: string[]; } - -// For restaurant owners, also resId -export interface StaffPayload { - iat?: number; - exp?: number; - userId: string; - email: string; - role: 'staff'; -} - -export interface AdminPayload { - iat?: number; - exp?: number; - userId: string; - email: string; - role: 'admin'; -} - -export type AuthPayload = UserPayload | StaffPayload | AdminPayload; diff --git a/src/auth/types/role.ts b/src/auth/types/role.ts new file mode 100644 index 0000000..f58f3b1 --- /dev/null +++ b/src/auth/types/role.ts @@ -0,0 +1 @@ +export type UserRoleType = 'user' | 'admin'; diff --git a/src/user/dtos/index.ts b/src/user/dtos/index.ts new file mode 100644 index 0000000..04e381d --- /dev/null +++ b/src/user/dtos/index.ts @@ -0,0 +1 @@ +export * from './user.dto'; diff --git a/src/user/dtos/user.dto.ts b/src/user/dtos/user.dto.ts new file mode 100644 index 0000000..cf6b33d --- /dev/null +++ b/src/user/dtos/user.dto.ts @@ -0,0 +1,21 @@ +import { User } from 'prisma/generated/prisma/client'; + +export class UserDTO { + readonly id: string; + readonly email: string; + readonly firstName: string; + readonly middleName: string | null; + readonly lastName: string; + readonly role: string; + readonly profilePicture: string | null; + + constructor(user: User) { + this.id = user.id; + this.email = user.email; + this.firstName = user.firstName; + this.lastName = user.lastName; + this.middleName = user.middleName; + this.role = user.role; + this.profilePicture = user.profilePicture; + } +} diff --git a/src/user/user.module.ts b/src/user/user.module.ts index f8082cd..06908c2 100644 --- a/src/user/user.module.ts +++ b/src/user/user.module.ts @@ -1,7 +1,9 @@ import { Module } from '@nestjs/common'; import { UserService } from './user.service'; +import { PrismaModule } from 'src/prisma/prisma.module'; @Module({ - providers: [UserService] + providers: [UserService], + imports: [PrismaModule], }) export class UserModule {} diff --git a/src/user/user.service.ts b/src/user/user.service.ts index 668a7d6..26b5062 100644 --- a/src/user/user.service.ts +++ b/src/user/user.service.ts @@ -1,4 +1,37 @@ -import { Injectable } from '@nestjs/common'; +import { ConflictException, Injectable } from '@nestjs/common'; +import { Prisma } from 'prisma/generated/prisma/client'; +import { RegisterUserRequestDTO } from 'src/auth/dto'; +import { PrismaService } from 'src/prisma/prisma.service'; @Injectable() -export class UserService {} +export class UserService { + constructor(private readonly prisma: PrismaService) {} + + async createUserWithPassword(dto: RegisterUserRequestDTO) { + try { + return await this.prisma.user.create({ + data: dto, + }); + } catch (err) { + if (err instanceof Prisma.PrismaClientKnownRequestError) { + if (err.code === 'P2002') { + throw new ConflictException('User already exists'); + } + } else throw err; + } + } + + async findUserForAuth(email: string) { + return await this.prisma.user.findUnique({ + where: { email }, + omit: { password: false }, // Password is omitted by default, we are just reverting it + }); + } + + async updateRefreshToken(id: string, refreshToken: string) { + return await this.prisma.user.update({ + where: { id }, + data: { refreshToken }, + }); + } +}