Add Swagger documentation and handlers for API endpoints

- Created swagger.yml to define Swagger UI and JSON endpoints.
- Implemented swagger.ts to serve Swagger UI HTML and JSON specifications.
- Updated swagger.json with detailed API documentation, including paths, components, and schemas for various requests and responses.
This commit is contained in:
paritosh18
2025-12-05 20:35:46 +05:30
parent ecf45c3e7c
commit cdae23ec6c
7 changed files with 1126 additions and 777 deletions

29
package-lock.json generated
View File

@@ -47,7 +47,6 @@
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.1",
"serverless": "4.17.0",
"swagger-ui-express": "^5.0.0",
"tslib": "^2.8.1",
"uuid": "^13.0.0",
"yup": "^1.7.1",
@@ -75,6 +74,7 @@
"serverless-offline": "^14.4.0",
"source-map-support": "^0.5.21",
"supertest": "^6.3.4",
"swagger-ui-express": "^5.0.1",
"ts-jest": "^29.1.2",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
@@ -6564,6 +6564,7 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",
"integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
@@ -8329,6 +8330,7 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz",
"integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
@@ -8359,6 +8361,7 @@
"version": "0.7.2",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
@@ -8369,6 +8372,7 @@
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz",
"integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
@@ -9379,6 +9383,7 @@
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz",
"integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
@@ -9422,6 +9427,7 @@
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.1.tgz",
"integrity": "sha512-nfDwkulwiZYQIGwxdy0RUmowMhKcFVcYXUU7m4QlKYim1rUtg83xm2yjZ40QjDuc291AJjjeSc9b++AWHSgSHw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
@@ -9447,6 +9453,7 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
"integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
@@ -9468,6 +9475,7 @@
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.0.tgz",
"integrity": "sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
@@ -9485,6 +9493,7 @@
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz",
"integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
@@ -9495,6 +9504,7 @@
"version": "6.14.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz",
"integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==",
"dev": true,
"license": "BSD-3-Clause",
"peer": true,
"dependencies": {
@@ -9511,6 +9521,7 @@
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz",
"integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
@@ -9527,6 +9538,7 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz",
"integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
@@ -9773,6 +9785,7 @@
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.0.tgz",
"integrity": "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
@@ -10016,6 +10029,7 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz",
"integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
@@ -10864,6 +10878,7 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",
"dev": true,
"license": "MIT",
"peer": true
},
@@ -12437,6 +12452,7 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz",
"integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
@@ -12516,6 +12532,7 @@
"version": "1.54.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",
"integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.6"
@@ -12525,6 +12542,7 @@
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz",
"integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
@@ -12709,6 +12727,7 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz",
"integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
@@ -12944,6 +12963,7 @@
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"dev": true,
"license": "ISC",
"dependencies": {
"wrappy": "1"
@@ -14224,6 +14244,7 @@
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",
"integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
@@ -14241,6 +14262,7 @@
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz",
"integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==",
"dev": true,
"license": "MIT",
"peer": true,
"funding": {
@@ -14416,6 +14438,7 @@
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/send/-/send-1.2.0.tgz",
"integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
@@ -14454,6 +14477,7 @@
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz",
"integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
@@ -15012,6 +15036,7 @@
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
@@ -15256,6 +15281,7 @@
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/swagger-ui-express/-/swagger-ui-express-5.0.1.tgz",
"integrity": "sha512-SrNU3RiBGTLLmFU8GIJdOdanJTl4TOmT27tt3bWWHppqYmAZ6IDuEuBvMU6nZq0zLEe6b/1rACXCgLZqO6ZfrA==",
"dev": true,
"license": "MIT",
"dependencies": {
"swagger-ui-dist": ">=5.0.0"
@@ -17031,6 +17057,7 @@
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
"dev": true,
"license": "ISC"
},
"node_modules/write-file-atomic": {

View File

@@ -64,7 +64,6 @@
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.1",
"serverless": "4.17.0",
"swagger-ui-express": "^5.0.0",
"tslib": "^2.8.1",
"uuid": "^13.0.0",
"yup": "^1.7.1",
@@ -92,6 +91,7 @@
"serverless-offline": "^14.4.0",
"source-map-support": "^0.5.21",
"supertest": "^6.3.4",
"swagger-ui-express": "^5.0.1",
"ts-jest": "^29.1.2",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",

View File

@@ -60,6 +60,8 @@ provider:
custom:
serverless-offline:
reloadHandler: true
httpPort: 3000
noPrependStageInUrl: true
build:
esbuild:
@@ -128,6 +130,7 @@ functions:
- ${file(./serverless/functions/minglaradmin.yml)}
- ${file(./serverless/functions/prepopulate.yml)}
- ${file(./serverless/functions/pqq.yml)}
- ${file(./serverless/functions/swagger.yml)}
plugins:
- serverless-offline

View File

@@ -1,764 +0,0 @@
service: minglarDev
provider:
name: aws
runtime: nodejs22.x
region: ap-south-1
versionFunctions: false
memorySize: 512 # Default memory for all functions (can be overridden per function)
apiGateway:
binaryMediaTypes:
- '*/*'
minimumCompressionSize: 1024
environment:
DATABASE_URL: ${env:DATABASE_URL}
DB_USERNAME: ${env:DB_USERNAME}
DB_PASSWORD: ${env:DB_PASSWORD}
DB_DATABASE_NAME: ${env:DB_DATABASE_NAME}
DB_HOSTNAME: ${env:DB_HOSTNAME}
DB_PORT: ${env:DB_PORT}
BY_PASS_EMAIL: ${env:BY_PASS_EMAIL}
BYPASS_OTP: ${env:BYPASS_OTP}
BREVO_EMAIL_API_KEY: ${env:BREVO_EMAIL_API_KEY}
BREVO_API_BASEURL: ${env:BREVO_API_BASEURL}
BREVO_FROM_EMAIL: ${env:BREVO_FROM_EMAIL}
BREVO_SMTP_HOST: ${env:BREVO_SMTP_HOST}
BREVO_SMTP_PORT: ${env:BREVO_SMTP_PORT}
BREVO_SMTP_USER: ${env:BREVO_SMTP_USER}
BREVO_SMTP_PASS: ${env:BREVO_SMTP_PASS}
REFRESH_TOKEN_SECRET: ${env:REFRESH_TOKEN_SECRET}
JWT_SECRET: ${env:JWT_SECRET}
SALT_ROUNDS: ${env:SALT_ROUNDS}
NODE_ENV: ${env:NODE_ENV}
S3_BUCKET_NAME: ${env:S3_BUCKET_NAME}
MINGLAR_ADMIN_NAME: ${env:MINGLAR_ADMIN_NAME}
MINGLAR_ADMIN_EMAIL: ${env:MINGLAR_ADMIN_EMAIL}
iam:
role:
statements:
- Effect: Allow
Action:
- s3:PutObject
- s3:GetObject
- s3:DeleteObject
- s3:ListBucket
Resource:
- 'arn:aws:s3:::${env:S3_BUCKET_NAME}'
- 'arn:aws:s3:::${env:S3_BUCKET_NAME}/*'
custom:
esbuild:
bundle: true
minify: true
sourcemap: false
target: node20
platform: node
concurrency: 5
external:
- '@prisma/client'
- '.prisma'
exclude:
- 'aws-sdk'
package:
individually: true
patterns:
- '!node_modules/**'
- '!**/*.test.js'
- '!**/*.spec.js'
- '!**/test/**'
- '!**/__tests__/**'
- '!package-lock.json'
- '!yarn.lock'
- '!README.md'
- '!*.config.js'
- '!.git/**'
- '!.github/**'
functions:
getHosts:
handler: src/modules/host/handlers/host.handler
memorySize: 384 # Lower memory for simple GET operations
package:
patterns:
- 'src/modules/host/handlers/host.*'
- 'src/modules/host/services/**'
- 'src/common/**'
- 'common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /host
method: get
verifyOtp:
handler: src/modules/host/handlers/verifyOtp.handler
memorySize: 384
package:
patterns:
- 'src/modules/host/handlers/verifyOtp.*'
- 'src/modules/host/services/**'
- 'src/common/**'
- 'common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /host/verify-otp
method: post
loginForHost:
handler: src/modules/host/handlers/loginForHost.handler
memorySize: 384
package:
patterns:
- 'src/modules/host/handlers/loginForHost.*'
- 'src/modules/host/services/**'
- 'src/common/**'
- 'common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /host/login
method: post
registrationOfHost:
handler: src/modules/host/handlers/registration.handler
memorySize: 384
package:
patterns:
- 'src/modules/host/handlers/registration.*'
- 'src/modules/host/services/**'
- 'src/common/**'
- 'common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /host/registration
method: post
createPasswordForHost:
handler: src/modules/host/handlers/createPassword.handler
memorySize: 384
package:
patterns:
- 'src/modules/host/handlers/createPassword.*'
- 'src/modules/host/services/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /host/create-password
method: post
addPaymentDetailsForHost:
handler: src/modules/host/handlers/addPaymentDetails.handler
memorySize: 384
package:
patterns:
- 'src/modules/host/handlers/addPaymentDetails.*'
- 'src/modules/host/services/**'
- 'src/common/**'
- 'common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /host/add-payment-details
method: post
addActivity:
handler: src/modules/host/handlers/addActivity.handler
memorySize: 384
package:
patterns:
- 'src/modules/host/handlers/addActivity.*'
- 'src/modules/host/services/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /host/add-activity
method: post
getHostById:
handler: src/modules/host/handlers/getbyidhandler.handler
memorySize: 384
package:
patterns:
- 'src/modules/host/handlers/getbyidhandler.*'
- 'src/modules/host/services/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /host/getById
method: get
getPQQQuestionDetailsById:
handler: src/modules/host/handlers/getByIdPQQ.handler
memorySize: 384
package:
patterns:
- 'src/modules/host/handlers/getByIdPQQ.*'
- 'src/modules/host/services/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /host/get-pqq-question-details
method: get
getLatestPQQQuestionDetails:
handler: src/modules/host/handlers/getLatestQuestionDetailsPQQ.handler
memorySize: 384
package:
patterns:
- 'src/modules/host/handlers/getLatestQuestionDetailsPQQ.*'
- 'src/modules/host/services/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /host/get-latest-pqq-question-details
method: get
getActivityTypes:
handler: src/modules/host/handlers/getActivity.handler
memorySize: 384
package:
patterns:
- 'src/modules/host/handlers/getActivity.*'
- 'src/modules/host/services/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /host/get-activity
method: get
acceptMinglarAgreement:
handler: src/modules/host/handlers/acceptAgreement.handler
memorySize: 384
package:
patterns:
- 'src/modules/host/handlers/acceptAgreement.*'
- 'src/modules/host/services/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /host/accept-agreement
method: patch
getStepperInfo:
handler: src/modules/host/handlers/getStepper.handler
memorySize: 384
package:
patterns:
- 'src/modules/host/handlers/getStepper.*'
- 'src/common/utils/handlers/safeHandler.*'
- 'src/common/database/**'
- 'src/modules/host/services/**'
- 'common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /stepper
method: get
getSuggestion:
handler: src/modules/minglaradmin/handlers/getSuggestion.handler
memorySize: 384
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /minglaradmin/get-suggestion
method: get
minglarRegistration:
handler: src/modules/minglaradmin/handlers/registration.handler
memorySize: 384
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /minglaradmin/registration
method: post
minglarLoginForAdmin:
handler: src/modules/minglaradmin/handlers/loginForMinglar.handler
memorySize: 384
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /minglaradmin/login
method: post
minglarCreatePassword:
handler: src/modules/minglaradmin/handlers/createPassword.handler
memorySize: 384
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /minglaradmin/create-password
method: post
# Functions using AWS SDK - KEEP AS IS with higher memory
updateMinglarProfile:
handler: src/modules/minglaradmin/handlers/updateProfile.handler
memorySize: 512 # Higher memory for AWS SDK operations
timeout: 30
package:
patterns:
- 'src/modules/minglaradmin/handlers/updateProfile.*'
- 'src/modules/minglaradmin/services/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
- 'node_modules/@aws-sdk/**'
- 'node_modules/@smithy/**'
- 'node_modules/tslib/**'
- 'node_modules/fast-xml-parser/**'
events:
- httpApi:
path: /minglaradmin/update-profile
method: patch
prepopulateTeammate:
handler: src/modules/minglaradmin/handlers/prepopulateTeammate.handler
memorySize: 384
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /minglaradmin/prepopulate-Roles
method: get
inviteTeammate:
handler: src/modules/minglaradmin/handlers/inviteTeammate.handler
memorySize: 384
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /minglaradmin/invite-teammate
method: post
getAllHostApplication:
handler: src/modules/minglaradmin/handlers/getAllHostApplication.handler
memorySize: 512 # Higher memory for data-intensive operations
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /minglaradmin/get-all-host-applications-am
method: get
getAllOnboardingHostApplications:
handler: src/modules/minglaradmin/handlers/getAllOnboardingHosts.handler
memorySize: 512 # Higher memory for data-intensive operations
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /minglaradmin/get-all-host-applications-admin
method: get
getAllOnboardingHostApplications_New:
handler: src/modules/minglaradmin/handlers/getOnboardingNewApplications.handler
memorySize: 512 # Higher memory for data-intensive operations
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /minglaradmin/get-all-host-applications-admin-new
method: get
getAllInvitationDetails:
handler: src/modules/minglaradmin/handlers/getAllInvitationDetails.handler
memorySize: 512
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /minglaradmin/get-all-invitation-details
method: get
addSuggestion:
handler: src/modules/minglaradmin/handlers/addSuggestion.handler
memorySize: 384
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /minglaradmin/add-suggestion
method: post
getAllCoadminAndAMDetails:
handler: src/modules/minglaradmin/handlers/getAllCoadminAndAM.handler
memorySize: 512
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /minglaradmin/get-all-coadmin-and-am-details
method: get
getAllInvitedCoadminAndAMDetails:
handler: src/modules/minglaradmin/handlers/getAllInvitedCoadminAndAM.handler
memorySize: 512
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /minglaradmin/get-all-invited-coadmin-and-am
method: get
getAllBankAndCurrencyDetails:
handler: src/modules/prepopulate/handlers/getAllBankDetails.handler
memorySize: 384
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /prepopulate/get-all-bank-currency-details
method: get
getCityByState:
handler: src/modules/prepopulate/handlers/getCityByState.handler
memorySize: 384
package:
patterns:
- 'src/modules/prepopulate/handlers/getCityByState.*'
- 'src/modules/prepopulate/services/**'
- 'src/common/**'
- 'common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /prepopulate/get-city-by-state
method: get
getBranchByBankXid:
handler: src/modules/prepopulate/handlers/getBranchByBank.handler
memorySize: 384
package:
patterns:
- 'src/modules/prepopulate/handlers/getBranchByBank.*'
- 'src/modules/prepopulate/services/**'
- 'src/common/**'
- 'common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /prepopulate/get-branch-by-bank
method: get
getAllDocumentCountryStateCityDetails:
handler: src/modules/prepopulate/handlers/getAllDocTypeWithCountryState.handler
memorySize: 512
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /prepopulate/get-all-doc-country
method: get
getAllPqqQuesAns:
handler: src/modules/prepopulate/handlers/getAllPQQQuesWithAns.handler
memorySize: 512
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /prepopulate/get-all-pqq-ques-ans
method: get
getFrequenciesOfActivity:
handler: src/modules/prepopulate/handlers/getAllFrequencies.handler
memorySize: 384
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /prepopulate/get-all-Frequencies
method: get
assignAMToHost:
handler: src/modules/minglaradmin/handlers/assignAM.handler
memorySize: 384
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /minglaradmin/assign-am-to-host
method: patch
editAgreementDetails:
handler: src/modules/minglaradmin/handlers/editAgreementDetails.handler
memorySize: 384
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /minglaradmin/edit-agreement-details
method: patch
acceptHostApplication:
handler: src/modules/minglaradmin/handlers/acceptHostApplication.handler
memorySize: 384
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /minglaradmin/accept-host-application
method: patch
acceptHostApplicationMinglar:
handler: src/modules/minglaradmin/handlers/acceptHostAppMinglar.handler
memorySize: 384
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /minglaradmin/accept-host-application-minglar
method: patch
rejectHostApplication:
handler: src/modules/minglaradmin/handlers/rejectHostApplication.handler
memorySize: 384
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /minglaradmin/reject-host-application
method: patch
rejectHostApplicationAM:
handler: src/modules/minglaradmin/handlers/rejectHostApplicationAM.handler
memorySize: 384
package:
patterns:
- 'src/modules/minglaradmin/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
events:
- httpApi:
path: /minglaradmin/reject-host-application-am
method: patch
# Functions using AWS SDK and S3 - KEEP AS IS with higher memory
addCompanyDetails:
handler: src/modules/host/handlers/addCompanyDetails.handler
memorySize: 512
timeout: 30
package:
patterns:
- 'src/modules/host/handlers/addCompanyDetails.*'
- 'src/modules/host/services/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
# Only include specific AWS SDK modules needed for S3
- 'node_modules/@aws-sdk/client-s3/**'
- 'node_modules/@aws-sdk/s3-request-presigner/**'
- 'node_modules/@aws-sdk/types/**'
- 'node_modules/@aws-sdk/middleware-logger/**'
- 'node_modules/@aws-sdk/util-utf8-node/**'
- 'node_modules/@aws-sdk/util-utf8-browser/**'
- 'node_modules/@smithy/**'
- 'node_modules/tslib/**'
# Remove these large/unnecessary packages:
- 'node_modules/fast-xml-parser/**' # Remove if not used
- 'node_modules/lambda-multipart-parser/**' # You're using busboy directly
- 'node_modules/busboy/**'
# Remove these AWS utility packages (included in main SDK):
- 'node_modules/@aws-crypto/**'
# - 'node_modules/uuid/**' # AWS SDK includes its own
# - 'node_modules/@aws/util-uri-escape/**'
# - 'node_modules/@aws/util-middleware/**'
- 'node_modules/@aws/smithy-client/**'
# - 'node_modules/@aws/lambda-invoke-store/**'
events:
- httpApi:
path: /host/add-company-details
method: patch
submitPqqAnswer:
handler: src/modules/host/handlers/submitPqqAns.handler
memorySize: 512
timeout: 30
package:
patterns:
- 'src/modules/host/handlers/submitPqqAns.*'
- 'src/modules/host/services/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
- 'node_modules/@aws-sdk/**'
- 'node_modules/@smithy/**'
- 'node_modules/tslib/**'
- 'node_modules/fast-xml-parser/**'
- 'node_modules/lambda-multipart-parser/**'
- 'node_modules/busboy/**'
- 'node_modules/@aws-crypto/**'
- 'node_modules/uuid/**'
- 'node_modules/@aws/util-uri-escape/**'
- 'node_modules/@aws/util-middleware/**'
- 'node_modules/@aws/smithy-client/**'
- 'node_modules/@aws/lambda-invoke-store/**'
events:
- httpApi:
path: /host/submit-pqq-ans
method: patch
submitFinalPqqAnswer:
handler: src/modules/host/handlers/getPQQScore.handler
memorySize: 512
timeout: 30
package:
patterns:
- 'src/modules/host/handlers/getPQQScore.*'
- 'src/modules/host/services/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/client/libquery_engine-rhel-openssl-3.0.x.so.node'
- 'node_modules/@aws-sdk/**'
- 'node_modules/@smithy/**'
- 'node_modules/tslib/**'
- 'node_modules/fast-xml-parser/**'
- 'node_modules/lambda-multipart-parser/**'
- 'node_modules/busboy/**'
- 'node_modules/@aws-crypto/**'
- 'node_modules/uuid/**'
- 'node_modules/@aws/util-uri-escape/**'
- 'node_modules/@aws/util-middleware/**'
- 'node_modules/@aws/smithy-client/**'
- 'node_modules/@aws/lambda-invoke-store/**'
events:
- httpApi:
path: /host/submit-final-pqq-ans
method: patch
addPQQSuggestion:
handler: src/modules/minglar/handlers/addPQQSuggestion.handler
memorySize: 384
package:
patterns:
- 'src/modules/minglaradmin/handlers/addPQQSuggestion.*'
- 'src/modules/minglaradmin/services/**'
- 'src/common/**'
- 'node_modules/@prisma/client/**'
- 'node_modules/.prisma/**'
events:
- httpApi:
path: /minglar/add-Pqq-suggestion
method: post

View File

@@ -0,0 +1,20 @@
# Swagger Documentation Functions
swaggerUi:
handler: src/handlers/swagger.swaggerUi
memorySize: 256
events:
- httpApi:
path: /api-docs
method: get
swaggerJson:
handler: src/handlers/swagger.swaggerJson
memorySize: 256
package:
patterns:
- 'swagger.json'
events:
- httpApi:
path: /swagger.json
method: get

140
src/handlers/swagger.ts Normal file
View File

@@ -0,0 +1,140 @@
// src/handlers/swagger.ts
// Swagger UI handler for serverless-offline
import { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda';
import * as fs from 'fs';
import * as path from 'path';
// Swagger UI HTML template
const getSwaggerHtml = (specUrl: string) => `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Minglar API Documentation</title>
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui.css" />
<style>
html { box-sizing: border-box; overflow-y: scroll; }
*, *:before, *:after { box-sizing: inherit; }
body { margin: 0; background: #fafafa; }
.swagger-ui .topbar { display: none; }
.swagger-ui .info { margin: 20px 0; }
.swagger-ui .info .title { font-size: 36px; }
</style>
</head>
<body>
<div id="swagger-ui"></div>
<script src="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui-bundle.js"></script>
<script src="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui-standalone-preset.js"></script>
<script>
window.onload = function() {
const ui = SwaggerUIBundle({
url: "/swagger.json",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout",
persistAuthorization: true,
displayRequestDuration: true,
filter: true,
showExtensions: true,
tryItOutEnabled: true
});
window.ui = ui;
};
</script>
</body>
</html>
`;
// Handler for Swagger UI HTML page
export const swaggerUi = async (
event: APIGatewayProxyEvent
): Promise<APIGatewayProxyResult> => {
const host = event.headers?.Host || event.headers?.host || 'localhost:3000';
// For serverless-offline, use simple direct URL without stage
const specUrl = `/swagger.json`;
return {
statusCode: 200,
headers: {
'Content-Type': 'text/html',
'Access-Control-Allow-Origin': '*',
'Cache-Control': 'no-cache, no-store, must-revalidate',
'Pragma': 'no-cache',
'Expires': '0',
},
body: getSwaggerHtml(specUrl),
};
};
// Handler for swagger.json
export const swaggerJson = async (
event: APIGatewayProxyEvent
): Promise<APIGatewayProxyResult> => {
try {
// Read swagger.json from project root
const swaggerPath = path.join(process.cwd(), 'swagger.json');
const swaggerContent = fs.readFileSync(swaggerPath, 'utf8');
const swaggerDoc = JSON.parse(swaggerContent);
// Update server URL dynamically - ALWAYS use root URL without stage
const host = event.headers?.Host || event.headers?.host || 'localhost:3000';
const protocol = event.headers?.['X-Forwarded-Proto'] || 'http';
// For local development, use root URL. For AWS, use the full URL with stage only if deployed
if (process.env.AWS_LAMBDA_FUNCTION_NAME && process.env.AWS_EXECUTION_ENV) {
// Only add stage for actual AWS deployment, not serverless-offline
const stage = event.requestContext?.stage;
const stagePrefix = stage && stage !== '$default' ? `/${stage}` : '';
swaggerDoc.servers = [
{
url: `${protocol}://${host}${stagePrefix}`,
description: 'AWS API Gateway'
}
];
} else {
// Local development - no stage prefix
swaggerDoc.servers = [
{
url: `http://${host}`,
description: 'Local Development (serverless-offline)'
}
];
}
return {
statusCode: 200,
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'Content-Type,Authorization',
'Cache-Control': 'no-cache, no-store, must-revalidate',
'Pragma': 'no-cache',
'Expires': '0',
},
body: JSON.stringify(swaggerDoc, null, 2),
};
} catch (error) {
console.error('Error loading swagger.json:', error);
return {
statusCode: 500,
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*',
},
body: JSON.stringify({
error: 'Failed to load swagger.json',
message: error instanceof Error ? error.message : 'Unknown error'
}),
};
}
};

View File

@@ -1,27 +1,950 @@
{
"openapi": "3.0.0",
"paths": {},
"info": {
"title": "Minglar API",
"description": "NestJS Backend for Minglar with Lambda-ready endpoints",
"description": "Serverless Backend API for Minglar - Host Management, Admin, and Prepopulate Services",
"version": "1.0.0",
"contact": {}
"contact": {
"name": "Minglar Team"
}
},
"tags": [],
"servers": [
{
"url": "http://localhost:3000/",
"description": "Local Server"
"url": "/",
"description": "Local Development (serverless-offline)"
},
{
"url": "https://your-api-gateway-url.execute-api.ap-south-1.amazonaws.com/dev",
"description": "AWS API Gateway (dev)"
}
],
"tags": [
{
"name": "Host - Onboarding",
"description": "Host registration, login, and onboarding endpoints"
},
{
"name": "Host - Activity Hub",
"description": "Host activity and PQQ management"
},
{
"name": "Minglar Admin - Auth",
"description": "Minglar admin authentication endpoints"
},
{
"name": "Minglar Admin - Host Hub",
"description": "Admin host management endpoints"
},
{
"name": "Minglar Admin - Settings",
"description": "Admin settings and teammate management"
},
{
"name": "Prepopulate",
"description": "Reference data and lookup endpoints"
},
{
"name": "PQQ",
"description": "Pre-Qualification Questionnaire endpoints"
}
],
"components": {
"securitySchemes": {
"bearer": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT",
"type": "http"
"bearerFormat": "JWT"
}
},
"schemas": {}
"schemas": {
"SignUpRequest": {
"type": "object",
"required": ["firstName", "lastName", "emailAddress"],
"properties": {
"firstName": { "type": "string", "example": "John" },
"lastName": { "type": "string", "example": "Doe" },
"emailAddress": { "type": "string", "format": "email", "example": "john@example.com" },
"isdCode": { "type": "string", "example": "+91" },
"mobileNumber": { "type": "string", "example": "9876543210" }
}
},
"LoginRequest": {
"type": "object",
"required": ["emailAddress", "password"],
"properties": {
"emailAddress": { "type": "string", "format": "email", "example": "john@example.com" },
"password": { "type": "string", "example": "password123" }
}
},
"VerifyOTPRequest": {
"type": "object",
"required": ["emailAddress", "otp"],
"properties": {
"emailAddress": { "type": "string", "format": "email" },
"otp": { "type": "string", "example": "123456" }
}
},
"CreatePasswordRequest": {
"type": "object",
"required": ["password", "confirmPassword"],
"properties": {
"password": { "type": "string", "minLength": 8 },
"confirmPassword": { "type": "string", "minLength": 8 }
}
},
"BankDetailsRequest": {
"type": "object",
"required": ["bankXid", "bankBranchXid", "accountNumber", "accountHolderName", "ifscCode", "currencyXid"],
"properties": {
"bankXid": { "type": "integer" },
"bankBranchXid": { "type": "integer" },
"accountNumber": { "type": "string" },
"accountHolderName": { "type": "string" },
"ifscCode": { "type": "string" },
"currencyXid": { "type": "integer" }
}
},
"CompanyDetailsRequest": {
"type": "object",
"properties": {
"companyName": { "type": "string" },
"companyAddress": { "type": "string" },
"companyDocuments": { "type": "array", "items": { "type": "string" } }
}
},
"ActivityRequest": {
"type": "object",
"required": ["activityTypeXid", "activityName"],
"properties": {
"activityTypeXid": { "type": "integer" },
"activityName": { "type": "string" },
"description": { "type": "string" }
}
},
"PQQAnswerRequest": {
"type": "object",
"required": ["questionXid", "answer"],
"properties": {
"questionXid": { "type": "integer" },
"answer": { "type": "string" },
"activityXid": { "type": "integer" }
}
},
"InviteTeammateRequest": {
"type": "object",
"required": ["emailAddress", "roleXid"],
"properties": {
"emailAddress": { "type": "string", "format": "email" },
"roleXid": { "type": "integer" },
"firstName": { "type": "string" },
"lastName": { "type": "string" }
}
},
"SuggestionRequest": {
"type": "object",
"required": ["hostXid", "suggestion"],
"properties": {
"hostXid": { "type": "integer" },
"suggestion": { "type": "string" }
}
},
"AssignAMRequest": {
"type": "object",
"required": ["hostXid", "amXid"],
"properties": {
"hostXid": { "type": "integer" },
"amXid": { "type": "integer" }
}
},
"LoginResponse": {
"type": "object",
"properties": {
"id": { "type": "integer" },
"firstName": { "type": "string" },
"lastName": { "type": "string" },
"emailAddress": { "type": "string" },
"mobileNumber": { "type": "string" },
"isActive": { "type": "boolean" },
"roleXid": { "type": "integer" },
"accessToken": { "type": "string" },
"refreshToken": { "type": "string" }
}
},
"SuccessResponse": {
"type": "object",
"properties": {
"success": { "type": "boolean", "example": true },
"message": { "type": "string" },
"data": { "type": "object" }
}
},
"ErrorResponse": {
"type": "object",
"properties": {
"success": { "type": "boolean", "example": false },
"message": { "type": "string" },
"error": { "type": "string" }
}
},
"PaginatedResponse": {
"type": "object",
"properties": {
"success": { "type": "boolean" },
"data": { "type": "array", "items": { "type": "object" } },
"pagination": {
"type": "object",
"properties": {
"page": { "type": "integer" },
"limit": { "type": "integer" },
"total": { "type": "integer" },
"totalPages": { "type": "integer" }
}
}
}
}
}
},
"paths": {
"/host": {
"get": {
"tags": ["Host - Onboarding"],
"summary": "Get all hosts",
"description": "Retrieve a list of all hosts with pagination",
"security": [{ "bearerAuth": [] }],
"parameters": [
{ "name": "page", "in": "query", "schema": { "type": "integer", "default": 1 } },
{ "name": "limit", "in": "query", "schema": { "type": "integer", "default": 10 } }
],
"responses": {
"200": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PaginatedResponse" } } } },
"401": { "description": "Unauthorized" }
}
}
},
"/host/Host_Admin/onboarding/registration": {
"post": {
"tags": ["Host - Onboarding"],
"summary": "Host Sign Up",
"description": "Register a new host account",
"requestBody": {
"required": true,
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/SignUpRequest" } } }
},
"responses": {
"201": { "description": "Host registered successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SuccessResponse" } } } },
"400": { "description": "Bad Request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }
}
}
},
"/host/Host_Admin/onboarding/verify-otp": {
"post": {
"tags": ["Host - Onboarding"],
"summary": "Verify OTP",
"description": "Verify OTP sent to host email",
"requestBody": {
"required": true,
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/VerifyOTPRequest" } } }
},
"responses": {
"200": { "description": "OTP verified successfully" },
"400": { "description": "Invalid OTP" }
}
}
},
"/host/Host_Admin/onboarding/login": {
"post": {
"tags": ["Host - Onboarding"],
"summary": "Host Login",
"description": "Authenticate host and get access tokens",
"requestBody": {
"required": true,
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/LoginRequest" } } }
},
"responses": {
"200": { "description": "Login successful", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LoginResponse" } } } },
"401": { "description": "Invalid credentials" }
}
}
},
"/host/Host_Admin/onboarding/create-password": {
"post": {
"tags": ["Host - Onboarding"],
"summary": "Create Password",
"description": "Create password after OTP verification",
"security": [{ "bearerAuth": [] }],
"requestBody": {
"required": true,
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreatePasswordRequest" } } }
},
"responses": {
"200": { "description": "Password created successfully" },
"400": { "description": "Password mismatch" }
}
}
},
"/host/Host_Admin/onboarding/add-payment-details": {
"post": {
"tags": ["Host - Onboarding"],
"summary": "Add Bank/Payment Details",
"description": "Add bank account details for host",
"security": [{ "bearerAuth": [] }],
"requestBody": {
"required": true,
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/BankDetailsRequest" } } }
},
"responses": {
"200": { "description": "Payment details added successfully" },
"400": { "description": "Invalid details" }
}
}
},
"/host/Host_Admin/onboarding/add-company-details": {
"patch": {
"tags": ["Host - Onboarding"],
"summary": "Submit Company Details",
"description": "Submit company information with documents",
"security": [{ "bearerAuth": [] }],
"requestBody": {
"required": true,
"content": { "multipart/form-data": { "schema": { "$ref": "#/components/schemas/CompanyDetailsRequest" } } }
},
"responses": {
"200": { "description": "Company details submitted successfully" }
}
}
},
"/host/Host_Admin/onboarding/accept-agreement": {
"patch": {
"tags": ["Host - Onboarding"],
"summary": "Accept Agreement",
"description": "Host accepts the terms and agreement",
"security": [{ "bearerAuth": [] }],
"responses": {
"200": { "description": "Agreement accepted" }
}
}
},
"/host/getById": {
"get": {
"tags": ["Host - Onboarding"],
"summary": "Get Host By ID",
"description": "Get host details by ID",
"security": [{ "bearerAuth": [] }],
"parameters": [
{ "name": "hostXid", "in": "query", "required": true, "schema": { "type": "integer" } }
],
"responses": {
"200": { "description": "Host details retrieved" },
"404": { "description": "Host not found" }
}
}
},
"/host/get-suggestion": {
"get": {
"tags": ["Host - Onboarding"],
"summary": "Show Suggestions",
"description": "Get suggestions for host",
"security": [{ "bearerAuth": [] }],
"responses": {
"200": { "description": "Suggestions retrieved" }
}
}
},
"/stepper": {
"get": {
"tags": ["Host - Onboarding"],
"summary": "Get Stepper Info",
"description": "Get onboarding stepper progress",
"security": [{ "bearerAuth": [] }],
"responses": {
"200": { "description": "Stepper info retrieved" }
}
}
},
"/resend-otp": {
"post": {
"tags": ["Host - Onboarding"],
"summary": "Resend OTP",
"description": "Resend OTP to email",
"requestBody": {
"required": true,
"content": { "application/json": { "schema": { "type": "object", "properties": { "emailAddress": { "type": "string", "format": "email" } } } } }
},
"responses": {
"200": { "description": "OTP sent successfully" }
}
}
},
"/host/Activity_Hub/OnBoarding/add-activity": {
"post": {
"tags": ["Host - Activity Hub"],
"summary": "Save Activity for PQQ",
"description": "Save new activity for pre-qualification questionnaire",
"security": [{ "bearerAuth": [] }],
"requestBody": {
"required": true,
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ActivityRequest" } } }
},
"responses": {
"200": { "description": "Activity saved successfully" }
}
}
},
"/host/Activity_Hub/OnBoarding/create-activity": {
"post": {
"tags": ["Host - Activity Hub"],
"summary": "Create Activity and Questions",
"description": "Create activity entry with all questions",
"security": [{ "bearerAuth": [] }],
"requestBody": {
"required": true,
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ActivityRequest" } } }
},
"responses": {
"200": { "description": "Activity created successfully" }
}
}
},
"/host/Activity_Hub/OnBoarding/get-pqq-question-details": {
"get": {
"tags": ["Host - Activity Hub"],
"summary": "Get PQQ By Question ID",
"description": "Get PQQ question details by ID",
"security": [{ "bearerAuth": [] }],
"parameters": [
{ "name": "questionXid", "in": "query", "required": true, "schema": { "type": "integer" } }
],
"responses": {
"200": { "description": "Question details retrieved" }
}
}
},
"/host/Activity_Hub/OnBoarding/get-latest-pqq-question-details": {
"get": {
"tags": ["Host - Activity Hub"],
"summary": "Get Latest PQQ Question",
"description": "Get the last updated PQQ question",
"security": [{ "bearerAuth": [] }],
"responses": {
"200": { "description": "Latest question retrieved" }
}
}
},
"/host/Activity_Hub/OnBoarding/prepopulate-new-activity": {
"get": {
"tags": ["Host - Activity Hub"],
"summary": "Prepopulate New Activity",
"description": "Get all activity types for prepopulation",
"security": [{ "bearerAuth": [] }],
"responses": {
"200": { "description": "Activity types retrieved" }
}
}
},
"/host/Activity_Hub/OnBoarding/get-all-host-activity": {
"get": {
"tags": ["Host - Activity Hub"],
"summary": "Get All Host Activities",
"description": "Get all activities for a host",
"security": [{ "bearerAuth": [] }],
"responses": {
"200": { "description": "Activities retrieved" }
}
}
},
"/host/Activity_Hub/OnBoarding/submit-pqq-answer": {
"patch": {
"tags": ["Host - Activity Hub"],
"summary": "Submit PQQ Answer",
"description": "Submit answer for PQQ question",
"security": [{ "bearerAuth": [] }],
"requestBody": {
"required": true,
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/PQQAnswerRequest" } } }
},
"responses": {
"200": { "description": "Answer submitted" }
}
}
},
"/host/Activity_Hub/OnBoarding/submit-pq-answer": {
"patch": {
"tags": ["Host - Activity Hub"],
"summary": "Submit PQ Answer",
"description": "Submit pre-qualification answer",
"security": [{ "bearerAuth": [] }],
"requestBody": {
"required": true,
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/PQQAnswerRequest" } } }
},
"responses": {
"200": { "description": "Answer submitted" }
}
}
},
"/host/Activity_Hub/OnBoarding/submit-final-pqq-answer": {
"post": {
"tags": ["Host - Activity Hub"],
"summary": "Submit Final PQQ Answer",
"description": "Submit final PQQ answer and get score",
"security": [{ "bearerAuth": [] }],
"responses": {
"200": { "description": "Final answer submitted" }
}
}
},
"/host/Activity_Hub/OnBoarding/submit-pqq-for-review": {
"patch": {
"tags": ["Host - Activity Hub"],
"summary": "Submit PQQ for Review",
"description": "Submit PQQ for admin review",
"security": [{ "bearerAuth": [] }],
"responses": {
"200": { "description": "Submitted for review" }
}
}
},
"/host/Activity_Hub/OnBoarding/get-all-pqq-ques-submited-ans": {
"get": {
"tags": ["Host - Activity Hub"],
"summary": "Get All PQQ with Submitted Answers",
"description": "Get all PQQ questions with submitted answers",
"security": [{ "bearerAuth": [] }],
"parameters": [
{ "name": "activityXid", "in": "query", "schema": { "type": "integer" } }
],
"responses": {
"200": { "description": "PQQ with answers retrieved" }
}
}
},
"/host/Activity_Hub/OnBoarding/update-suggestion-reviewed": {
"patch": {
"tags": ["Host - Activity Hub"],
"summary": "Update Suggestion as Reviewed",
"description": "Mark suggestion as reviewed by host",
"security": [{ "bearerAuth": [] }],
"responses": {
"200": { "description": "Suggestion marked as reviewed" }
}
}
},
"/minglaradmin/registration": {
"post": {
"tags": ["Minglar Admin - Auth"],
"summary": "Admin Registration",
"description": "Register a new Minglar admin",
"requestBody": {
"required": true,
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/SignUpRequest" } } }
},
"responses": {
"201": { "description": "Admin registered successfully" }
}
}
},
"/minglaradmin/login": {
"post": {
"tags": ["Minglar Admin - Auth"],
"summary": "Admin Login",
"description": "Authenticate Minglar admin",
"requestBody": {
"required": true,
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/LoginRequest" } } }
},
"responses": {
"200": { "description": "Login successful", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LoginResponse" } } } }
}
}
},
"/minglaradmin/create-password": {
"post": {
"tags": ["Minglar Admin - Auth"],
"summary": "Create Admin Password",
"description": "Create password for Minglar admin",
"security": [{ "bearerAuth": [] }],
"requestBody": {
"required": true,
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreatePasswordRequest" } } }
},
"responses": {
"200": { "description": "Password created" }
}
}
},
"/minglaradmin/update-profile": {
"patch": {
"tags": ["Minglar Admin - Auth"],
"summary": "Update Admin Profile",
"description": "Update Minglar admin profile with image",
"security": [{ "bearerAuth": [] }],
"requestBody": {
"content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "firstName": { "type": "string" }, "lastName": { "type": "string" }, "profileImage": { "type": "string", "format": "binary" } } } } }
},
"responses": {
"200": { "description": "Profile updated" }
}
}
},
"/minglaradmin/prepopulate-Roles": {
"get": {
"tags": ["Minglar Admin - Auth"],
"summary": "Prepopulate Roles",
"description": "Get all available roles",
"security": [{ "bearerAuth": [] }],
"responses": {
"200": { "description": "Roles retrieved" }
}
}
},
"/minglaradmin/hosthub/hosts/get-host-details/{host_xid}": {
"get": {
"tags": ["Minglar Admin - Host Hub"],
"summary": "Get Host Details By ID",
"description": "Get detailed host information for admin",
"security": [{ "bearerAuth": [] }],
"parameters": [
{ "name": "host_xid", "in": "path", "required": true, "schema": { "type": "integer" } }
],
"responses": {
"200": { "description": "Host details retrieved" }
}
}
},
"/minglaradmin/hosthub/hosts/get-all-host-applications-am": {
"get": {
"tags": ["Minglar Admin - Host Hub"],
"summary": "Get All Host Applications for AM",
"description": "Get all host applications for Account Manager",
"security": [{ "bearerAuth": [] }],
"parameters": [
{ "name": "page", "in": "query", "schema": { "type": "integer" } },
{ "name": "limit", "in": "query", "schema": { "type": "integer" } },
{ "name": "status", "in": "query", "schema": { "type": "string" } }
],
"responses": {
"200": { "description": "Applications retrieved" }
}
}
},
"/minglaradmin/get-all-activity-of-host/{id}": {
"get": {
"tags": ["Minglar Admin - Host Hub"],
"summary": "Get All Host Activities for Admin",
"description": "Get all activities of a specific host",
"security": [{ "bearerAuth": [] }],
"parameters": [
{ "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } }
],
"responses": {
"200": { "description": "Activities retrieved" }
}
}
},
"/minglaradmin/hosthub/onboarding/get-all-host-applications-admin": {
"get": {
"tags": ["Minglar Admin - Host Hub"],
"summary": "Get All Onboarding Host Applications",
"description": "Get all onboarding host applications for admin",
"security": [{ "bearerAuth": [] }],
"parameters": [
{ "name": "page", "in": "query", "schema": { "type": "integer" } },
{ "name": "limit", "in": "query", "schema": { "type": "integer" } }
],
"responses": {
"200": { "description": "Applications retrieved" }
}
}
},
"/minglaradmin/hosthub/onboarding/get-all-host-applications-admin-new": {
"get": {
"tags": ["Minglar Admin - Host Hub"],
"summary": "Get New Onboarding Applications",
"description": "Get new onboarding host applications",
"security": [{ "bearerAuth": [] }],
"responses": {
"200": { "description": "New applications retrieved" }
}
}
},
"/minglaradmin/hosthub/hosts/add-suggestion": {
"post": {
"tags": ["Minglar Admin - Host Hub"],
"summary": "Add Suggestion",
"description": "Add suggestion for host",
"security": [{ "bearerAuth": [] }],
"requestBody": {
"required": true,
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/SuggestionRequest" } } }
},
"responses": {
"200": { "description": "Suggestion added" }
}
}
},
"/minglaradmin/hosthub/onboarding/assign-am": {
"patch": {
"tags": ["Minglar Admin - Host Hub"],
"summary": "Assign AM to Host",
"description": "Assign Account Manager to host",
"security": [{ "bearerAuth": [] }],
"requestBody": {
"required": true,
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/AssignAMRequest" } } }
},
"responses": {
"200": { "description": "AM assigned" }
}
}
},
"/minglaradmin/hosthub/onboarding/edit-agreement-accept-host": {
"patch": {
"tags": ["Minglar Admin - Host Hub"],
"summary": "Edit Agreement and Accept Host",
"description": "Edit agreement details and accept host application",
"security": [{ "bearerAuth": [] }],
"responses": {
"200": { "description": "Agreement updated and host accepted" }
}
}
},
"/minglaradmin/hosthub/onboarding/get-all-pqq-ques-ans-for-am": {
"get": {
"tags": ["Minglar Admin - Host Hub"],
"summary": "Get All PQQ for AM",
"description": "Get all PQQ questions and answers for Account Manager",
"security": [{ "bearerAuth": [] }],
"parameters": [
{ "name": "activityXid", "in": "query", "schema": { "type": "integer" } },
{ "name": "hostXid", "in": "query", "schema": { "type": "integer" } }
],
"responses": {
"200": { "description": "PQQ retrieved" }
}
}
},
"/minglaradmin/hosthub/hosts/accept-host-application": {
"patch": {
"tags": ["Minglar Admin - Host Hub"],
"summary": "Accept Host Application",
"description": "Accept a host application",
"security": [{ "bearerAuth": [] }],
"requestBody": {
"content": { "application/json": { "schema": { "type": "object", "properties": { "hostXid": { "type": "integer" } } } } }
},
"responses": {
"200": { "description": "Application accepted" }
}
}
},
"/minglaradmin/hosthub/hosts/reject-pq-by-am/{activityId}": {
"patch": {
"tags": ["Minglar Admin - Host Hub"],
"summary": "Reject PQQ by AM",
"description": "Reject PQQ by Account Manager",
"security": [{ "bearerAuth": [] }],
"parameters": [
{ "name": "activityId", "in": "path", "required": true, "schema": { "type": "integer" } }
],
"requestBody": {
"content": { "application/json": { "schema": { "type": "object", "properties": { "reason": { "type": "string" } } } } }
},
"responses": {
"200": { "description": "PQQ rejected" }
}
}
},
"/minglaradmin/hosthub/hosts/accept-pq-by-am/{activityId}": {
"patch": {
"tags": ["Minglar Admin - Host Hub"],
"summary": "Accept PQ by AM",
"description": "Accept pre-qualification by Account Manager",
"security": [{ "bearerAuth": [] }],
"parameters": [
{ "name": "activityId", "in": "path", "required": true, "schema": { "type": "integer" } }
],
"responses": {
"200": { "description": "PQ accepted" }
}
}
},
"/minglaradmin/hosthub/onboarding/reject-host-application": {
"patch": {
"tags": ["Minglar Admin - Host Hub"],
"summary": "Reject Host Application",
"description": "Reject a host application by admin",
"security": [{ "bearerAuth": [] }],
"requestBody": {
"content": { "application/json": { "schema": { "type": "object", "properties": { "hostXid": { "type": "integer" }, "reason": { "type": "string" } } } } }
},
"responses": {
"200": { "description": "Application rejected" }
}
}
},
"/minglaradmin/hosthub/hosts/reject-host-application-am": {
"patch": {
"tags": ["Minglar Admin - Host Hub"],
"summary": "Reject Host Application by AM",
"description": "Reject host application by Account Manager",
"security": [{ "bearerAuth": [] }],
"responses": {
"200": { "description": "Application rejected" }
}
}
},
"/minglaradmin/hosthub/hosts/add-Pqq-suggestion": {
"post": {
"tags": ["Minglar Admin - Host Hub"],
"summary": "Add PQQ Suggestion",
"description": "Add suggestion for PQQ",
"security": [{ "bearerAuth": [] }],
"responses": {
"200": { "description": "Suggestion added" }
}
}
},
"/minglaradmin/hosthub/pqp/pqp-details-for-am/{activityXid}": {
"get": {
"tags": ["Minglar Admin - Host Hub"],
"summary": "Get PQP Details for AM",
"description": "Get pre-qualification profile details for Account Manager",
"security": [{ "bearerAuth": [] }],
"parameters": [
{ "name": "activityXid", "in": "path", "required": true, "schema": { "type": "integer" } }
],
"responses": {
"200": { "description": "PQP details retrieved" }
}
}
},
"/minglaradmin/settings/teammates/invite-teammate": {
"post": {
"tags": ["Minglar Admin - Settings"],
"summary": "Invite Teammate",
"description": "Invite a new teammate (co-admin or AM)",
"security": [{ "bearerAuth": [] }],
"requestBody": {
"required": true,
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/InviteTeammateRequest" } } }
},
"responses": {
"200": { "description": "Invitation sent" }
}
}
},
"/minglaradmin/settings/teammates/get-all-invitation-details": {
"get": {
"tags": ["Minglar Admin - Settings"],
"summary": "Get All Invitation Details",
"description": "Get all pending invitations",
"security": [{ "bearerAuth": [] }],
"responses": {
"200": { "description": "Invitations retrieved" }
}
}
},
"/minglaradmin/settings/teammates/get-all-coadmin-am": {
"get": {
"tags": ["Minglar Admin - Settings"],
"summary": "Get All Co-admin and AM",
"description": "Get all co-admins and account managers",
"security": [{ "bearerAuth": [] }],
"responses": {
"200": { "description": "Teammates retrieved" }
}
}
},
"/minglaradmin/settings/teammates/get-all-invited-coadmin-am": {
"get": {
"tags": ["Minglar Admin - Settings"],
"summary": "Get All Invited Co-admin and AM",
"description": "Get all invited co-admins and account managers",
"security": [{ "bearerAuth": [] }],
"responses": {
"200": { "description": "Invited teammates retrieved" }
}
}
},
"/minglaradmin/settings/teammates/get-am-details-by-id/{amXid}": {
"get": {
"tags": ["Minglar Admin - Settings"],
"summary": "Get AM Details by ID",
"description": "Get Account Manager details by ID",
"security": [{ "bearerAuth": [] }],
"parameters": [
{ "name": "amXid", "in": "path", "required": true, "schema": { "type": "integer" } }
],
"responses": {
"200": { "description": "AM details retrieved" }
}
}
},
"/prepopulate/get-all-bank-currency-details": {
"get": {
"tags": ["Prepopulate"],
"summary": "Get All Bank and Currency Details",
"description": "Get all bank and currency reference data",
"responses": {
"200": { "description": "Bank and currency details retrieved" }
}
}
},
"/prepopulate/get-city-by-state": {
"get": {
"tags": ["Prepopulate"],
"summary": "Get Cities by State",
"description": "Get all cities for a given state",
"parameters": [
{ "name": "stateXid", "in": "query", "required": true, "schema": { "type": "integer" } }
],
"responses": {
"200": { "description": "Cities retrieved" }
}
}
},
"/prepopulate/get-branch-by-bank": {
"get": {
"tags": ["Prepopulate"],
"summary": "Get Branches by Bank",
"description": "Get all branches for a given bank",
"parameters": [
{ "name": "bankXid", "in": "query", "required": true, "schema": { "type": "integer" } }
],
"responses": {
"200": { "description": "Branches retrieved" }
}
}
},
"/prepopulate/get-all-doc-country": {
"get": {
"tags": ["Prepopulate"],
"summary": "Get All Document Country State City Details",
"description": "Get all document types with country, state, city data",
"responses": {
"200": { "description": "Document details retrieved" }
}
}
},
"/prepopulate/get-all-pqq-ques-ans": {
"get": {
"tags": ["Prepopulate"],
"summary": "Get All PQQ Questions and Answers",
"description": "Get all PQQ questions with possible answers",
"responses": {
"200": { "description": "PQQ questions retrieved" }
}
}
},
"/prepopulate/get-all-Frequencies": {
"get": {
"tags": ["Prepopulate"],
"summary": "Get All Frequencies",
"description": "Get all activity frequencies",
"responses": {
"200": { "description": "Frequencies retrieved" }
}
}
}
}
}