Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • LLD-changes
  • db-changes
  • develop-beta
  • drAPIChanges
  • feature/create-doctors
  • feature/doctor-master-seed-data
  • feature/missing-models-columns
  • feature/uuid-removal-db-changes
  • feature/uuid-v7-changes
  • fetch-api-4.3
  • hotFixHospitalSearch
  • hotFixHospitalTestCases
  • hotfix-create-doctor-api-qualification-chnages
  • hotfix-create-doctor-updated-lld
  • hotfix/HCP-26-create-doctor-testcase-fix
  • hotfix/city-state-id-addition
  • hotfix/doc-registration-city-state-id-fix
  • hotfixDoctorsApi
  • master
  • new-lld-change
  • revert-19d45991
  • revert-48d0d502
  • seedFileChanges
  • seedFileHotFix
  • updateDRAPI
25 results

Target

Select target project
No results found
Select Git revision
  • LLD-changes
  • db-changes
  • develop-beta
  • drAPIChanges
  • feature/create-doctors
  • feature/doctor-master-seed-data
  • feature/missing-models-columns
  • feature/uuid-removal-db-changes
  • feature/uuid-v7-changes
  • fetch-api-4.3
  • hotFixHospitalSearch
  • hotFixHospitalTestCases
  • hotfix-create-doctor-api-qualification-chnages
  • hotfix-create-doctor-updated-lld
  • hotfix/HCP-26-create-doctor-testcase-fix
  • hotfix/city-state-id-addition
  • hotfix/doc-registration-city-state-id-fix
  • hotfixDoctorsApi
  • master
  • new-lld-change
  • revert-19d45991
  • revert-48d0d502
  • seedFileChanges
  • seedFileHotFix
  • updateDRAPI
25 results
Show changes

Commits on Source 4

57 files
+ 1843
643
Compare changes
  • Side-by-side
  • Inline

Files

+3 −0
Original line number Diff line number Diff line
@@ -54,3 +54,6 @@ pids

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json


/prisma/migrations
 No newline at end of file
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ export default [

      // Max lines per function
      'max-lines-per-function': ['error', {
        max: 50,
        max: 100,
        skipBlankLines: true,
        skipComments: true
      }],
+118 −80
Original line number Diff line number Diff line
@@ -5769,9 +5769,9 @@
      "license": "MIT"
    },
    "node_modules/@types/node": {
      "version": "22.15.21",
      "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.21.tgz",
      "integrity": "sha512-EV/37Td6c+MgKAbkcLG6vqZ2zEYHD7bvSrzqqs2RIhbA6w3x+Dqz8MZM3sP6kGTeLrdoOgKZe+Xja7tUB2DNkQ==",
      "version": "22.15.23",
      "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.23.tgz",
      "integrity": "sha512-7Ec1zaFPF4RJ0eXu1YT/xgiebqwqoJz8rYPDi/O2BcZ++Wpt0Kq9cl0eg6NN6bYbPnR67ZLo7St5Q3UK0SnARw==",
      "license": "MIT",
      "dependencies": {
        "undici-types": "~6.21.0"
@@ -5961,17 +5961,17 @@
      "license": "MIT"
    },
    "node_modules/@typescript-eslint/eslint-plugin": {
      "version": "8.32.1",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.32.1.tgz",
      "integrity": "sha512-6u6Plg9nP/J1GRpe/vcjjabo6Uc5YQPAMxsgQyGC/I0RuukiG1wIe3+Vtg3IrSCVJDmqK3j8adrtzXSENRtFgg==",
      "version": "8.33.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.33.0.tgz",
      "integrity": "sha512-CACyQuqSHt7ma3Ns601xykeBK/rDeZa3w6IS6UtMQbixO5DWy+8TilKkviGDH6jtWCo8FGRKEK5cLLkPvEammQ==",
      "dev": true,
      "license": "MIT",
      "dependencies": {
        "@eslint-community/regexpp": "^4.10.0",
        "@typescript-eslint/scope-manager": "8.32.1",
        "@typescript-eslint/type-utils": "8.32.1",
        "@typescript-eslint/utils": "8.32.1",
        "@typescript-eslint/visitor-keys": "8.32.1",
        "@typescript-eslint/scope-manager": "8.33.0",
        "@typescript-eslint/type-utils": "8.33.0",
        "@typescript-eslint/utils": "8.33.0",
        "@typescript-eslint/visitor-keys": "8.33.0",
        "graphemer": "^1.4.0",
        "ignore": "^7.0.0",
        "natural-compare": "^1.4.0",
@@ -5985,7 +5985,7 @@
        "url": "https://opencollective.com/typescript-eslint"
      },
      "peerDependencies": {
        "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0",
        "@typescript-eslint/parser": "^8.33.0",
        "eslint": "^8.57.0 || ^9.0.0",
        "typescript": ">=4.8.4 <5.9.0"
      }
@@ -6001,16 +6001,16 @@
      }
    },
    "node_modules/@typescript-eslint/parser": {
      "version": "8.32.1",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.32.1.tgz",
      "integrity": "sha512-LKMrmwCPoLhM45Z00O1ulb6jwyVr2kr3XJp+G+tSEZcbauNnScewcQwtJqXDhXeYPDEjZ8C1SjXm015CirEmGg==",
      "version": "8.33.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.33.0.tgz",
      "integrity": "sha512-JaehZvf6m0yqYp34+RVnihBAChkqeH+tqqhS0GuX1qgPpwLvmTPheKEs6OeCK6hVJgXZHJ2vbjnC9j119auStQ==",
      "dev": true,
      "license": "MIT",
      "dependencies": {
        "@typescript-eslint/scope-manager": "8.32.1",
        "@typescript-eslint/types": "8.32.1",
        "@typescript-eslint/typescript-estree": "8.32.1",
        "@typescript-eslint/visitor-keys": "8.32.1",
        "@typescript-eslint/scope-manager": "8.33.0",
        "@typescript-eslint/types": "8.33.0",
        "@typescript-eslint/typescript-estree": "8.33.0",
        "@typescript-eslint/visitor-keys": "8.33.0",
        "debug": "^4.3.4"
      },
      "engines": {
@@ -6025,15 +6025,34 @@
        "typescript": ">=4.8.4 <5.9.0"
      }
    },
    "node_modules/@typescript-eslint/project-service": {
      "version": "8.33.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.33.0.tgz",
      "integrity": "sha512-d1hz0u9l6N+u/gcrk6s6gYdl7/+pp8yHheRTqP6X5hVDKALEaTn8WfGiit7G511yueBEL3OpOEpD+3/MBdoN+A==",
      "dev": true,
      "license": "MIT",
      "dependencies": {
        "@typescript-eslint/tsconfig-utils": "^8.33.0",
        "@typescript-eslint/types": "^8.33.0",
        "debug": "^4.3.4"
      },
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
      },
      "funding": {
        "type": "opencollective",
        "url": "https://opencollective.com/typescript-eslint"
      }
    },
    "node_modules/@typescript-eslint/scope-manager": {
      "version": "8.32.1",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.32.1.tgz",
      "integrity": "sha512-7IsIaIDeZn7kffk7qXC3o6Z4UblZJKV3UBpkvRNpr5NSyLji7tvTcvmnMNYuYLyh26mN8W723xpo3i4MlD33vA==",
      "version": "8.33.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.33.0.tgz",
      "integrity": "sha512-LMi/oqrzpqxyO72ltP+dBSP6V0xiUb4saY7WLtxSfiNEBI8m321LLVFU9/QDJxjDQG9/tjSqKz/E3380TEqSTw==",
      "dev": true,
      "license": "MIT",
      "dependencies": {
        "@typescript-eslint/types": "8.32.1",
        "@typescript-eslint/visitor-keys": "8.32.1"
        "@typescript-eslint/types": "8.33.0",
        "@typescript-eslint/visitor-keys": "8.33.0"
      },
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -6043,15 +6062,32 @@
        "url": "https://opencollective.com/typescript-eslint"
      }
    },
    "node_modules/@typescript-eslint/tsconfig-utils": {
      "version": "8.33.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.33.0.tgz",
      "integrity": "sha512-sTkETlbqhEoiFmGr1gsdq5HyVbSOF0145SYDJ/EQmXHtKViCaGvnyLqWFFHtEXoS0J1yU8Wyou2UGmgW88fEug==",
      "dev": true,
      "license": "MIT",
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
      },
      "funding": {
        "type": "opencollective",
        "url": "https://opencollective.com/typescript-eslint"
      },
      "peerDependencies": {
        "typescript": ">=4.8.4 <5.9.0"
      }
    },
    "node_modules/@typescript-eslint/type-utils": {
      "version": "8.32.1",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.32.1.tgz",
      "integrity": "sha512-mv9YpQGA8iIsl5KyUPi+FGLm7+bA4fgXaeRcFKRDRwDMu4iwrSHeDPipwueNXhdIIZltwCJv+NkxftECbIZWfA==",
      "version": "8.33.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.33.0.tgz",
      "integrity": "sha512-lScnHNCBqL1QayuSrWeqAL5GmqNdVUQAAMTaCwdYEdWfIrSrOGzyLGRCHXcCixa5NK6i5l0AfSO2oBSjCjf4XQ==",
      "dev": true,
      "license": "MIT",
      "dependencies": {
        "@typescript-eslint/typescript-estree": "8.32.1",
        "@typescript-eslint/utils": "8.32.1",
        "@typescript-eslint/typescript-estree": "8.33.0",
        "@typescript-eslint/utils": "8.33.0",
        "debug": "^4.3.4",
        "ts-api-utils": "^2.1.0"
      },
@@ -6068,9 +6104,9 @@
      }
    },
    "node_modules/@typescript-eslint/types": {
      "version": "8.32.1",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.32.1.tgz",
      "integrity": "sha512-YmybwXUJcgGqgAp6bEsgpPXEg6dcCyPyCSr0CAAueacR/CCBi25G3V8gGQ2kRzQRBNol7VQknxMs9HvVa9Rvfg==",
      "version": "8.33.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.33.0.tgz",
      "integrity": "sha512-DKuXOKpM5IDT1FA2g9x9x1Ug81YuKrzf4mYX8FAVSNu5Wo/LELHWQyM1pQaDkI42bX15PWl0vNPt1uGiIFUOpg==",
      "dev": true,
      "license": "MIT",
      "engines": {
@@ -6082,14 +6118,16 @@
      }
    },
    "node_modules/@typescript-eslint/typescript-estree": {
      "version": "8.32.1",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.32.1.tgz",
      "integrity": "sha512-Y3AP9EIfYwBb4kWGb+simvPaqQoT5oJuzzj9m0i6FCY6SPvlomY2Ei4UEMm7+FXtlNJbor80ximyslzaQF6xhg==",
      "version": "8.33.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.33.0.tgz",
      "integrity": "sha512-vegY4FQoB6jL97Tu/lWRsAiUUp8qJTqzAmENH2k59SJhw0Th1oszb9Idq/FyyONLuNqT1OADJPXfyUNOR8SzAQ==",
      "dev": true,
      "license": "MIT",
      "dependencies": {
        "@typescript-eslint/types": "8.32.1",
        "@typescript-eslint/visitor-keys": "8.32.1",
        "@typescript-eslint/project-service": "8.33.0",
        "@typescript-eslint/tsconfig-utils": "8.33.0",
        "@typescript-eslint/types": "8.33.0",
        "@typescript-eslint/visitor-keys": "8.33.0",
        "debug": "^4.3.4",
        "fast-glob": "^3.3.2",
        "is-glob": "^4.0.3",
@@ -6135,16 +6173,16 @@
      }
    },
    "node_modules/@typescript-eslint/utils": {
      "version": "8.32.1",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.32.1.tgz",
      "integrity": "sha512-DsSFNIgLSrc89gpq1LJB7Hm1YpuhK086DRDJSNrewcGvYloWW1vZLHBTIvarKZDcAORIy/uWNx8Gad+4oMpkSA==",
      "version": "8.33.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.33.0.tgz",
      "integrity": "sha512-lPFuQaLA9aSNa7D5u2EpRiqdAUhzShwGg/nhpBlc4GR6kcTABttCuyjFs8BcEZ8VWrjCBof/bePhP3Q3fS+Yrw==",
      "dev": true,
      "license": "MIT",
      "dependencies": {
        "@eslint-community/eslint-utils": "^4.7.0",
        "@typescript-eslint/scope-manager": "8.32.1",
        "@typescript-eslint/types": "8.32.1",
        "@typescript-eslint/typescript-estree": "8.32.1"
        "@typescript-eslint/scope-manager": "8.33.0",
        "@typescript-eslint/types": "8.33.0",
        "@typescript-eslint/typescript-estree": "8.33.0"
      },
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -6159,13 +6197,13 @@
      }
    },
    "node_modules/@typescript-eslint/visitor-keys": {
      "version": "8.32.1",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.32.1.tgz",
      "integrity": "sha512-ar0tjQfObzhSaW3C3QNmTc5ofj0hDoNQ5XWrCy6zDyabdr0TWhCkClp+rywGNj/odAFBVzzJrK4tEq5M4Hmu4w==",
      "version": "8.33.0",
      "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.33.0.tgz",
      "integrity": "sha512-7RW7CMYoskiz5OOGAWjJFxgb7c5UNjTG292gYhWeOAcFmYCtVCSqjqSBj5zMhxbXo2JOW95YYrUWJfU0zrpaGQ==",
      "dev": true,
      "license": "MIT",
      "dependencies": {
        "@typescript-eslint/types": "8.32.1",
        "@typescript-eslint/types": "8.33.0",
        "eslint-visitor-keys": "^4.2.0"
      },
      "engines": {
@@ -8893,9 +8931,9 @@
      }
    },
    "node_modules/electron-to-chromium": {
      "version": "1.5.158",
      "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.158.tgz",
      "integrity": "sha512-9vcp2xHhkvraY6AHw2WMi+GDSLPX42qe2xjYaVoZqFRJiOcilVQFq9mZmpuHEQpzlgGDelKlV7ZiGcmMsc8WxQ==",
      "version": "1.5.159",
      "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.159.tgz",
      "integrity": "sha512-CEvHptWAMV5p6GJ0Lq8aheyvVbfzVrv5mmidu1D3pidoVNkB3tTBsTMVtPJ+rzRK5oV229mCLz9Zj/hNvU8GBA==",
      "dev": true,
      "license": "ISC"
    },
@@ -10113,9 +10151,9 @@
      }
    },
    "node_modules/gaxios": {
      "version": "7.0.0-rc.4",
      "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-7.0.0-rc.4.tgz",
      "integrity": "sha512-fwQMwbs3o8Odl/nc/rkQJwyHeOXdderOwmybUl0gkyTdZXMK1oSTWj4Em7gSogVJsRWDeHPXLY06+e8Rkr01iw==",
      "version": "7.0.0-rc.5",
      "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-7.0.0-rc.5.tgz",
      "integrity": "sha512-s9rlpplwdb/KCq2DYevVTM/MpozeVZuR3pkzDGXtRhY7wD4fXftIYXUAerX07ZPB3J8/dHUJsX7fPnN2O4Psuw==",
      "license": "Apache-2.0",
      "dependencies": {
        "extend": "^3.0.2",
@@ -12028,28 +12066,28 @@
      "license": "MIT"
    },
    "node_modules/lint-staged": {
      "version": "16.0.0",
      "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-16.0.0.tgz",
      "integrity": "sha512-sUCprePs6/rbx4vKC60Hez6X10HPkpDJaGcy3D1NdwR7g1RcNkWL8q9mJMreOqmHBTs+1sNFp+wOiX9fr+hoOQ==",
      "version": "16.1.0",
      "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-16.1.0.tgz",
      "integrity": "sha512-HkpQh69XHxgCjObjejBT3s2ILwNjFx8M3nw+tJ/ssBauDlIpkx2RpqWSi1fBgkXLSSXnbR3iEq1NkVtpvV+FLQ==",
      "dev": true,
      "license": "MIT",
      "dependencies": {
        "chalk": "^5.4.1",
        "commander": "^13.1.0",
        "debug": "^4.4.0",
        "commander": "^14.0.0",
        "debug": "^4.4.1",
        "lilconfig": "^3.1.3",
        "listr2": "^8.3.3",
        "micromatch": "^4.0.8",
        "nano-spawn": "^1.0.0",
        "nano-spawn": "^1.0.2",
        "pidtree": "^0.6.0",
        "string-argv": "^0.3.2",
        "yaml": "^2.7.1"
        "yaml": "^2.8.0"
      },
      "bin": {
        "lint-staged": "bin/lint-staged.js"
      },
      "engines": {
        "node": ">=20.18"
        "node": ">=20.17"
      },
      "funding": {
        "url": "https://opencollective.com/lint-staged"
@@ -12069,13 +12107,13 @@
      }
    },
    "node_modules/lint-staged/node_modules/commander": {
      "version": "13.1.0",
      "resolved": "https://registry.npmjs.org/commander/-/commander-13.1.0.tgz",
      "integrity": "sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==",
      "version": "14.0.0",
      "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.0.tgz",
      "integrity": "sha512-2uM9rYjPvyq39NwLRqaiLtWHyDC1FvryJDa2ATTVims5YAS4PupsEQsDvP14FqhFr0P49CYDugi59xaxJlTXRA==",
      "dev": true,
      "license": "MIT",
      "engines": {
        "node": ">=18"
        "node": ">=20"
      }
    },
    "node_modules/listr2": {
@@ -12851,7 +12889,7 @@
    },
    "node_modules/nest-common-utilities": {
      "version": "1.0.0",
      "resolved": "git+ssh://git@gitlab.niveussolutions.com/roshan.suvarnkar/hdfc-common-utility.git#02a8194475907c2bcdf870595a9eb783cd19e10d",
      "resolved": "git+ssh://git@gitlab.niveussolutions.com/roshan.suvarnkar/hdfc-common-utility.git#e1b68321251b98d36736cd15c71860fda26886b0",
      "license": "MIT",
      "dependencies": {
        "@google-cloud/pubsub": "^5.0.0",
@@ -15339,9 +15377,9 @@
      }
    },
    "node_modules/terser": {
      "version": "5.39.2",
      "resolved": "https://registry.npmjs.org/terser/-/terser-5.39.2.tgz",
      "integrity": "sha512-yEPUmWve+VA78bI71BW70Dh0TuV4HHd+I5SHOAfS1+QBOmvmCiiffgjR8ryyEd3KIfvPGFqoADt8LdQ6XpXIvg==",
      "version": "5.40.0",
      "resolved": "https://registry.npmjs.org/terser/-/terser-5.40.0.tgz",
      "integrity": "sha512-cfeKl/jjwSR5ar7d0FGmave9hFGJT8obyo0z+CrQOylLDbk7X81nPU6vq9VORa5jU30SkDnT2FXjLbR8HLP+xA==",
      "dev": true,
      "license": "BSD-2-Clause",
      "dependencies": {
@@ -15895,15 +15933,15 @@
      }
    },
    "node_modules/typescript-eslint": {
      "version": "8.32.1",
      "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.32.1.tgz",
      "integrity": "sha512-D7el+eaDHAmXvrZBy1zpzSNIRqnCOrkwTgZxTu3MUqRWk8k0q9m9Ho4+vPf7iHtgUfrK/o8IZaEApsxPlHTFCg==",
      "version": "8.33.0",
      "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.33.0.tgz",
      "integrity": "sha512-5YmNhF24ylCsvdNW2oJwMzTbaeO4bg90KeGtMjUw0AGtHksgEPLRTUil+coHwCfiu4QjVJFnjp94DmU6zV7DhQ==",
      "dev": true,
      "license": "MIT",
      "dependencies": {
        "@typescript-eslint/eslint-plugin": "8.32.1",
        "@typescript-eslint/parser": "8.32.1",
        "@typescript-eslint/utils": "8.32.1"
        "@typescript-eslint/eslint-plugin": "8.33.0",
        "@typescript-eslint/parser": "8.33.0",
        "@typescript-eslint/utils": "8.33.0"
      },
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -16094,9 +16132,9 @@
      }
    },
    "node_modules/validator": {
      "version": "13.15.0",
      "resolved": "https://registry.npmjs.org/validator/-/validator-13.15.0.tgz",
      "integrity": "sha512-36B2ryl4+oL5QxZ3AzD0t5SsMNGvTtQHpjgFO5tbNxfXbMFkY822ktCDe1MnlqV3301QQI9SLHDNJokDI+Z9pA==",
      "version": "13.15.15",
      "resolved": "https://registry.npmjs.org/validator/-/validator-13.15.15.tgz",
      "integrity": "sha512-BgWVbCI72aIQy937xbawcs+hrVaN/CZ2UwutgaJ36hGqRrLNM+f5LUT/YPRbo8IV/ASeFzXszezV+y2+rq3l8A==",
      "license": "MIT",
      "engines": {
        "node": ">= 0.10"
@@ -16628,9 +16666,9 @@
      }
    },
    "node_modules/zod": {
      "version": "3.25.30",
      "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.30.tgz",
      "integrity": "sha512-VolhdEtu6TJr/fzGuHA/SZ5ixvXqA6ADOG9VRcQ3rdOKmF5hkmcJbyaQjUH5BgmpA9gej++zYRX7zjSmdReIwA==",
      "version": "3.25.32",
      "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.32.tgz",
      "integrity": "sha512-OSm2xTIRfW8CV5/QKgngwmQW/8aPfGdaQFlrGoErlgg/Epm7cjb6K6VEyExfe65a3VybUOnu381edLb0dfJl0g==",
      "license": "MIT",
      "funding": {
        "url": "https://github.com/sponsors/colinhacks"
Original line number Diff line number Diff line
-- CreateEnum
CREATE TYPE "hospital_status" AS ENUM ('ACTIVE', 'SUSPENDED', 'BLOCKED');

-- CreateEnum
CREATE TYPE "account_mode" AS ENUM ('ECS', 'CHEQUE');

-- CreateEnum
CREATE TYPE "account_type" AS ENUM ('SAVINGS', 'CURRENT');

-- CreateEnum
CREATE TYPE "TariffLevel" AS ENUM ('CATEGORY', 'SUBCATEGORY', 'PROPERTY', 'SUBPROPERTY');

-- CreateEnum
CREATE TYPE "Role" AS ENUM ('user', 'admin', 'moderator');

-- CreateTable
CREATE TABLE "city_master" (
    "id" UUID NOT NULL,
    "name" TEXT NOT NULL,
    "state_id" UUID NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "city_master_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hospital" (
    "id" UUID NOT NULL,
    "hospital_no" TEXT NOT NULL,
    "rohini_id" TEXT NOT NULL,
    "hfr_id" TEXT NOT NULL,
    "corporate_id" UUID NOT NULL,
    "name" TEXT NOT NULL,
    "propreitor_name" TEXT NOT NULL,
    "address" TEXT NOT NULL,
    "locality" TEXT NOT NULL,
    "city_id" UUID NOT NULL,
    "state_id" UUID NOT NULL,
    "district_id" TEXT NOT NULL,
    "region_id" UUID NOT NULL,
    "pincode" TEXT NOT NULL,
    "email_id" TEXT NOT NULL,
    "bed_count" INTEGER NOT NULL,
    "pan_no_hash" TEXT NOT NULL,
    "tan_no_hash" TEXT NOT NULL,
    "contact_hash" TEXT NOT NULL,
    "website" TEXT NOT NULL,
    "is_hospital_registered" BOOLEAN NOT NULL,
    "registration_no" TEXT NOT NULL,
    "registration_authority" TEXT NOT NULL,
    "registered_from" TIMESTAMP(3) NOT NULL,
    "registered_till" TIMESTAMP(3) NOT NULL,
    "latitude" DECIMAL(9,6) NOT NULL,
    "longitude" DECIMAL(9,6) NOT NULL,
    "type_id" UUID NOT NULL,
    "level_care_id" UUID NOT NULL,
    "is_epd_enabled" BOOLEAN NOT NULL,
    "epd_discount" DECIMAL(5,2) NOT NULL,
    "epd_tat" INTEGER NOT NULL,
    "epd_effective_from" TIMESTAMP(3) NOT NULL,
    "epd_effective_till" TIMESTAMP(3) NOT NULL,
    "is_non_network" BOOLEAN NOT NULL,
    "status" "hospital_status" NOT NULL,
    "fraud_remark_id" UUID NOT NULL,
    "remarks" TEXT NOT NULL,
    "created_by" UUID NOT NULL,
    "updated_by" UUID NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "hospital_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hospital_accommodations" (
    "id" UUID NOT NULL,
    "hospital_id" UUID NOT NULL,
    "room_category_id" UUID NOT NULL,
    "bed_count" INTEGER NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "is_active" BOOLEAN NOT NULL,

    CONSTRAINT "hospital_accommodations_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hospital_bank_details" (
    "id" UUID NOT NULL,
    "hospital_id" UUID NOT NULL,
    "name" TEXT NOT NULL,
    "address" TEXT NOT NULL,
    "locality" TEXT NOT NULL,
    "state_id" UUID NOT NULL,
    "city_id" UUID NOT NULL,
    "district_id" TEXT NOT NULL,
    "pan_no_hash" TEXT NOT NULL,
    "tan_no_hash" TEXT NOT NULL,
    "account_type" "account_type" NOT NULL,
    "account_no_hash" TEXT NOT NULL,
    "ifsc_code" TEXT NOT NULL,
    "micr_code" TEXT NOT NULL,
    "branch_name" TEXT NOT NULL,
    "bank_name" TEXT NOT NULL,
    "payment_preference" "account_mode" NOT NULL,
    "effective_from" TIMESTAMP(3) NOT NULL,
    "effective_till" TIMESTAMP(3) NOT NULL,
    "is_active" BOOLEAN NOT NULL,
    "created_by" UUID NOT NULL,
    "updated_by" UUID NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "hospital_bank_details_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hospital_care_master" (
    "id" UUID NOT NULL,
    "name" TEXT NOT NULL,
    "is_active" BOOLEAN NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "hospital_care_master_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hospital_contact_persons" (
    "id" UUID NOT NULL,
    "hospital_id" UUID NOT NULL,
    "name" TEXT NOT NULL,
    "designation" TEXT NOT NULL,
    "mobile" TEXT NOT NULL,
    "email_id" TEXT NOT NULL,
    "created_by" UUID NOT NULL,
    "updated_by" UUID NOT NULL,
    "is_active" BOOLEAN NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "hospital_contact_persons_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hospital_corporate" (
    "id" UUID NOT NULL,
    "name" TEXT NOT NULL,
    "address" TEXT NOT NULL,
    "locality" TEXT NOT NULL,
    "state_id" UUID NOT NULL,
    "city_id" UUID NOT NULL,
    "district_id" TEXT NOT NULL,
    "region_id" UUID NOT NULL,
    "pincode" TEXT NOT NULL,
    "email_id" TEXT NOT NULL,
    "website" TEXT NOT NULL,
    "contact_hash" TEXT NOT NULL,
    "latitude" DECIMAL(9,6) NOT NULL,
    "longitude" DECIMAL(9,6) NOT NULL,
    "contact_no" TEXT NOT NULL,
    "created_by" UUID NOT NULL,
    "updated_by" UUID NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "hospital_corporate_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hospital_discount_master" (
    "id" UUID NOT NULL,
    "name" TEXT NOT NULL,
    "is_active" BOOLEAN NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "hospital_discount_master_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hospital_discounts" (
    "id" UUID NOT NULL,
    "hospital_id" UUID NOT NULL,
    "discount_id" UUID NOT NULL,
    "discount" DECIMAL(5,2) NOT NULL,
    "effective_from" TIMESTAMP(3) NOT NULL,
    "effective_till" TIMESTAMP(3) NOT NULL,
    "created_by" UUID NOT NULL,
    "updated_by" UUID NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "hospital_discounts_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hospital_fraud_remarks_master" (
    "id" UUID NOT NULL,
    "name" TEXT NOT NULL,
    "is_active" BOOLEAN NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "hospital_fraud_remarks_master_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hospital_room_categories" (
    "id" UUID NOT NULL,
    "name" TEXT NOT NULL,
    "room_id" UUID NOT NULL,
    "is_active" BOOLEAN NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "hospital_room_categories_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hospital_room_types" (
    "id" UUID NOT NULL,
    "name" TEXT NOT NULL,
    "is_active" BOOLEAN NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "hospital_room_types_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hospital_specialities" (
    "id" UUID NOT NULL,
    "hospital_id" UUID NOT NULL,
    "speciality_id" UUID NOT NULL,
    "is_active" BOOLEAN NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "hospital_specialities_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hospital_specialty_master" (
    "id" UUID NOT NULL,
    "name" TEXT NOT NULL,
    "is_active" BOOLEAN NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "hospital_specialty_master_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hospital_tariff_master" (
    "id" UUID NOT NULL,
    "name" TEXT NOT NULL,
    "parent_id" UUID,
    "level" "TariffLevel" NOT NULL,
    "is_active" BOOLEAN NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "hospital_tariff_master_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hospital_tariff_type_master" (
    "id" UUID NOT NULL,
    "name" TEXT NOT NULL,
    "is_active" BOOLEAN NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "hospital_tariff_type_master_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hospital_tariffs" (
    "id" UUID NOT NULL,
    "hospital_id" UUID NOT NULL,
    "tariff_id" UUID NOT NULL,
    "tariff_category_id" UUID NOT NULL,
    "tariff_sub_category_id" UUID NOT NULL,
    "tariff_property_id" UUID NOT NULL,
    "tariff_sub_property_id" UUID NOT NULL,
    "tariff_type_id" UUID NOT NULL,
    "effective_from" TIMESTAMP(3) NOT NULL,
    "effective_till" TIMESTAMP(3) NOT NULL,
    "created_by" UUID NOT NULL,
    "updated_by" UUID NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "hospital_tariffs_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hospital_type_master" (
    "id" UUID NOT NULL,
    "name" TEXT NOT NULL,
    "is_active" BOOLEAN NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "hospital_type_master_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "hospital_zone_master" (
    "id" UUID NOT NULL,
    "name" TEXT NOT NULL,
    "is_active" BOOLEAN NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "hospital_zone_master_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "state_master" (
    "id" UUID NOT NULL,
    "name" TEXT NOT NULL,
    "abbv" TEXT NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "state_master_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "user" (
    "id" UUID NOT NULL,
    "name" TEXT NOT NULL,
    "email" TEXT NOT NULL,
    "hashemail" TEXT NOT NULL,
    "password" TEXT NOT NULL,
    "role" "Role" NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,

    CONSTRAINT "user_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "hospital_hospital_no_key" ON "hospital"("hospital_no");

-- CreateIndex
CREATE UNIQUE INDEX "hospital_rohini_id_key" ON "hospital"("rohini_id");

-- CreateIndex
CREATE UNIQUE INDEX "hospital_hfr_id_key" ON "hospital"("hfr_id");

-- CreateIndex
CREATE UNIQUE INDEX "user_email_key" ON "user"("email");

-- AddForeignKey
ALTER TABLE "city_master" ADD CONSTRAINT "city_master_state_id_fkey" FOREIGN KEY ("state_id") REFERENCES "state_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital" ADD CONSTRAINT "hospital_city_id_fkey" FOREIGN KEY ("city_id") REFERENCES "city_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital" ADD CONSTRAINT "hospital_corporate_id_fkey" FOREIGN KEY ("corporate_id") REFERENCES "hospital_corporate"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital" ADD CONSTRAINT "hospital_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital" ADD CONSTRAINT "hospital_fraud_remark_id_fkey" FOREIGN KEY ("fraud_remark_id") REFERENCES "hospital_fraud_remarks_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital" ADD CONSTRAINT "hospital_level_care_id_fkey" FOREIGN KEY ("level_care_id") REFERENCES "hospital_care_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital" ADD CONSTRAINT "hospital_region_id_fkey" FOREIGN KEY ("region_id") REFERENCES "hospital_zone_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital" ADD CONSTRAINT "hospital_state_id_fkey" FOREIGN KEY ("state_id") REFERENCES "state_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital" ADD CONSTRAINT "hospital_type_id_fkey" FOREIGN KEY ("type_id") REFERENCES "hospital_type_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital" ADD CONSTRAINT "hospital_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_accommodations" ADD CONSTRAINT "hospital_accommodations_hospital_id_fkey" FOREIGN KEY ("hospital_id") REFERENCES "hospital"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_accommodations" ADD CONSTRAINT "hospital_accommodations_room_category_id_fkey" FOREIGN KEY ("room_category_id") REFERENCES "hospital_room_categories"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_bank_details" ADD CONSTRAINT "hospital_bank_details_city_id_fkey" FOREIGN KEY ("city_id") REFERENCES "city_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_bank_details" ADD CONSTRAINT "hospital_bank_details_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_bank_details" ADD CONSTRAINT "hospital_bank_details_hospital_id_fkey" FOREIGN KEY ("hospital_id") REFERENCES "hospital"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_bank_details" ADD CONSTRAINT "hospital_bank_details_state_id_fkey" FOREIGN KEY ("state_id") REFERENCES "state_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_bank_details" ADD CONSTRAINT "hospital_bank_details_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_contact_persons" ADD CONSTRAINT "hospital_contact_persons_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_contact_persons" ADD CONSTRAINT "hospital_contact_persons_hospital_id_fkey" FOREIGN KEY ("hospital_id") REFERENCES "hospital"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_contact_persons" ADD CONSTRAINT "hospital_contact_persons_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_corporate" ADD CONSTRAINT "hospital_corporate_city_id_fkey" FOREIGN KEY ("city_id") REFERENCES "city_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_corporate" ADD CONSTRAINT "hospital_corporate_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_corporate" ADD CONSTRAINT "hospital_corporate_region_id_fkey" FOREIGN KEY ("region_id") REFERENCES "hospital_zone_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_corporate" ADD CONSTRAINT "hospital_corporate_state_id_fkey" FOREIGN KEY ("state_id") REFERENCES "state_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_corporate" ADD CONSTRAINT "hospital_corporate_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_discounts" ADD CONSTRAINT "hospital_discounts_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_discounts" ADD CONSTRAINT "hospital_discounts_discount_id_fkey" FOREIGN KEY ("discount_id") REFERENCES "hospital_discount_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_discounts" ADD CONSTRAINT "hospital_discounts_hospital_id_fkey" FOREIGN KEY ("hospital_id") REFERENCES "hospital"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_discounts" ADD CONSTRAINT "hospital_discounts_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_room_categories" ADD CONSTRAINT "hospital_room_categories_room_id_fkey" FOREIGN KEY ("room_id") REFERENCES "hospital_room_types"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_specialities" ADD CONSTRAINT "hospital_specialities_hospital_id_fkey" FOREIGN KEY ("hospital_id") REFERENCES "hospital"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_specialities" ADD CONSTRAINT "hospital_specialities_speciality_id_fkey" FOREIGN KEY ("speciality_id") REFERENCES "hospital_specialty_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_tariff_master" ADD CONSTRAINT "hospital_tariff_master_parent_id_fkey" FOREIGN KEY ("parent_id") REFERENCES "hospital_tariff_master"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_tariffs" ADD CONSTRAINT "hospital_tariffs_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_tariffs" ADD CONSTRAINT "hospital_tariffs_hospital_id_fkey" FOREIGN KEY ("hospital_id") REFERENCES "hospital"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_tariffs" ADD CONSTRAINT "hospital_tariffs_tariff_category_id_fkey" FOREIGN KEY ("tariff_category_id") REFERENCES "hospital_tariff_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_tariffs" ADD CONSTRAINT "hospital_tariffs_tariff_id_fkey" FOREIGN KEY ("tariff_id") REFERENCES "hospital_tariff_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_tariffs" ADD CONSTRAINT "hospital_tariffs_tariff_property_id_fkey" FOREIGN KEY ("tariff_property_id") REFERENCES "hospital_tariff_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_tariffs" ADD CONSTRAINT "hospital_tariffs_tariff_sub_category_id_fkey" FOREIGN KEY ("tariff_sub_category_id") REFERENCES "hospital_tariff_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_tariffs" ADD CONSTRAINT "hospital_tariffs_tariff_sub_property_id_fkey" FOREIGN KEY ("tariff_sub_property_id") REFERENCES "hospital_tariff_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_tariffs" ADD CONSTRAINT "hospital_tariffs_tariff_type_id_fkey" FOREIGN KEY ("tariff_type_id") REFERENCES "hospital_tariff_type_master"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "hospital_tariffs" ADD CONSTRAINT "hospital_tariffs_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
Original line number Diff line number Diff line
model city_master {
  id                    String                  @id @db.Uuid
  id                    String                  @id @default(uuid()) @db.Uuid
  name                  String
  state_id              String                  @db.Uuid
  created_at            DateTime                @default(now())
  updated_at            DateTime
  updated_at            DateTime                @updatedAt
  hospital              hospital[]
  hospital_bank_details hospital_bank_details[]
  hospital_corporate    hospital_corporate[]
  pincode_master        pincode_master[]
  state                 state_master       @relation(fields: [state_id], references: [id])
}
 No newline at end of file
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ enum hospital_status {
}

model hospital {
  id                             String                        @id @db.Uuid
  id                             String                        @id @default(uuid()) @db.Uuid
  hospital_no                    String                        @unique
  rohini_id                      String                        @unique
  hfr_id                         String                        @unique
@@ -18,7 +18,7 @@ model hospital {
  state_id                       String                        @db.Uuid
  district_id                    String
  region_id                      String                        @db.Uuid
  pincode                        String
  pincode_id                     String                        @db.Uuid
  email_id                       String
  bed_count                      Int
  pan_no_hash                    String
@@ -46,8 +46,9 @@ model hospital {
  created_by                     String                        @db.Uuid
  updated_by                     String                        @db.Uuid
  created_at                     DateTime                      @default(now())
  updated_at                     DateTime
  updated_at                     DateTime                      @updatedAt
  city_master                    city_master                   @relation(fields: [city_id], references: [id])
  pincode_master                 pincode_master                @relation(fields: [pincode_id], references: [id])
  hospital_corporate             hospital_corporate            @relation(fields: [corporate_id], references: [id])
  user_hospital_created_byTouser user                          @relation("hospital_created_byTouser", fields: [created_by], references: [id])
  hospital_fraud_remarks_master  hospital_fraud_remarks_master @relation(fields: [fraud_remark_id], references: [id])
Original line number Diff line number Diff line
model hospital_accommodations {
  id                       String                   @id @db.Uuid
  id                       String                   @id @default(uuid()) @db.Uuid
  hospital_id              String                   @db.Uuid
  room_category_id         String                   @db.Uuid
  bed_count                Int
  created_at               DateTime                 @default(now())
  updated_at               DateTime
  updated_at               DateTime                 @updatedAt
  is_active                Boolean
  hospital                 hospital                 @relation(fields: [hospital_id], references: [id])
  hospital_room_categories hospital_room_categories @relation(fields: [room_category_id], references: [id])
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ enum account_type {
}

model hospital_bank_details {
  id                                          String       @id @db.Uuid
  id                                          String       @id @default(uuid()) @db.Uuid
  hospital_id                                 String       @db.Uuid
  name                                        String
  address                                     String
@@ -17,6 +17,7 @@ model hospital_bank_details {
  state_id                                    String       @db.Uuid
  city_id                                     String       @db.Uuid
  district_id                                 String
  pincode_id                                  String       @db.Uuid
  pan_no_hash                                 String
  tan_no_hash                                 String
  account_type                                account_type
@@ -32,8 +33,9 @@ model hospital_bank_details {
  created_by                                  String       @db.Uuid
  updated_by                                  String       @db.Uuid
  created_at                                  DateTime     @default(now())
  updated_at                                  DateTime
  updated_at                                  DateTime     @updatedAt
  city_master                                 city_master  @relation(fields: [city_id], references: [id])
  pincode_master                              pincode_master    @relation(fields: [pincode_id], references: [id])
  user_hospital_bank_details_created_byTouser user         @relation("hospital_bank_details_created_byTouser", fields: [created_by], references: [id])
  hospital                                    hospital     @relation(fields: [hospital_id], references: [id])
  state_master                                state_master @relation(fields: [state_id], references: [id])
Original line number Diff line number Diff line
model hospital_care_master {
  id         String     @id @db.Uuid
  id         String     @id @default(uuid()) @db.Uuid
  name       String
  is_active  Boolean
  created_at DateTime   @default(now())
  updated_at DateTime
  updated_at DateTime   @updatedAt
  hospital   hospital[]
}
 No newline at end of file
Original line number Diff line number Diff line
model hospital_contact_persons {
  id                                             String   @id @db.Uuid
  id                                             String   @id @default(uuid()) @db.Uuid
  hospital_id                                    String   @db.Uuid
  name                                           String
  designation                                    String
@@ -9,7 +9,7 @@ model hospital_contact_persons {
  updated_by                                     String   @db.Uuid
  is_active                                      Boolean
  created_at                                     DateTime @default(now())
  updated_at                                     DateTime
  updated_at                                     DateTime @updatedAt
  user_hospital_contact_persons_created_byTouser user     @relation("hospital_contact_persons_created_byTouser", fields: [created_by], references: [id])
  hospital                                       hospital @relation(fields: [hospital_id], references: [id])
  user_hospital_contact_persons_updated_byTouser user     @relation("hospital_contact_persons_updated_byTouser", fields: [updated_by], references: [id])
Original line number Diff line number Diff line
model hospital_corporate {
  id                                       String               @id @db.Uuid
  id                                       String               @id @default(uuid()) @db.Uuid
  name                                     String
  address                                  String 
  locality                                 String
@@ -7,7 +7,7 @@ model hospital_corporate {
  city_id                                  String               @db.Uuid
  district_id                              String
  region_id                                String               @db.Uuid
  pincode                                  String
  pincode_id                               String               @db.Uuid
  email_id                                 String
  website                                  String
  contact_hash                             String
@@ -17,9 +17,10 @@ model hospital_corporate {
  created_by                               String               @db.Uuid
  updated_by                               String               @db.Uuid
  created_at                               DateTime             @default(now())
  updated_at                               DateTime
  updated_at                               DateTime             @updatedAt
  hospital                                 hospital[] 
  city_master                              city_master          @relation(fields: [city_id], references: [id])
  pincode_master                           pincode_master       @relation(fields: [pincode_id], references: [id])
  user_hospital_corporate_created_byTouser user                 @relation("hospital_corporate_created_byTouser", fields: [created_by], references: [id])
  hospital_zone_master                     hospital_zone_master @relation(fields: [region_id], references: [id])
  state_master                             state_master         @relation(fields: [state_id], references: [id])
Original line number Diff line number Diff line
model hospital_discount_master {
  id                 String               @id @db.Uuid
  id                 String               @id @default(uuid()) @db.Uuid
  name               String
  is_active          Boolean
  created_at         DateTime             @default(now())
  updated_at         DateTime
  updated_at         DateTime             @updatedAt
  hospital_discounts hospital_discounts[]
}
 No newline at end of file
Original line number Diff line number Diff line
model hospital_discounts {
  id                                       String                   @id @db.Uuid
  id                                       String                   @id @default(uuid()) @db.Uuid
  hospital_id                              String                   @db.Uuid
  discount_id                              String                   @db.Uuid
  discount                                 Decimal                  @db.Decimal(5, 2)
@@ -7,8 +7,8 @@ model hospital_discounts {
  effective_till                           DateTime
  created_by                               String                   @db.Uuid
  updated_by                               String                   @db.Uuid
  created_at                               DateTime
  updated_at                               DateTime
  created_at                               DateTime                 @default(now())
  updated_at                               DateTime                 @updatedAt
  user_hospital_discounts_created_byTouser user                     @relation("hospital_discounts_created_byTouser", fields: [created_by], references: [id])
  hospital_discount_master                 hospital_discount_master @relation(fields: [discount_id], references: [id])
  hospital                                 hospital                 @relation(fields: [hospital_id], references: [id])
Original line number Diff line number Diff line
model hospital_fraud_remarks_master {
  id         String     @id @db.Uuid
  id         String     @id @default(uuid()) @db.Uuid
  name       String
  is_active  Boolean
  created_at DateTime   @default(now())
  updated_at DateTime
  updated_at DateTime   @updatedAt
  hospital   hospital[]
}
 No newline at end of file
Original line number Diff line number Diff line
model hospital_room_categories {
  id                      String                    @id @db.Uuid
  id                      String                    @id @default(uuid()) @db.Uuid
  name                    String
  room_id                 String                    @db.Uuid
  is_active               Boolean
  created_at              DateTime                  @default(now())
  updated_at              DateTime
  updated_at              DateTime                  @updatedAt
  hospital_accommodations hospital_accommodations[]
  hospital_room_types     hospital_room_types       @relation(fields: [room_id], references: [id])
}
 No newline at end of file
Original line number Diff line number Diff line
model hospital_room_types {
  id                       String                     @id @db.Uuid
  id                       String                     @id @default(uuid()) @db.Uuid
  name                     String
  is_active                Boolean
  created_at               DateTime                   @default(now())
  updated_at               DateTime
  updated_at               DateTime                   @updatedAt
  hospital_room_categories hospital_room_categories[]
}
 No newline at end of file
Original line number Diff line number Diff line
model hospital_specialities {
  id                        String                    @id @db.Uuid
  id                        String                    @id @default(uuid()) @db.Uuid
  hospital_id               String                    @db.Uuid
  speciality_id             String                    @db.Uuid
  is_active                 Boolean
  created_at                DateTime                  @default(now())
  updated_at                DateTime
  updated_at                DateTime                  @updatedAt
  hospital                  hospital                  @relation(fields: [hospital_id], references: [id])
  hospital_specialty_master hospital_specialty_master @relation(fields: [speciality_id], references: [id])
  hospital_speciality_master hospital_speciality_master @relation(fields: [speciality_id], references: [id])
}
 No newline at end of file
Original line number Diff line number Diff line
model hospital_specialty_master {
  id                    String                  @id @db.Uuid
model hospital_speciality_master {
  id                    String                  @id @default(uuid()) @db.Uuid
  name                  String
  is_active             Boolean
  created_at            DateTime                @default(now())
  updated_at            DateTime
  updated_at            DateTime                @updatedAt
  hospital_specialities hospital_specialities[]
}
 No newline at end of file
Original line number Diff line number Diff line
@@ -6,13 +6,13 @@ enum TariffLevel {
}

model hospital_tariff_master {
  id                                                                               String                   @id @db.Uuid
  id                                                                               String                   @id @default(uuid()) @db.Uuid
  name                                                                             String
  parent_id                                                                        String?                  @db.Uuid
  level                                                                            TariffLevel
  is_active                                                                        Boolean
  created_at                                                                       DateTime                 @default(now())
  updated_at                                                                       DateTime
  updated_at                                                                       DateTime                 @updatedAt
  hospital_tariff_master                                                           hospital_tariff_master?  @relation("hospital_tariff_masterTohospital_tariff_master", fields: [parent_id], references: [id])
  other_hospital_tariff_master                                                     hospital_tariff_master[] @relation("hospital_tariff_masterTohospital_tariff_master")
  hospital_tariffs_hospital_tariffs_tariff_category_idTohospital_tariff_master     hospital_tariffs[]       @relation("hospital_tariffs_tariff_category_idTohospital_tariff_master")
Original line number Diff line number Diff line
model hospital_tariff_type_master {
  id               String             @id @db.Uuid
  id               String             @id @default(uuid()) @db.Uuid
  name             String
  is_active        Boolean
  created_at       DateTime           @default(now())
  updated_at       DateTime
  updated_at       DateTime           @updatedAt
  hospital_tariffs hospital_tariffs[]
}
 No newline at end of file
Original line number Diff line number Diff line
model hospital_tariffs {
  id                                                                                     String                      @id @db.Uuid
  id                                                                                     String                      @id @default(uuid()) @db.Uuid
  hospital_id                                                                            String                      @db.Uuid
  tariff_id                                                                              String                      @db.Uuid
  tariff_category_id                                                                     String                      @db.Uuid
@@ -12,7 +12,7 @@ model hospital_tariffs {
  created_by                                                                             String                      @db.Uuid
  updated_by                                                                             String                      @db.Uuid
  created_at                                                                             DateTime                    @default(now())
  updated_at                                                                             DateTime
  updated_at                                                                             DateTime                    @updatedAt
  user_hospital_tariffs_created_byTouser                                                 user                        @relation("hospital_tariffs_created_byTouser", fields: [created_by], references: [id])
  hospital                                                                               hospital                    @relation(fields: [hospital_id], references: [id])
  hospital_tariff_master_hospital_tariffs_tariff_category_idTohospital_tariff_master     hospital_tariff_master      @relation("hospital_tariffs_tariff_category_idTohospital_tariff_master", fields: [tariff_category_id], references: [id])
Original line number Diff line number Diff line
model hospital_type_master {
  id         String     @id @db.Uuid
  id         String     @id @default(uuid()) @db.Uuid
  name       String
  is_active  Boolean
  created_at DateTime   @default(now())
  updated_at DateTime
  updated_at DateTime   @updatedAt
  hospital   hospital[]
}
 No newline at end of file
Original line number Diff line number Diff line
model hospital_zone_master {
  id                 String               @id @db.Uuid
  id                 String               @id @default(uuid()) @db.Uuid
  name               String
  is_active          Boolean
  created_at         DateTime             @default(now())
  updated_at         DateTime
  updated_at         DateTime             @updatedAt
  hospital           hospital[]
  hospital_corporate hospital_corporate[]
}
 No newline at end of file
+11 −0
Original line number Diff line number Diff line
model pincode_master {
  id                    String                  @id @default(uuid()) @db.Uuid
  name                  String
  city_id              String                   @db.Uuid
  created_at            DateTime                @default(now())
  updated_at            DateTime                @updatedAt
  hospital              hospital[]
  hospital_bank_details hospital_bank_details[]
  hospital_corporate    hospital_corporate[]
  city                  city_master             @relation(fields: [city_id], references: [id])
}
 No newline at end of file
Original line number Diff line number Diff line

model state_master {
  id                    String                  @id @db.Uuid
  id                    String                  @id @default(uuid()) @db.Uuid
  name                  String
  abbv                  String
  created_at            DateTime                @default(now())
  updated_at            DateTime
  updated_at            DateTime                @updatedAt
  hospital              hospital[]
  hospital_bank_details hospital_bank_details[]
  hospital_corporate    hospital_corporate[]
Original line number Diff line number Diff line
@@ -5,14 +5,14 @@ enum Role {
}

model user {
  id                                                                 String                     @id @db.Uuid
  id                                                                 String                     @id @default(uuid()) @db.Uuid
  name                                                               String
  email                                                              String                     @unique
  hashemail                                                          String
  password                                                           String
  role                                                               Role
  created_at                                                         DateTime                   @default(now())
  updated_at                                                         DateTime
  updated_at                                                         DateTime                   @updatedAt
  hospital_hospital_created_byTouser                                 hospital[]                 @relation("hospital_created_byTouser")
  hospital_hospital_updated_byTouser                                 hospital[]                 @relation("hospital_updated_byTouser")
  hospital_bank_details_hospital_bank_details_created_byTouser       hospital_bank_details[]    @relation("hospital_bank_details_created_byTouser")
Original line number Diff line number Diff line
@@ -14,6 +14,9 @@ import { ThrottlerModule, ThrottlerStorage } from '@nestjs/throttler';
import { GlobalThrottlerGuard, TraceIdInterceptor } from 'nest-common-utilities';
import { MicroserviceModule } from './microservices/microservice.module'
import { HospitalModule } from './hospital/hospital.module';
import { CityModule } from './city/city.module';
import { StateModule } from './state/state.module';
import { PincodeModule } from './pincode/pincode.module';


/**
@@ -27,6 +30,9 @@ import { HospitalModule } from './hospital/hospital.module';
    HealthCheckModule,
    MicroserviceModule,
    HospitalModule,
    CityModule,
    StateModule,
    PincodeModule,
  ],
  controllers: [AppController],
  providers: [
+97 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import { Test, TestingModule } from '@nestjs/testing';
import { CityController } from './city.controller';
import { CityService } from './city.service';
import { CreateCityDto } from './dto/create-city.dto';
import { UpdateCityRequestDto } from './dto/update-city.dto';
import { NotFoundException } from '@nestjs/common';
import { CityDto } from './dto/city.dto';

const mockCityService = {
  create: jest.fn(),
  findAll: jest.fn(),
  findOne: jest.fn(),
  update: jest.fn(),
  remove: jest.fn(),
};

const cityDto: CityDto = {
  id: 'uuid-1234',
  name: 'Bengaluru',
  state_id: 'state-1234',
  created_at: new Date(),
  updated_at: new Date(),
};

let controller: CityController;
let service: CityService;

describe('CityController', () => {
  beforeEach(async () => {
    const module: TestingModule = await Test.createTestingModule({
      controllers: [CityController],
      providers: [{ provide: CityService, useValue: mockCityService }],
    }).compile();

    controller = module.get<CityController>(CityController);
    service = module.get<CityService>(CityService);
  });

  it('should create a city', async () => {
    mockCityService.create.mockResolvedValue(cityDto);
    const createDto: CreateCityDto = { name: 'Bengaluru', state_id: 'state-1234' };
    const result = await controller.create(createDto);
    expect(result).toEqual(cityDto);
    expect(service.create).toHaveBeenCalledWith(createDto);
  });

  it('should return all cities', async () => {
    mockCityService.findAll.mockResolvedValue([cityDto]);
    const result = await controller.findAll();
    expect(result).toEqual([cityDto]);
    expect(service.findAll).toHaveBeenCalled();
  });

  it('should return a city by ID', async () => {
    mockCityService.findOne.mockResolvedValue(cityDto);
    const result = await controller.findOne({ id: 'uuid-1234' });
    expect(result).toEqual(cityDto);
    expect(service.findOne).toHaveBeenCalledWith('uuid-1234');
  });

  it('should throw NotFoundException when city not found (findOne)', async () => {
    mockCityService.findOne.mockResolvedValue(null);
    await expect(controller.findOne({ id: 'not-found-id' })).rejects.toThrow(NotFoundException);
  });

  it('should update a city', async () => {
    const updateDto: UpdateCityRequestDto = { id: 'uuid-1234', name: 'LA' };
    mockCityService.update.mockResolvedValue({ ...cityDto, name: 'LA' });
    const result = await controller.update(updateDto);
    expect(result.name).toBe('LA');
    expect(service.update).toHaveBeenCalledWith('uuid-1234', { name: 'LA' });
  });

  it('should throw NotFoundException when city not found (update)', async () => {
    mockCityService.update.mockResolvedValue(null);
    const updateDto: UpdateCityRequestDto = { id: 'not-found', name: 'LA' };
    await expect(controller.update(updateDto)).rejects.toThrow(NotFoundException);
  });

  it('should delete a city', async () => {
    mockCityService.remove.mockResolvedValue(cityDto);
    const result = await controller.remove({ id: 'uuid-1234' });
    expect(result).toEqual(cityDto);
    expect(service.remove).toHaveBeenCalledWith('uuid-1234');
  });

  it('should throw NotFoundException when city not found (remove)', async () => {
    mockCityService.remove.mockResolvedValue(null);
    await expect(controller.remove({ id: 'not-found' })).rejects.toThrow(NotFoundException);
  });
});
+126 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import {
    Controller,
    Post,
    Body,
    NotFoundException,
} from '@nestjs/common';
import { CityService } from './city.service';
import { CreateCityDto } from './dto/create-city.dto';
import { UpdateCityDto, UpdateCityRequestDto } from './dto/update-city.dto';
import { CityDto } from './dto/city.dto';
import {
    ApiTags,
    ApiOperation,
    ApiCreatedResponse,
    ApiOkResponse,
    ApiNotFoundResponse,
} from '@nestjs/swagger';

/**
 * DTO for operations requiring only an ID.
 */
class IdDto {
    id: string;
}
    
/**
 * Controller for handling city operations.
 */
@ApiTags('cities')
@Controller('cities')
export class CityController {
    /**
     * Initializes the controller with CityService.
     * @param cityService The service used for city operations.
     */
    constructor(private readonly cityService: CityService) { }

    /**
     * Creates a new city record in the system.
     *
     * @param createCityDto - The data required to create a city.
     * @returns The newly created city.
     */
    @Post('create')
    @ApiOperation({ summary: 'Create a new city' })
    @ApiCreatedResponse({ description: 'City created successfully', type: CityDto })
    async create(@Body() createCityDto: CreateCityDto): Promise<CityDto> {
        return this.cityService.create(createCityDto);
    }

    /**
     * Retrieves all cities from the database.
     *
     * @returns A list of all cities.
     */
    @Post('list')
    @ApiOperation({ summary: 'Get all cities' })
    @ApiOkResponse({ description: 'List of cities', type: [CityDto] })
    async findAll(): Promise<CityDto[]> {
        return this.cityService.findAll();
    }

    /**
     * Fetches a single city based on its ID.
     *
     * @param body - An object containing the ID of the city.
     * @returns The city matching the given ID.
     * @throws NotFoundException if no city is found with the provided ID.
     */
    @Post('get')
    @ApiOperation({ summary: 'Get a city by ID' })
    @ApiOkResponse({ description: 'City found', type: CityDto })
    @ApiNotFoundResponse({ description: 'City not found' })
    async findOne(@Body() body: IdDto): Promise<CityDto> {
        const city = await this.cityService.findOne(body.id);
        if (!city) {
            throw new NotFoundException('City not found');
        }
        return city;
    }

    /**
     * Updates a city's details based on the provided data.
     *
     * @param updateCityRequestDto - An object containing the city ID and updated values.
     * @returns The updated city record.
     * @throws NotFoundException if no city is found with the given ID.
     */
    @Post('update')
    @ApiOperation({ summary: 'Update a city' })
    @ApiOkResponse({ description: 'City updated successfully', type: CityDto })
    @ApiNotFoundResponse({ description: 'City not found' })
    async update(@Body() updateCityRequestDto: UpdateCityRequestDto): Promise<CityDto> {
        const { id, ...updateData } = updateCityRequestDto;
        const updatedCity = await this.cityService.update(id, updateData);
        if (!updatedCity) {
            throw new NotFoundException('City not found');
        }
        return updatedCity;
    }

    /**
     * Deletes a city record by its ID.
     *
     * @param body - An object containing the ID of the city to be deleted.
     * @returns The deleted city record.
     * @throws NotFoundException if no city is found with the provided ID.
     */
    @Post('delete')
    @ApiOperation({ summary: 'Delete a city' })
    @ApiOkResponse({ description: 'City deleted successfully', type: CityDto })
    @ApiNotFoundResponse({ description: 'City not found' })
    async remove(@Body() body: IdDto): Promise<CityDto> {
        const deletedCity = await this.cityService.remove(body.id);
        if (!deletedCity) {
            throw new NotFoundException('City not found');
        }
        return deletedCity;
    }
}
+20 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import { Module } from '@nestjs/common';
import { CityController } from './city.controller';
import { CityService } from './city.service';
import { PrismaModule } from '../prisma/prisma.module';

/**
 *
 */
@Module({
  imports: [PrismaModule],
  controllers: [CityController],
  providers: [CityService]
})
export class CityModule {}
+74 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import { Test, TestingModule } from '@nestjs/testing';
import { CityService } from './city.service';
import { PrismaService } from '../prisma/prisma.service';
import { CreateCityDto } from './dto/create-city.dto';
import { UpdateCityDto } from './dto/update-city.dto';
import { city_master } from '@prisma/client';

const mockCity: city_master = {
  id: 'city-id-123',
  name: 'Test City',
  state_id: 'state-id-123',
  created_at: new Date(),
  updated_at: new Date(),
};

describe('CityService', () => {
  let service: CityService;
  let prisma: PrismaService;

  const prismaMock = {
    city_master: {
      create: jest.fn().mockResolvedValue(mockCity),
      findMany: jest.fn().mockResolvedValue([mockCity]),
      findUnique: jest.fn().mockResolvedValue(mockCity),
      update: jest.fn().mockResolvedValue(mockCity),
      delete: jest.fn().mockResolvedValue(mockCity),
    },
  };

  beforeEach(async () => {
    const module: TestingModule = await Test.createTestingModule({
      providers: [CityService, { provide: PrismaService, useValue: prismaMock }],
    }).compile();

    service = module.get<CityService>(CityService);
    prisma = module.get<PrismaService>(PrismaService);
  });

  it('should create a city', async () => {
    const dto: CreateCityDto = { name: 'Test City', state_id: 'state-id-123' };
    await expect(service.create(dto)).resolves.toEqual(mockCity);
    expect(prisma.city_master.create).toHaveBeenCalledWith({ data: dto });
  });

  it('should return all cities', async () => {
    await expect(service.findAll()).resolves.toEqual([mockCity]);
    expect(prisma.city_master.findMany).toHaveBeenCalledWith({ include: { state: true } });
  });

  it('should find a city by ID', async () => {
    await expect(service.findOne('city-id-123')).resolves.toEqual(mockCity);
    expect(prisma.city_master.findUnique).toHaveBeenCalledWith({
      where: { id: 'city-id-123' },
      include: { state: true },
    });
  });

  it('should update a city', async () => {
    const updateDto: UpdateCityDto = { name: 'Updated City' };
    await expect(service.update('city-id-123', updateDto)).resolves.toEqual(mockCity);
    expect(prisma.city_master.update).toHaveBeenCalledWith({ where: { id: 'city-id-123' }, data: updateDto });
  });

  it('should delete a city', async () => {
    await expect(service.remove('city-id-123')).resolves.toEqual(mockCity);
    expect(prisma.city_master.delete).toHaveBeenCalledWith({ where: { id: 'city-id-123' } });
  });
});
 No newline at end of file
+76 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import { Injectable } from '@nestjs/common';
import { PrismaService } from '../prisma/prisma.service';
import { CreateCityDto } from './dto/create-city.dto';
import { UpdateCityDto } from './dto/update-city.dto';
import { city_master } from '@prisma/client';

/**
 * Service class for performing CRUD operations on city_master.
 */
@Injectable()
export class CityService {
  /**
   * Initializes the service with a Prisma client.
   * @param prisma The Prisma service for database operations.
   */
  constructor(private prisma: PrismaService) {}

  /**
   * Creates a new city entry in the database.
   * 
   * @param data - Data required to create a city.
   * @returns The newly created city record.
   */
  async create(data: CreateCityDto): Promise<city_master> {
    return this.prisma.city_master.create({ data });
  }

  /**
   * Retrieves all city records from the database.
   * 
   * @returns An array of city records.
   */
  async findAll(): Promise<city_master[]> {
    return this.prisma.city_master.findMany({ include: { state: true } });
  }

  /**
   * Retrieves a specific city by its ID.
   * 
   * @param id - The UUID of the city to retrieve.
   * @returns The city record if found, otherwise null.
   */
  async findOne(id: string): Promise<city_master | null> {
    return this.prisma.city_master.findUnique({
      where: { id },
      include: { state: true },
    });
  }

  /**
   * Updates an existing city record with new data.
   * 
   * @param id - The UUID of the city to update.
   * @param data - Partial city data to update.
   * @returns The updated city record.
   */
  async update(id: string, data: UpdateCityDto): Promise<city_master> {
    return this.prisma.city_master.update({ where: { id }, data });
  }

  /**
   * Deletes a city record by its ID.
   * 
   * @param id - The UUID of the city to delete.
   * @returns The deleted city record.
   */
  async remove(id: string): Promise<city_master> {
    return this.prisma.city_master.delete({ where: { id } });
  }
}
+27 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import { ApiProperty } from '@nestjs/swagger';

/**
 *
 */
export class CityDto {
    @ApiProperty({ example: 'a3f9c6a1-2f1d-4c37-9f77-e7a3b8aab3df' })
    id: string;

    @ApiProperty({ example: 'Bengaluru' })
    name: string;

    @ApiProperty({ example: '6f1eab12-3c7d-4a2d-91f4-0a9cdd158c62' })
    state_id: string;

    @ApiProperty({ example: '2025-05-28T12:34:56.789Z' })
    created_at: Date;

    @ApiProperty({ example: '2025-05-29T15:00:00.000Z', required: false, nullable: true })
    updated_at?: Date | null;
}
 No newline at end of file
+23 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import { IsUUID, IsString, IsNotEmpty } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

/**
 *
 */
export class CreateCityDto {
    @ApiProperty()
    @IsString()
    @IsNotEmpty({ message: 'City name is required' })
    name: string;

    @ApiProperty()
    @IsUUID()
    @IsNotEmpty({ message: 'State ID is required' })
    state_id: string;
}
+25 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import { PartialType, ApiProperty } from '@nestjs/swagger';
import { IsUUID, IsNotEmpty } from 'class-validator';
import { CreateCityDto } from './create-city.dto';

/**
 *
 */
export class UpdateCityDto extends PartialType(CreateCityDto) {}


/**
 *
 */
export class UpdateCityRequestDto extends PartialType(UpdateCityDto) {
    @ApiProperty()
    @IsUUID()
    @IsNotEmpty({ message: 'ID is required' })
    id: string;
}
 No newline at end of file
Original line number Diff line number Diff line
/**
 * @file        hospital.controller.ts
 * @description Handles HTTP requests related to hospital operations.
 * @author      <Your Name>
 * @created     <YYYY-MM-DD>
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/

import { Controller, HttpStatus, Post, HttpException } from '@nestjs/common';
Original line number Diff line number Diff line
/**
 * @file        hospital.service.ts
 * @description Service to handle hospital-related business logic including user fuzzy search operations.
 * @author      <Your Name>
 * @created     <YYYY-MM-DD>
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/

import { Injectable } from '@nestjs/common';
+7 −2
Original line number Diff line number Diff line
@@ -40,10 +40,13 @@ async function bootstrap(): Promise<void> {

  app.useGlobalPipes(
    new ValidationPipe({
      transform: true, whitelist: true, forbidNonWhitelisted: true,
      whitelist: true, // strip unknown fields
      forbidNonWhitelisted: true, // throw error on unknown fields
      transform: true, // auto-transform payloads to DTOs
    }),
  );


  // Security and CORS
  app.use(helmet());
  app.enableCors();
@@ -68,7 +71,9 @@ async function bootstrap(): Promise<void> {
  microservice.useGlobalInterceptors(new ResponseInterceptor());
  microservice.useGlobalPipes(
    new ValidationPipe({
      transform: true, whitelist: true, forbidNonWhitelisted: true,
      whitelist: true, // strip unknown fields
      forbidNonWhitelisted: true, // throw error on unknown fields
      transform: true, // auto-transform payloads to DTOs
    }),
  );

Original line number Diff line number Diff line
/**
 * @file        microservice.service.ts
 * @description Service for checking the availability of microservices using NestJS ClientProxy communication pattern.
 * @author      <Your Name>
 * @created     <YYYY-MM-DD>
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/

import { Injectable } from '@nestjs/common';
+23 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import { IsUUID, IsString, IsNotEmpty } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

/**
 *
 */
export class CreatePincodeDto {
    @ApiProperty()
    @IsString()
    @IsNotEmpty({ message: 'Pincode name is required' })
    name: string;

    @ApiProperty()
    @IsUUID()
    @IsNotEmpty({ message: 'City ID is required' })
    city_id: string;
}
+27 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import { ApiProperty } from '@nestjs/swagger';

/**
 *
 */
export class PincodeDto {
    @ApiProperty({ example: 'a3f9c6a1-2f1d-4c37-9f77-e7a3b8aab3df' })
    id: string;

    @ApiProperty({ example: '590001' })
    name: string;

    @ApiProperty({ example: '6f1eab12-3c7d-4a2d-91f4-0a9cdd158c62' })
    city_id: string;

    @ApiProperty({ example: '2025-05-28T12:34:56.789Z' })
    created_at: Date;

    @ApiProperty({ example: '2025-05-29T15:00:00.000Z', required: false, nullable: true })
    updated_at?: Date | null;
}
 No newline at end of file
+25 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import { PartialType, ApiProperty } from '@nestjs/swagger';
import { IsUUID, IsNotEmpty } from 'class-validator';
import { CreatePincodeDto } from './create-pincode.dto';

/**
 *
 */
export class UpdatePincodeDto extends PartialType(CreatePincodeDto) { }


/**
 *
 */
export class UpdatePincodeRequestDto extends PartialType(UpdatePincodeDto) {
    @ApiProperty()
    @IsUUID()
    @IsNotEmpty({ message: 'ID is required' })
    id: string;
}
 No newline at end of file
+123 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import { Test, TestingModule } from '@nestjs/testing';
import { PincodeController } from './pincode.controller';
import { PincodeService } from './pincode.service';
import { NotFoundException } from '@nestjs/common';

let controller: PincodeController;
let service: Record<keyof PincodeService, jest.Mock>;
describe('PincodeController', () => {

  beforeEach(async () => {
    service = {
      create: jest.fn(),
      findAll: jest.fn(),
      findOne: jest.fn(),
      update: jest.fn(),
      remove: jest.fn(),
    };

    const module: TestingModule = await Test.createTestingModule({
      controllers: [PincodeController],
      providers: [
        { provide: PincodeService, useValue: service },
      ],
    }).compile();

    controller = module.get<PincodeController>(PincodeController);
  });

  describe('create', () => {
    it('should create and return a pincode', async () => {
      const dto = { name: '12345', city_id: 'city-uuid' };
      const result = { id: 'uuid', ...dto };
      service.create.mockResolvedValue(result);

      expect(await controller.create(dto)).toEqual(result);
      expect(service.create).toHaveBeenCalledWith(dto);
    });

    it('should propagate errors thrown by service', async () => {
      const dto = { name: 'fail', city_id: 'fail-uuid' };
      service.create.mockRejectedValue(new Error('fail'));
      await expect(controller.create(dto)).rejects.toThrow('fail');
    });
  });

  describe('findAll', () => {
    it('should return an array of pincodes', async () => {
      const result = [{ id: 'uuid1', name: '12345', city_id: 'city-uuid' }];
      service.findAll.mockResolvedValue(result);

      expect(await controller.findAll()).toEqual(result);
      expect(service.findAll).toHaveBeenCalled();
    });

    it('should return empty array if no pincodes', async () => {
      service.findAll.mockResolvedValue([]);
      expect(await controller.findAll()).toEqual([]);
    });
  });

  describe('findOne', () => {
    it('should return a pincode if found', async () => {
      const id = 'uuid1';
      const result = { id, name: '12345', city_id: 'city-uuid' };
      service.findOne.mockResolvedValue(result);

      expect(await controller.findOne({ id })).toEqual(result);
      expect(service.findOne).toHaveBeenCalledWith(id);
    });

    it('should throw NotFoundException if pincode not found', async () => {
      service.findOne.mockResolvedValue(null);

      await expect(controller.findOne({ id: 'not-found' }))
        .rejects
        .toThrow(NotFoundException);
    });
  });

  describe('update', () => {
    it('should update and return the updated pincode', async () => {
      const updateDto = { id: 'uuid1', name: '67890' };
      const result = { id: 'uuid1', name: '67890', city_id: 'city-uuid' };
      service.update.mockResolvedValue(result);

      expect(await controller.update(updateDto)).toEqual(result);
      expect(service.update).toHaveBeenCalledWith(updateDto.id, { name: '67890' });
    });

    it('should throw NotFoundException if pincode not found', async () => {
      service.update.mockResolvedValue(null);

      await expect(controller.update({ id: 'not-found' }))
        .rejects
        .toThrow(NotFoundException);
    });
  });

  describe('remove', () => {
    it('should delete and return the deleted pincode', async () => {
      const id = 'uuid1';
      const result = { id, name: '12345', city_id: 'city-uuid' };
      service.remove.mockResolvedValue(result);

      expect(await controller.remove({ id })).toEqual(result);
      expect(service.remove).toHaveBeenCalledWith(id);
    });

    it('should throw NotFoundException if pincode not found', async () => {
      service.remove.mockResolvedValue(null);

      await expect(controller.remove({ id: 'not-found' }))
        .rejects
        .toThrow(NotFoundException);
    });
  });
});
+117 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/

import { Controller, Post, Body, NotFoundException } from '@nestjs/common';
import { PincodeService } from './pincode.service';
import { CreatePincodeDto } from './dto/create-pincode.dto';
import { UpdatePincodeDto, UpdatePincodeRequestDto } from './dto/update-pincode.dto';
import { PincodeDto } from './dto/pincode.dto';
import {
    ApiTags,
    ApiOperation,
    ApiCreatedResponse,
    ApiOkResponse,
    ApiNotFoundResponse,
} from '@nestjs/swagger';

/**
 * DTO for operations requiring only an ID.
 */
class IdDto {
    id: string;
}

/**
 * Controller for handling all pincode-related operations.
 */
@ApiTags('pincodes')
@Controller('pincodes')
export class PincodeController {
    /**
     * Initializes the controller with PincodeService.
     * @param pincodeService The service used for pincode operations.
     */
    constructor(private readonly pincodeService: PincodeService) { }

    /**
     * Creates a new pincode.
     * @param createPincodeDto The data to create a pincode.
     * @returns The created pincode.
     */
    @Post('create')
    @ApiOperation({ summary: 'Create a new pincode' })
    @ApiCreatedResponse({ description: 'Pincode created successfully', type: PincodeDto })
    create(@Body() createPincodeDto: CreatePincodeDto): Promise<PincodeDto> {
        return this.pincodeService.create(createPincodeDto);
    }

    /**
     * Retrieves all pincodes.
     * @returns A list of all pincodes.
     */
    @Post('list')
    @ApiOperation({ summary: 'Get all pincodes' })
    @ApiOkResponse({ description: 'List of pincodes', type: [PincodeDto] })
    findAll(): Promise<PincodeDto[]> {
        return this.pincodeService.findAll();
    }

    /**
     * Retrieves a specific pincode by ID.
     * @param body The ID of the pincode to retrieve.
     * @returns The pincode if found.
     * @throws NotFoundException if the pincode does not exist.
     */
    @Post('get')
    @ApiOperation({ summary: 'Get a specific pincode by ID' })
    @ApiOkResponse({ description: 'Pincode found successfully', type: PincodeDto })
    @ApiNotFoundResponse({ description: 'Pincode not found' })
    async findOne(@Body() body: IdDto): Promise<PincodeDto> {
        const pincode = await this.pincodeService.findOne(body.id);
        if (!pincode) {
            throw new NotFoundException('Pincode not found');
        }
        return pincode;
    }

    /**
     * Updates a specific pincode by ID.
     * @param updatePincodeRequestDto Object containing ID and update fields.
     * @returns The updated pincode.
     * @throws NotFoundException if the pincode does not exist.
     */
    @Post('update')
    @ApiOperation({ summary: 'Update a specific pincode by ID' })
    @ApiOkResponse({ description: 'Pincode updated successfully', type: PincodeDto })
    @ApiNotFoundResponse({ description: 'Pincode not found' })
    async update(@Body() updatePincodeRequestDto: UpdatePincodeRequestDto): Promise<PincodeDto> {
        const { id, ...updateData } = updatePincodeRequestDto;
        const updatedPincode = await this.pincodeService.update(id, updateData);
        if (!updatedPincode) {
            throw new NotFoundException('Pincode not found');
        }
        return updatedPincode;
    }

    /**
     * Deletes a specific pincode by ID.
     * @param body The ID of the pincode to delete.
     * @returns The deleted pincode.
     * @throws NotFoundException if the pincode does not exist.
     */
    @Post('delete')
    @ApiOperation({ summary: 'Delete a specific pincode by ID' })
    @ApiOkResponse({ description: 'Pincode deleted successfully', type: PincodeDto })
    @ApiNotFoundResponse({ description: 'Pincode not found' })
    async remove(@Body() body: IdDto): Promise<PincodeDto> {
        const deletedPincode = await this.pincodeService.remove(body.id);
        if (!deletedPincode) {
            throw new NotFoundException('Pincode not found');
        }
        return deletedPincode;
    }
}
+20 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import { Module } from '@nestjs/common';
import { PincodeService } from './pincode.service';
import { PincodeController } from './pincode.controller';
import { PrismaModule } from '../prisma/prisma.module';

/**
 *
 */
@Module({
  imports: [PrismaModule],
  providers: [PincodeService],
  controllers: [PincodeController]
})
export class PincodeModule {}
+156 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/

import { Test, TestingModule } from '@nestjs/testing';
import { PincodeService } from './pincode.service';
import { PrismaService } from '../prisma/prisma.service';
import { CreatePincodeDto } from './dto/create-pincode.dto';
import { UpdatePincodeDto } from './dto/update-pincode.dto';
import { pincode_master } from '@prisma/client';


// Sample mock data
const mockPincode: pincode_master = {
  id: '550e8400-e29b-41d4-a716-446655440027',
  name: '590001',
  city_id: '66fe8400-e29b-41d4-a716-446655424536',
  created_at: new Date(),
  updated_at: new Date(),
};

// Mock PrismaService with jest.fn()
const prismaMock = {
  pincode_master: {
    create: jest.fn(),
    findMany: jest.fn(),
    findUnique: jest.fn(),
    update: jest.fn(),
    delete: jest.fn(),
  },
};

let service: PincodeService;
let prisma: PrismaService;
describe('PincodeService', () => {

  beforeEach(async () => {
    const module: TestingModule = await Test.createTestingModule({
      providers: [
        PincodeService,
        { provide: PrismaService, useValue: prismaMock },
      ],
    }).compile();

    service = module.get<PincodeService>(PincodeService);
    prisma = module.get<PrismaService>(PrismaService);

    // Clear mocks before each test
    jest.clearAllMocks();
  });

  describe('create', () => {
    it('should create and return a new pincode', async () => {
      const createDto: CreatePincodeDto = {
        name: '590001',
        city_id: '66fe8400-e29b-41d4-a716-446655424536',
      };

      prismaMock.pincode_master.create.mockResolvedValue(mockPincode);

      const result = await service.create(createDto);
      expect(prismaMock.pincode_master.create).toHaveBeenCalledWith({ data: createDto });
      expect(result).toEqual(mockPincode);
    });

    it('should propagate errors thrown by prisma', async () => {
      const createDto: CreatePincodeDto = {
        name: '590001',
        city_id: '66fe8400-e29b-41d4-a716-446655424536',
      };
      const error = new Error('DB error');
      prismaMock.pincode_master.create.mockRejectedValue(error);

      await expect(service.create(createDto)).rejects.toThrow('DB error');
    });
  });

  describe('findAll', () => {
    it('should return an array of pincodes', async () => {
      prismaMock.pincode_master.findMany.mockResolvedValue([mockPincode]);

      const result = await service.findAll();

      expect(prismaMock.pincode_master.findMany).toHaveBeenCalledWith({ include: { city: true } });
      expect(result).toEqual([mockPincode]);
    });

    it('should return empty array if no pincodes found', async () => {
      prismaMock.pincode_master.findMany.mockResolvedValue([]);

      const result = await service.findAll();

      expect(result).toEqual([]);
    });

  });

  describe('findOne', () => {
    it('should return the pincode if found', async () => {
      prismaMock.pincode_master.findUnique.mockResolvedValue(mockPincode);

      const result = await service.findOne(mockPincode.id);

      expect(prismaMock.pincode_master.findUnique).toHaveBeenCalledWith({
        where: { id: mockPincode.id },
        include: { city: true },
      });
      expect(result).toEqual(mockPincode);
    });

    it('should return null if no pincode found', async () => {
      prismaMock.pincode_master.findUnique.mockResolvedValue(null);

      const result = await service.findOne('non-existent-id');

      expect(result).toBeNull();
    });
  });

  describe('update', () => {
    it('should update and return the pincode', async () => {
      const updateDto: UpdatePincodeDto = { name: 'Updated Name' };

      prismaMock.pincode_master.update.mockResolvedValue({
        ...mockPincode,
        name: 'Updated Name',
      });

      const result = await service.update(mockPincode.id, updateDto);

      expect(prismaMock.pincode_master.update).toHaveBeenCalledWith({
        where: { id: mockPincode.id },
        data: updateDto,
      });
      expect(result.name).toBe('Updated Name');
    });

  });

  describe('remove', () => {
    it('should delete and return the pincode', async () => {
      prismaMock.pincode_master.delete.mockResolvedValue(mockPincode);

      const result = await service.remove(mockPincode.id);

      expect(prismaMock.pincode_master.delete).toHaveBeenCalledWith({
        where: { id: mockPincode.id },
      });
      expect(result).toEqual(mockPincode);
    });

  });
});
+72 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/

import { Injectable } from '@nestjs/common';
import { PrismaService } from '../prisma/prisma.service';
import { CreatePincodeDto } from './dto/create-pincode.dto';
import { UpdatePincodeDto } from './dto/update-pincode.dto';
import { pincode_master } from '@prisma/client';

/**
 * Service class for performing CRUD operations on pincode_master.
 */
@Injectable()
export class PincodeService {
    /**
     * Initializes the PincodeService with a Prisma client.
     * @param prisma The Prisma service for database operations.
     */
    constructor(private prisma: PrismaService) { }

    /**
     * Creates a new pincode entry in the database.
     * @param data Data to create a new pincode.
     * @returns The created pincode record.
     */
    create(data: CreatePincodeDto): Promise<pincode_master> {
        return this.prisma.pincode_master.create({ data });
    }

    /**
     * Retrieves all pincodes from the database.
     * @returns An array of all pincode records including related city data.
     */
    findAll(): Promise<pincode_master[]> {
        return this.prisma.pincode_master.findMany({ include: { city: true } });
    }

    /**
     * Retrieves a single pincode by its ID.
     * @param id The ID of the pincode to retrieve.
     * @returns The pincode record if found, otherwise null.
     */
    findOne(id: string): Promise<pincode_master | null> {
        return this.prisma.pincode_master.findUnique({
            where: { id },
            include: { city: true },
        });
    }

    /**
     * Updates an existing pincode with the specified ID.
     * @param id The ID of the pincode to update.
     * @param data The updated data for the pincode.
     * @returns The updated pincode record.
     */
    update(id: string, data: UpdatePincodeDto): Promise<pincode_master> {
        return this.prisma.pincode_master.update({ where: { id }, data });
    }

    /**
     * Deletes a pincode by its ID.
     * @param id The ID of the pincode to delete.
     * @returns The deleted pincode record.
     */
    remove(id: string): Promise<pincode_master> {
        return this.prisma.pincode_master.delete({ where: { id } });
    }
}
Original line number Diff line number Diff line
/**
 * @file        prisma.service.ts
 * @description Custom Prisma service with encrypted field support and extended utilities applied via nest-common-utilities package.
 * @author      <Your Name>
 * @created     <YYYY-MM-DD>
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/

import { Injectable } from '@nestjs/common';
+109 −9
Original line number Diff line number Diff line
/**
 * @file        seed.ts
 * @description Script to seed initial user data into the database using Prisma and nest-common-utilities helpers.
 * @author      <Your Name>
 * @created     <YYYY-MM-DD>
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/

import { seedModel } from 'nest-common-utilities';
import { seedModel, seedWithRelation } from 'nest-common-utilities';
import { PrismaService } from './prisma/prisma.service';

// Instantiate Prisma service
const prisma = new PrismaService();

// Sample user data to seed into the database
const userData = [
    {
        name: 'Roshan',
@@ -29,19 +28,120 @@ const userData = [
    },
];

const hospitalSpecialtyMasterData = [
    { name: 'Super-Speciality', is_active: true },
    { name: 'Multi-Speciality', is_active: true },
    { name: 'Cancer Hospital', is_active: true },
    { name: 'Maternity', is_active: true },
    { name: 'Eye Hospital', is_active: true },
    { name: 'ENT', is_active: true },
    { name: 'Orthopedic', is_active: true },
    { name: 'Nursing Home', is_active: true },
    { name: 'Ayurvedic', is_active: true },
    { name: 'Dental', is_active: true },
    { name: 'Childcare/Pediatric', is_active: true },
    { name: 'Daycare', is_active: true },
    { name: 'Urology', is_active: true },
    { name: 'General Hospital', is_active: true },
    { name: 'Surgical', is_active: true },
    { name: 'Secondary', is_active: true },
    { name: 'Nurology', is_active: true },
    { name: 'BURNS', is_active: true },
    { name: 'COVID Temporary Hospital', is_active: true },
    { name: 'Cardiac', is_active: true },
];


const hospitalTypeMasterData = [
    { name: 'Government', is_active: true },
    { name: 'Corporate', is_active: true },
    { name: 'Private', is_active: true },
    { name: 'Mission', is_active: true },
    { name: 'Trust', is_active: true },
    { name: 'Memorial', is_active: true },
    { name: 'Individual', is_active: true },
    { name: 'Research Institute', is_active: true },
];

const hospitalCareMasterData = [
    { name: 'Primary', is_active: true },
    { name: 'Secondary', is_active: true },
    { name: 'Tertiary', is_active: true },
    { name: 'Tertiary Plus', is_active: true },
];


const hospitalDiscountMasterData = [
    { name: 'ICU Charges', is_active: true },
    { name: 'Implant', is_active: true },
    { name: 'Investigation Charges', is_active: true },
    { name: 'Medical package', is_active: true },
    { name: 'Medicine & Consumables charges', is_active: true },
    { name: 'Miscellaneous charges', is_active: true },
    { name: 'OT Charges', is_active: true },
    { name: 'Other Expenses', is_active: true },
    { name: 'Package Charges', is_active: true },
    { name: 'Pharmacy Bill Charge', is_active: true },
    { name: 'Pharmacy Charges', is_active: true },
    { name: 'Professional Fees Charges', is_active: true },
];

const hospitalRoomTypesData = [
    { name: 'ROOM', is_active: true },
    { name: 'ICU', is_active: true },
];

const hospitalRoomCategoriesData = [
    { name: 'General', room_name: 'ROOM', is_active: true },
    { name: 'Semi-Private', room_name: 'ROOM', is_active: true },
    { name: 'Private', room_name: 'ROOM', is_active: true },
    { name: 'Deluxe', room_name: 'ROOM', is_active: true, },
    { name: 'Super Deluxe', room_name: 'ROOM', is_active: true, },
    { name: 'Suite', room_name: 'ROOM', is_active: true, },
    { name: 'ICU', room_name: 'ICU', is_active: true, },
    { name: 'NICU', room_name: 'ICU', is_active: true },
    { name: 'Private - AC', room_name: 'ROOM', is_active: true, },
    { name: 'Private - DAC', room_name: 'ROOM', is_active: true, },
    { name: 'HDUI - High Dependency Unit', room_name: 'ICU', is_active: true, },
    { name: 'CCU - Cardiac Care Unit', room_name: 'ICU', is_active: true, },
    { name: 'Day Care', room_name: 'ROOM', is_active: true, },
    { name: 'Isolation Room', room_name: 'ROOM', is_active: true, },
    { name: 'Triple Share', room_name: 'ROOM', is_active: true, },
    { name: 'Labour Room', room_name: 'ROOM', is_active: true, },
    { name: 'President Room', room_name: 'ROOM', is_active: true, },
    { name: 'DIALYSIS', room_name: 'ICU', is_active: true, },
];

/**
 * Seeds the user model with initial data.
 */
async function run() {
    try {
        await seedModel(prisma, 'user' as keyof PrismaService, userData);
        console.log('User data seeded successfully.');
        await seedModel(prisma, 'hospital_speciality_master' as keyof PrismaService, hospitalSpecialtyMasterData);
        await seedModel(prisma, 'hospital_type_master' as keyof PrismaService, hospitalTypeMasterData);
        await seedModel(prisma, 'hospital_care_master' as keyof PrismaService, hospitalCareMasterData);
        await seedModel(prisma, 'hospital_discount_master' as keyof PrismaService, hospitalDiscountMasterData);
        await seedModel(prisma, 'hospital_room_types' as keyof PrismaService, hospitalRoomTypesData);


        await seedWithRelation(
            prisma,
            'hospital_room_types' as keyof PrismaService,    //parent model name
            'hospital_room_categories' as keyof PrismaService,     //child model name
            hospitalRoomCategoriesData,     //child data
            'name',          // parentLookupKey (hospital_room_types.name)
            'room_name',     // childToParentKey (hospital_room_categories.room_name)
            'room_id',       // childForeignKeyField (hospital_room_categories.room_id)
        );
        console.log('Data seeded successfully.');
    } catch (error) {
        console.error('Error seeding user data:', error);
        console.error('Error seeding data:', error);
    } finally {
        await prisma.$disconnect();
    }
}


// Execute the seed function
run();
+23 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import { IsString, IsNotEmpty } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

/**
 *
 */
export class CreateStateDto {
  @ApiProperty()
  @IsString()
  @IsNotEmpty({ message: 'State name is required' })
  name: string;

  @ApiProperty()
  @IsString()
  @IsNotEmpty({ message: 'Abbreviation is required' })
  abbv: string;
}
+31 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import { ApiProperty } from '@nestjs/swagger';
import { CityDto } from '../../city/dto/city.dto';

/**
 *
 */
export class StateDto {
    @ApiProperty({ example: 'a3f3cde3-8f4a-4a12-9b5c-1d2e3f4g5h6i' })
    id: string;

    @ApiProperty({ example: 'Karnataka' })
    name: string;

    @ApiProperty({ example: 'kar' })
    abbv: string;

    @ApiProperty({ example: '2024-01-01T10:00:00.000Z' })
    created_at: Date;

    @ApiProperty({ example: '2024-05-01T15:30:00.000Z', required: false, nullable: true })
    updated_at: Date;

    @ApiProperty({ type: [CityDto], description: 'List of cities in the state', required: false })
    cities?: CityDto[];
}
+33 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import { ApiProperty } from '@nestjs/swagger';
import { IsUUID, IsNotEmpty, IsOptional, IsString } from 'class-validator';

/**
 *
 */
export class UpdateStateDto {
    @IsOptional()
    @IsString()
    @IsNotEmpty({ message: 'State name is required if provided' })
    name: string;

    @IsOptional()
    @IsString()
    @IsNotEmpty({ message: 'Abbreviation is required if provided' })
    abbv: string;
}

/**
 *
 */
export class UpdateStateRequestDto extends UpdateStateDto {
    @ApiProperty()
    @IsUUID()
    @IsNotEmpty({ message: 'ID is required' })
    id: string;
}
+83 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import { Test, TestingModule } from '@nestjs/testing';
import { StateController } from './state.controller';
import { StateService } from './state.service';
import { CreateStateDto } from './dto/create-state.dto';
import { UpdateStateRequestDto } from './dto/update-state.dto';
import { NotFoundException } from '@nestjs/common';

describe('StateController', () => {
  let controller: StateController;
  let service: StateService;

  const mockState = {
    id: 'uuid-state-id',
    name: 'Karnataka',
    abbv: 'KA',
    created_at: new Date(),
    updated_at: new Date(),
  };

  const mockStateService = {
    create: jest.fn().mockResolvedValue(mockState),
    findAll: jest.fn().mockResolvedValue([mockState]),
    findOne: jest.fn().mockImplementation((id: string) => (id === 'uuid-state-id' ? mockState : null)),
    update: jest.fn().mockImplementation((id, dto) => (id === 'uuid-state-id' ? { ...mockState, ...dto } : null)),
    remove: jest.fn().mockImplementation((id: string) => (id === 'uuid-state-id' ? mockState : null)),
  };

  beforeEach(async () => {
    const module: TestingModule = await Test.createTestingModule({
      controllers: [StateController],
      providers: [
        {
          provide: StateService,
          useValue: mockStateService,
        },
      ],
    }).compile();

    controller = module.get<StateController>(StateController);
    service = module.get<StateService>(StateService);
  });

  it('should create a state', async () => {
    const dto: CreateStateDto = { name: 'Karnataka', abbv: 'KA' };
    await expect(controller.create(dto)).resolves.toEqual(mockState);
  });

  it('should return all states', async () => {
    await expect(controller.findAll()).resolves.toEqual([mockState]);
  });

  it('should return a state by id', async () => {
    await expect(controller.findOne({ id: 'uuid-state-id' })).resolves.toEqual(mockState);
  });

  it('should throw NotFoundException if state is not found in findOne', async () => {
    await expect(controller.findOne({ id: 'non-existent-id' })).rejects.toThrow(NotFoundException);
  });

  it('should update a state', async () => {
    const dto: UpdateStateRequestDto = { id: 'uuid-state-id', name: 'NewName', abbv: 'NN' };
    await expect(controller.update(dto)).resolves.toEqual({ ...mockState, ...dto });
  });

  it('should throw NotFoundException if state not found in update', async () => {
    const dto: UpdateStateRequestDto = { id: 'non-existent-id', name: 'NewName', abbv: 'NN' };
    await expect(controller.update(dto)).rejects.toThrow(NotFoundException);
  });

  it('should delete a state', async () => {
    await expect(controller.remove({ id: 'uuid-state-id' })).resolves.toEqual(mockState);
  });

  it('should throw NotFoundException if state not found in remove', async () => {
    await expect(controller.remove({ id: 'non-existent-id' })).rejects.toThrow(NotFoundException);
  });
});
+126 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import {
    Controller,
    Post,
    Body,
    NotFoundException,
} from '@nestjs/common';
import { StateService } from './state.service';
import { CreateStateDto } from './dto/create-state.dto';
import { UpdateStateDto, UpdateStateRequestDto } from './dto/update-state.dto';
import {
    ApiTags,
    ApiOperation,
    ApiCreatedResponse,
    ApiOkResponse,
    ApiNotFoundResponse,
} from '@nestjs/swagger';
import { StateDto } from './dto/state.dto';

/**
 * DTO for operations requiring only an ID.
 */
class IdDto {
    id: string;
}

/**
 * Controller for handling all state-related operations.
 */
@ApiTags('states')
@Controller('states')
export class StateController {
    /**
     * Initializes the controller with StateService.
     * @param stateService The service used for state operations.
     */
    constructor(private readonly stateService: StateService) { }

    /**
     * Creates a new state record in the system.
     *
     * @param createStateDto - The data required to create a state.
     * @returns The newly created state.
     */
    @Post('create')
    @ApiOperation({ summary: 'Create a new state' })
    @ApiCreatedResponse({ description: 'State created successfully', type: StateDto })
    async create(@Body() createStateDto: CreateStateDto): Promise<StateDto> {
        return this.stateService.create(createStateDto);
    }

    /**
     * Retrieves all state records from the database.
     *
     * @returns A list of all states.
     */
    @Post('list')
    @ApiOperation({ summary: 'Get all states' })
    @ApiOkResponse({ description: 'List of states', type: [StateDto] })
    async findAll(): Promise<StateDto[]> {
        return this.stateService.findAll();
    }

    /**
     * Retrieves a single state by its ID.
     *
     * @param body - An object containing the ID of the state.
     * @returns The state matching the provided ID.
     * @throws NotFoundException if no state is found with the given ID.
     */
    @Post('get')
    @ApiOperation({ summary: 'Get a state by ID' })
    @ApiOkResponse({ description: 'State found', type: StateDto })
    @ApiNotFoundResponse({ description: 'State not found' })
    async findOne(@Body() body: IdDto): Promise<StateDto> {
        const state = await this.stateService.findOne(body.id);
        if (!state) {
            throw new NotFoundException('State not found');
        }
        return state;
    }

    /**
     * Updates an existing state based on the provided ID and update data.
     *
     * @param updateDto - An object containing the state ID and updated values.
     * @returns The updated state record.
     * @throws NotFoundException if no state is found with the given ID.
     */
    @Post('update')
    @ApiOperation({ summary: 'Update a state' })
    @ApiOkResponse({ description: 'State updated successfully', type: StateDto })
    @ApiNotFoundResponse({ description: 'State not found' })
    async update(@Body() updateDto: UpdateStateRequestDto): Promise<StateDto> {
        const { id, ...updateData } = updateDto;
        const updatedState = await this.stateService.update(id, updateData);
        if (!updatedState) {
            throw new NotFoundException('State not found');
        }
        return updatedState;
    }

    /**
     * Deletes a state record by its ID.
     *
     * @param body - An object containing the ID of the state to be deleted.
     * @returns The deleted state record.
     * @throws NotFoundException if no state is found with the provided ID.
     */
    @Post('delete')
    @ApiOperation({ summary: 'Delete a state' })
    @ApiOkResponse({ description: 'State deleted successfully', type: StateDto })
    @ApiNotFoundResponse({ description: 'State not found' })
    async remove(@Body() body: IdDto): Promise<StateDto> {
        const deletedState = await this.stateService.remove(body.id);
        if (!deletedState) {
            throw new NotFoundException('State not found');
        }
        return deletedState;
    }
}
+21 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import { Module } from '@nestjs/common';
import { StateController } from './state.controller';
import { StateService } from './state.service';
import { PrismaModule } from '../prisma/prisma.module';


/**
 *
 */
@Module({
  imports: [PrismaModule],
  controllers: [StateController],
  providers: [StateService]
})
export class StateModule {}
+90 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import { Test, TestingModule } from '@nestjs/testing';
import { StateService } from './state.service';
import { PrismaService } from '../prisma/prisma.service';
import { CreateStateDto } from './dto/create-state.dto';
import { UpdateStateDto } from './dto/update-state.dto';
import { state_master } from '@prisma/client';

describe('StateService', () => {
  let service: StateService;
  let prisma: PrismaService;

  const mockPrismaService = {
    state_master: {
      create: jest.fn(),
      findMany: jest.fn(),
      findUnique: jest.fn(),
      update: jest.fn(),
      delete: jest.fn(),
    },
  };

  beforeEach(async () => {
    const module: TestingModule = await Test.createTestingModule({
      providers: [StateService, { provide: PrismaService, useValue: mockPrismaService }],
    }).compile();

    service = module.get<StateService>(StateService);
    prisma = module.get<PrismaService>(PrismaService);
  });

  afterEach(() => {
    jest.clearAllMocks();
  });

  it('should create a new state', async () => {
    const dto: CreateStateDto = { name: 'Karnataka', abbv: 'KA' };
    const result: state_master = { id: '1', name: 'Karnataka' } as state_master;
    mockPrismaService.state_master.create.mockResolvedValue(result);

    expect(await service.create(dto)).toEqual(result);
    expect(mockPrismaService.state_master.create).toHaveBeenCalledWith({ data: dto });
  });

  it('should return all states with cities', async () => {
    const result: state_master[] = [{ id: '1', name: 'State A', cities: [] }] as any;
    mockPrismaService.state_master.findMany.mockResolvedValue(result);

    expect(await service.findAll()).toEqual(result);
    expect(mockPrismaService.state_master.findMany).toHaveBeenCalledWith({ include: { cities: true } });
  });

  it('should return a single state by ID', async () => {
    const result: state_master = { id: '1', name: 'State A', cities: [] } as any;
    mockPrismaService.state_master.findUnique.mockResolvedValue(result);

    expect(await service.findOne('1')).toEqual(result);
    expect(mockPrismaService.state_master.findUnique).toHaveBeenCalledWith({
      where: { id: '1' },
      include: { cities: true },
    });
  });

  it('should return null if state not found', async () => {
    mockPrismaService.state_master.findUnique.mockResolvedValue(null);
    expect(await service.findOne('999')).toBeNull();
  });

  it('should update a state', async () => {
    const dto: UpdateStateDto = { name: 'Karnataka1', abbv: 'KA1' };
    const result: state_master = { id: '1', name: 'Karnataka1' } as state_master;
    mockPrismaService.state_master.update.mockResolvedValue(result);

    expect(await service.update('1', dto)).toEqual(result);
    expect(mockPrismaService.state_master.update).toHaveBeenCalledWith({ where: { id: '1' }, data: dto });
  });

  it('should delete a state', async () => {
    const result: state_master = { id: '1', name: 'To Delete' } as state_master;
    mockPrismaService.state_master.delete.mockResolvedValue(result);

    expect(await service.remove('1')).toEqual(result);
    expect(mockPrismaService.state_master.delete).toHaveBeenCalledWith({ where: { id: '1' } });
  });
});
+76 −0
Original line number Diff line number Diff line
/**
 @file        <file name>
 @description  <description>
 @author      <Your Name>
 @created     <YYYY-MM-DD>
**/
import { Injectable } from '@nestjs/common';
import { PrismaService } from '../prisma/prisma.service';
import { CreateStateDto } from './dto/create-state.dto';
import { UpdateStateDto } from './dto/update-state.dto';
import { state_master } from '@prisma/client';

/**
 * Service class for performing CRUD operations on state_master.
 */
@Injectable()
export class StateService {
  /**
   * Initializes the service with a Prisma client.
   * @param prisma The Prisma service for database operations.
   */
  constructor(private prisma: PrismaService) {}

  /**
   * Creates a new state entry in the database.
   *
   * @param data - Data required to create a state.
   * @returns The newly created state record.
   */
  async create(data: CreateStateDto): Promise<state_master> {
    return this.prisma.state_master.create({ data });
  }

  /**
   * Retrieves all state records with associated cities.
   *
   * @returns An array of state records including their cities.
   */
  async findAll(): Promise<state_master[]> {
    return this.prisma.state_master.findMany({ include: { cities: true } });
  }

  /**
   * Retrieves a specific state by its ID.
   *
   * @param id - The UUID of the state to retrieve.
   * @returns The state record if found, otherwise null.
   */
  async findOne(id: string): Promise<state_master | null> {
    return this.prisma.state_master.findUnique({
      where: { id },
      include: { cities: true },
    });
  }

  /**
   * Updates an existing state record with new data.
   *
   * @param id - The UUID of the state to update.
   * @param data - Partial state data to update.
   * @returns The updated state record.
   */
  async update(id: string, data: UpdateStateDto): Promise<state_master> {
    return this.prisma.state_master.update({ where: { id }, data });
  }

  /**
   * Deletes a state record by its ID.
   *
   * @param id - The UUID of the state to delete.
   * @returns The deleted state record.
   */
  async remove(id: string): Promise<state_master> {
    return this.prisma.state_master.delete({ where: { id } });
  }
}