16 Commits

Author SHA1 Message Date
paritosh18
3937be710b Merge branch 'paritosh-main1' of http://git.wdipl.com/Mayank.Mishra/MinglarBackendNestJS into swagger 2025-12-22 13:35:24 +05:30
cab4408dc8 Merge branch 'paritosh-main1' of http://git.wdipl.com/Mayank.Mishra/MinglarBackendNestJS into paritosh-main1 2025-12-22 13:33:11 +05:30
be65a6c021 Added seed for energy level 2025-12-22 13:33:10 +05:30
paritosh18
f13e90ce39 upated createNewActivity handler 2025-12-22 13:30:55 +05:30
paritosh18
5a223f126f creat activity handler 2025-12-21 17:28:08 +05:30
paritosh18
2e4f318684 Add CreateActivityDto and update createFullActivity method for activity creation 2025-12-18 20:05:30 +05:30
paritosh18
53785bd5f2 Add handler for creating full activity with related records 2025-12-18 19:37:32 +05:30
c9b507f969 Enhance rejection email content with clickable link for application access 2025-12-18 16:55:57 +05:30
91871d1f44 Enhance search filter to include company name and user reference number in host retrieval 2025-12-17 17:29:17 +05:30
05e48063c9 Add isActive check when retrieving user in loginForHost method 2025-12-17 16:57:18 +05:30
paritosh18
31c312eb3c Merge branch 'sprint1' of http://git.wdipl.com/Mayank.Mishra/MinglarBackendNestJS into swagger 2025-12-10 11:40:51 +05:30
paritosh18
f6e01ac9e3 Update CURL example and enhance Swagger documentation for admin profile update 2025-12-08 16:58:30 +05:30
paritosh18
76970c914e Merge branch 'swagger' of http://git.wdipl.com/Mayank.Mishra/MinglarBackendNestJS into swagger 2025-12-08 12:27:39 +05:30
paritosh18
61737235a4 Update Swagger documentation: refine request/response schemas, enhance descriptions, and adjust parameter requirements 2025-12-06 13:13:56 +05:30
paritosh18
844bbf9618 Merge branch 'sprint1' of http://git.wdipl.com/Mayank.Mishra/MinglarBackendNestJS into swagger 2025-12-06 12:37:19 +05:30
paritosh18
cdae23ec6c 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.
2025-12-05 20:35:46 +05:30
18 changed files with 3080 additions and 1165 deletions

View File

@@ -1,7 +1,7 @@
# CURL Command for Testing addCompanyDetails Lambda
## Prerequisites
1. Replace `YOUR_API_URL` with your actual API Gateway URL
1. Replace `YOUR_API_URL` with your actual API Gateway URL
2. Replace `YOUR_AUTH_TOKEN` with a valid JWT token
3. Replace file paths with actual document files on your system

28
package-lock.json generated
View File

@@ -75,6 +75,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 +6565,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 +8331,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 +8362,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 +8373,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 +9384,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 +9428,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 +9454,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 +9476,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 +9494,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 +9505,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 +9522,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 +9539,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 +9786,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 +10030,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 +10879,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 +12453,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 +12533,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 +12543,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 +12728,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 +12964,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 +14245,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 +14263,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 +14439,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 +14478,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 +15037,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 +15282,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 +17058,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

@@ -92,6 +92,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

@@ -67,6 +67,11 @@ model User {
userAddressDetails UserAddressDetails[]
userDocuments UserDocuments[]
activityTracks ActivityTrack[]
// 🔹 Activities created by this user
createdActivities Activities[] @relation("UserActivities")
// 🔹 Activities where this user is Account Manager
managedActivities Activities[] @relation("ActivityAccountManager")
@@map("users")
@@schema("usr")
@@ -394,12 +399,13 @@ model DocumentType {
}
model FoodCuisines {
id Int @id @default(autoincrement())
cuisineName String @unique @map("cuisine_name") @db.VarChar(30)
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
id Int @id @default(autoincrement())
cuisineName String @unique @map("cuisine_name") @db.VarChar(30)
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
activityCuisines ActivityCuisine[]
@@map("food_cuisines")
@@schema("mst")
@@ -434,13 +440,14 @@ model Amenities {
}
model FoodTypes {
id Int @id @default(autoincrement())
foodTypeName String @unique @map("food_type_name") @db.VarChar(30)
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
ActivityFoodDetails ActivityFoodDetails[]
id Int @id @default(autoincrement())
foodTypeName String @unique @map("food_type_name") @db.VarChar(30)
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
ActivityFoodCost ActivityFoodCost[]
activityFoodTypes ActivityFoodTypes[]
@@map("food_types")
@@schema("mst")
@@ -614,6 +621,7 @@ model EnergyLevels {
id Int @id @default(autoincrement())
energyLevelName String @map("energy_level_name") @db.VarChar(30)
energyIcon String @map("energy_icon") @db.VarChar(400)
energyColor String @map("energy_color") @db.VarChar(20)
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@ -844,38 +852,45 @@ model HostTrack {
// ACTIVITY MODELS
model Activities {
id Int @id @default(autoincrement())
hostXid Int @map("host_xid")
host HostHeader @relation(fields: [hostXid], references: [id], onDelete: Cascade)
activityTypeXid Int @map("activity_type_xid")
activityType ActivityTypes @relation(fields: [activityTypeXid], references: [id], onDelete: Restrict)
frequenciesXid Int? @map("frequencies_xid")
frequency Frequencies? @relation(fields: [frequenciesXid], references: [id], onDelete: Restrict)
activityRefNumber String? @map("activity_ref_number") @db.VarChar(30)
activityTitle String? @map("activity_title") @db.VarChar(30)
activityDescription String? @map("activity_description") @db.VarChar(80)
checkInLat Float? @map("check_in_lat")
checkInLong Float? @map("check_in_long")
checkInAddress String? @map("check_in_address") @db.VarChar(150)
isCheckOutSame Boolean? @default(true) @map("is_check_out_same")
checkOutLat Float? @map("check_out_lat")
checkOutLong Float? @map("check_out_long")
checkOutAddress String? @map("check_out_address") @db.VarChar(150)
energyLevelXid Int? @map("energy_level_xid")
energyLevel EnergyLevels? @relation(fields: [energyLevelXid], references: [id], onDelete: Restrict)
activityDurationMins Int? @map("activity_duration_mins")
foodAvailable Boolean? @default(false) @map("food_available")
foodIsChargeable Boolean? @default(false) @map("food_is_chargeable")
alcoholAvailable Boolean? @default(false) @map("alcohol_available")
trainerAvailable Boolean? @default(false) @map("trainer_available")
trainerIsChargeable Boolean? @default(false) @map("trainer_is_chargeable")
pickUpDropAvailable Boolean? @default(false) @map("pick_up_drop_available")
pickUpDropIsChargeable Boolean? @default(false) @map("pick_up_drop_is_chargeable")
inActivityAvailable Boolean? @default(false) @map("in_activity_available")
inActivityIsChargeable Boolean? @default(false) @map("in_activity_is_chargeable")
equipmentAvailable Boolean? @default(false) @map("equipment_available")
equipmentIsChargeable Boolean? @default(false) @map("equipment_is_chargeable")
cancellationAvailable Boolean? @default(false) @map("cancellation_available")
id Int @id @default(autoincrement())
hostXid Int @map("host_xid")
host HostHeader @relation(fields: [hostXid], references: [id], onDelete: Cascade)
activityTypeXid Int @map("activity_type_xid")
activityType ActivityTypes @relation(fields: [activityTypeXid], references: [id], onDelete: Restrict)
frequenciesXid Int? @map("frequencies_xid")
frequency Frequencies? @relation(fields: [frequenciesXid], references: [id], onDelete: Restrict)
activityRefNumber String? @map("activity_ref_number") @db.VarChar(30)
activityTitle String? @map("activity_title") @db.VarChar(30)
activityDescription String? @map("activity_description") @db.VarChar(255)
checkInLat Float? @map("check_in_lat")
checkInLong Float? @map("check_in_long")
checkInAddress String? @map("check_in_address") @db.VarChar(150)
isCheckOutSame Boolean? @default(true) @map("is_check_out_same")
checkOutLat Float? @map("check_out_lat")
checkOutLong Float? @map("check_out_long")
checkOutAddress String? @map("check_out_address") @db.VarChar(150)
energyLevelXid Int? @map("energy_level_xid")
energyLevel EnergyLevels? @relation(fields: [energyLevelXid], references: [id], onDelete: Restrict)
activityDurationMins Int? @map("activity_duration_mins")
foodAvailable Boolean? @default(false) @map("food_available")
foodIsChargeable Boolean? @default(false) @map("food_is_chargeable")
alcoholAvailable Boolean? @default(false) @map("alcohol_available")
trainerAvailable Boolean? @default(false) @map("trainer_available")
trainerIsChargeable Boolean? @default(false) @map("trainer_is_chargeable")
pickUpDropAvailable Boolean? @default(false) @map("pick_up_drop_available")
pickUpDropIsChargeable Boolean? @default(false) @map("pick_up_drop_is_chargeable")
inActivityAvailable Boolean? @default(false) @map("in_activity_available")
inActivityIsChargeable Boolean? @default(false) @map("in_activity_is_chargeable")
equipmentAvailable Boolean? @default(false) @map("equipment_available")
equipmentIsChargeable Boolean? @default(false) @map("equipment_is_chargeable")
cancellationAvailable Boolean? @default(false) @map("cancellation_available")
// 🔹 Creator / owner
userId Int?
user User? @relation("UserActivities", fields: [userId], references: [id])
// 🔹 Account Manager
accountManagerXid Int?
accountManager User? @relation("ActivityAccountManager", fields: [accountManagerXid], references: [id], onDelete: Restrict)
cancellationAllowedBeforeMins Int? @map("cancellation_allowed_before_mins")
currencyXid Int? @map("currency_xid")
currencies Currencies? @relation(fields: [currencyXid], references: [id], onDelete: Restrict)
@@ -898,19 +913,19 @@ model Activities {
ActivityEligibility ActivityEligibility[]
ActivitySuggestions ActivitySuggestions[]
ActivityAmDetails ActivityAmDetails[]
ActivityPrices ActivityPrices[]
ActivityVenueArtifacts ActivityVenueArtifacts[]
ActivityPQQheader ActivityPQQheader[]
ActivityAllowedEntry ActivityAllowedEntry[]
ActivityFoodDetails ActivityFoodDetails[]
ActivityFoodCost ActivityFoodCost[]
ActivityEquipments ActivityEquipments[]
ActivityNavigationModes ActivityNavigationModes[]
ActivityPickUpDetails ActivityPickUpDetails[]
ActivityAmenities ActivityAmenities[]
ActivityEquipmentTaxes ActivityEquipmentTaxes[]
ScheduleHeader ScheduleHeader[]
ItineraryActivities ItineraryActivities[]
activityTracks ActivityTrack[]
activityFoodTypes ActivityFoodTypes[]
activityCuisines ActivityCuisine[]
activityPickUpTransports ActivityPickUpTransport[]
@@map("activities")
@@schema("act")
@@ -920,8 +935,7 @@ model ActivityOtherDetails {
id Int @id @default(autoincrement())
activityXid Int @map("activity_xid")
activity Activities @relation(fields: [activityXid], references: [id], onDelete: Cascade)
foodCuisines String? @map("food_cuisines") @db.VarChar(30)
exclusiveNotes String? @map("exclusive_notes") @db.VarChar(50)
exclusiveNotes String? @map("exclusive_notes") @db.VarChar(500)
dosNotes String? @map("dos_notes") @db.VarChar(200)
dontsNotes String? @map("donts_notes") @db.VarChar(200)
tipsNotes String? @map("tips_notes") @db.VarChar(100)
@@ -987,6 +1001,8 @@ model ActivityVenues {
deletedAt DateTime? @map("deleted_at")
ScheduleHeader ScheduleHeader[]
ItineraryActivities ItineraryActivities[]
ActivityPrices ActivityPrices[] // <-- Added opposite relation
ActivityVenueArtifacts ActivityVenueArtifacts[] // <-- Added opposite relation
@@map("activity_venues")
@@schema("act")
@@ -1036,10 +1052,14 @@ model ActivityEligibility {
weightRestrictionName String? @map("weight_restriction_name") @db.VarChar(30)
weightEntered Int? @map("weight_entered")
weightIn String? @map("weight_in") @db.VarChar(30)
minWeight Int? @map("min_weight")
maxWeight Int? @map("max_weight")
isHeightRestriction Boolean @default(false) @map("is_height_restriction")
heightRestrictionName String? @map("height_restriction_name") @db.VarChar(30)
heightEntered Int? @map("height_entered")
heightIn String? @map("height_in") @db.VarChar(30)
minHeight Int? @map("min_height")
maxHeight Int? @map("max_height")
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@ -1086,7 +1106,7 @@ model ActivityAmDetails {
model ActivityPrices {
id Int @id @default(autoincrement())
activityVenueXid Int @map("activity_venue_xid")
activityVenue Activities @relation(fields: [activityVenueXid], references: [id], onDelete: Cascade)
activityVenue ActivityVenues @relation(fields: [activityVenueXid], references: [id], onDelete: Cascade)
noOfSession Int @map("no_of_session")
isPackage Boolean @default(false) @map("is_package")
sessionValidity Int @map("session_validity")
@@ -1123,7 +1143,7 @@ model ActivityPriceTaxes {
model ActivityVenueArtifacts {
id Int @id @default(autoincrement())
activityVenueXid Int @map("activity_venue_xid")
activityVenue Activities @relation(fields: [activityVenueXid], references: [id], onDelete: Cascade)
activityVenue ActivityVenues @relation(fields: [activityVenueXid], references: [id], onDelete: Cascade)
mediaType String @map("media_type") @db.VarChar(30)
mediaFileName String @map("media_file_name") @db.VarChar(400)
isActive Boolean @default(true) @map("is_active")
@@ -1204,12 +1224,10 @@ model ActivityAllowedEntry {
@@schema("act")
}
model ActivityFoodDetails {
model ActivityFoodCost {
id Int @id @default(autoincrement())
activityXid Int @map("activity_xid")
activity Activities @relation(fields: [activityXid], references: [id], onDelete: Cascade)
foodTypeXid Int @map("food_type_xid")
foodType FoodTypes @relation(fields: [foodTypeXid], references: [id], onDelete: Restrict)
baseAmount Int @map("base_amount")
totalAmount Int @map("total_amount")
isActive Boolean @default(true) @map("is_active")
@@ -1217,23 +1235,55 @@ model ActivityFoodDetails {
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
ActivityFoodTaxes ActivityFoodTaxes[]
foodTypes FoodTypes? @relation(fields: [foodTypesId], references: [id])
foodTypesId Int?
@@map("activity_food_details")
@@map("activity_food_cost")
@@schema("act")
}
model ActivityFoodTypes {
id Int @id @default(autoincrement())
activityXid Int @map("activity_xid")
activity Activities @relation(fields: [activityXid], references: [id], onDelete: Cascade)
foodTypeXid Int @map("food_type_xid")
foodType FoodTypes @relation(fields: [foodTypeXid], references: [id], onDelete: Restrict)
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
@@map("activity_food_types")
@@schema("act")
}
model ActivityCuisine {
id Int @id @default(autoincrement())
activityXid Int @map("activity_xid")
activity Activities @relation(fields: [activityXid], references: [id], onDelete: Cascade)
foodCuisineXid Int @map("food_cuisine_xid")
foodCuisine FoodCuisines @relation(fields: [foodCuisineXid], references: [id], onDelete: Restrict)
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
@@map("activity_cuisine")
@@schema("act")
}
model ActivityFoodTaxes {
id Int @id @default(autoincrement())
activityFoodDetailsXid Int @map("activity_food_details_xid")
activityFoodDetails ActivityFoodDetails @relation(fields: [activityFoodDetailsXid], references: [id], onDelete: Cascade)
taxXid Int @map("tax_xid")
taxes Taxes @relation(fields: [taxXid], references: [id], onDelete: Restrict)
taxPer Float @map("tax_per")
taxAmount Int @map("tax_amount")
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
id Int @id @default(autoincrement())
activityFoodCostXid Int @map("activity_food_cost_xid")
activityFoodCost ActivityFoodCost @relation(fields: [activityFoodCostXid], references: [id], onDelete: Cascade)
taxXid Int @map("tax_xid")
taxes Taxes @relation(fields: [taxXid], references: [id], onDelete: Restrict)
taxPer Float @map("tax_per")
taxAmount Int @map("tax_amount")
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
@@map("activity_food_taxes")
@@schema("act")
@@ -1251,6 +1301,7 @@ model ActivityEquipments {
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
ActivityEquipmentTaxes ActivityEquipmentTaxes[]
@@map("activity_equipments")
@@schema("act")
@@ -1259,7 +1310,7 @@ model ActivityEquipments {
model ActivityEquipmentTaxes {
id Int @id @default(autoincrement())
activityEquipmentXid Int @map("activity_equipment_xid")
activityEquipment Activities @relation(fields: [activityEquipmentXid], references: [id], onDelete: Cascade)
activityEquipment ActivityEquipments @relation(fields: [activityEquipmentXid], references: [id], onDelete: Cascade)
taxXid Int @map("tax_xid")
taxes Taxes @relation(fields: [taxXid], references: [id], onDelete: Restrict)
taxPer Float @map("tax_per")
@@ -1310,54 +1361,57 @@ model ActivityNavigationModesTaxes {
}
model ActivityPickUpDetails {
id Int @id @default(autoincrement())
activityXid Int @map("activity_xid")
activity Activities @relation(fields: [activityXid], references: [id], onDelete: Cascade)
isPickUp Boolean @default(false) @map("is_pick_up")
locationLat Float? @map("location_lat")
locationLong Float? @map("location_long")
locationAddress String? @map("location_address") @db.VarChar(150)
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
ActivityPickUpTransport ActivityPickUpTransport[]
@@map("activity_pick_up_details")
@@schema("act")
}
model ActivityPickUpTransport {
id Int @id @default(autoincrement())
activityPickUpDetailsXid Int @map("activity_pick_up_details_xid")
activityPickUpDetails ActivityPickUpDetails @relation(fields: [activityPickUpDetailsXid], references: [id], onDelete: Cascade)
transportModeXid Int @map("transport_mode_xid")
transportMode TransportModes @relation(fields: [transportModeXid], references: [id], onDelete: Restrict)
isTransportModeChargeable Boolean @default(false) @map("is_transport_mode_chargeable")
activityPickUpTransportXid Int @map("activity_pick_up_transport_xid")
activityPickUpTransport ActivityPickUpTransport @relation(fields: [activityPickUpTransportXid], references: [id], onDelete: Cascade)
isPickUp Boolean @default(false) @map("is_pick_up")
locationLat Float? @map("location_lat")
locationLong Float? @map("location_long")
locationAddress String? @map("location_address") @db.VarChar(150)
transportBasePrice Int @map("transport_base_price")
transportTotalPrice Int @map("transport_total_price")
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
ActivityPickUpTransportTaxes ActivityPickUpTransportTaxes[]
activities Activities? @relation(fields: [activitiesId], references: [id])
activitiesId Int?
activityPickUpTransportTaxes ActivityPickUpTransportTaxes[]
@@map("activity_pick_up_details")
@@schema("act")
}
model ActivityPickUpTransport {
id Int @id @default(autoincrement())
activityXid Int @map("activity_xid")
activity Activities @relation(fields: [activityXid], references: [id], onDelete: Cascade)
transportModeXid Int @map("transport_mode_xid")
transportMode TransportModes @relation(fields: [transportModeXid], references: [id], onDelete: Restrict)
isTransportModeChargeable Boolean @default(false) @map("is_transport_mode_chargeable")
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
pickupDetails ActivityPickUpDetails[]
@@map("activity_pick_up_transport")
@@schema("act")
}
model ActivityPickUpTransportTaxes {
id Int @id @default(autoincrement())
activityPickUpTransportXid Int @map("activity_pick_up_transport_xid")
activityPickUpTransport ActivityPickUpTransport @relation(fields: [activityPickUpTransportXid], references: [id], onDelete: Cascade)
taxXid Int @map("tax_xid")
taxes Taxes @relation(fields: [taxXid], references: [id], onDelete: Restrict)
taxPer Float @map("tax_per")
taxAmount Int @map("tax_amount")
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
id Int @id @default(autoincrement())
activityPickUpDetailsXid Int @map("activity_pick_up_details_xid")
activityPickUpDetails ActivityPickUpDetails @relation(fields: [activityPickUpDetailsXid], references: [id], onDelete: Cascade)
taxXid Int @map("tax_xid")
taxes Taxes @relation(fields: [taxXid], references: [id], onDelete: Restrict)
taxPer Float @map("tax_per")
taxAmount Int @map("tax_amount")
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
deletedAt DateTime? @map("deleted_at")
@@map("activity_pick_up_transport_taxes")
@@schema("act")

View File

@@ -223,6 +223,15 @@ async function main() {
],
skipDuplicates: true, // prevents error if already seeded
});
// ✅ Energy Levels
await prisma.energyLevels.createMany({
data: [
{ energyLevelName: 'Low', energyIcon: '📶', energyColor: 'Red' },
{ energyLevelName: 'Medium', energyIcon: '📶', energyColor: 'Yellow' },
{ energyLevelName: 'High', energyIcon: '📶', energyColor: 'Green' },
],
skipDuplicates: true, // prevents error if already seeded
});
// ✅ Company types data
await prisma.companyTypes.upsert({
@@ -260,7 +269,7 @@ async function main() {
update: {},
create: { companyTypeName: 'Non-Profit Organisation', displayOrder: 6 },
});
await prisma.companyTypes.upsert({
where: { companyTypeName: 'Public Limited' },
update: {},

View File

@@ -21,7 +21,8 @@ provider:
# Reference the layer defined in this stack using CloudFormation Ref
layers:
# Use the exported stack output so deploy function works (expects a string ARN)
- ${cf:${self:service}-${sls:stage}.PrismaLambdaLayerQualifiedArn}
# For offline/local, fall back to an empty string so the CF lookup is optional.
- ${cf:${self:service}-${sls:stage}.PrismaLambdaLayerQualifiedArn, ''}
apiGateway:
binaryMediaTypes:
- '*/*'
@@ -73,6 +74,8 @@ provider:
custom:
serverless-offline:
reloadHandler: true
httpPort: 3000
noPrependStageInUrl: true
build:
esbuild:
@@ -143,6 +146,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

@@ -177,6 +177,23 @@ prePopulateNewActivity:
path: /host/Activity_Hub/OnBoarding/prepopulate-new-activity
method: get
createNewActivity:
handler: src/modules/host/handlers/Activity_Hub/OnBoarding/CreateNewActivity.handler
memorySize: 1024
timeout: 30
package:
patterns:
- 'src/modules/host/handlers/Activity_Hub/OnBoarding/CreateNewActivity.*'
- 'src/modules/host/services/**'
- ${file(./serverless/patterns/base.yml):pattern1}
- ${file(./serverless/patterns/base.yml):pattern2}
- ${file(./serverless/patterns/base.yml):pattern3}
- ${file(./serverless/patterns/base.yml):pattern4}
events:
- httpApi:
path: /host/Activity_Hub/OnBoarding/create-new-activity
method: patch
showSuggestion:
handler: src/modules/host/handlers/Host_Admin/onboarding/showSuggestion.handler
memorySize: 384

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

View File

@@ -1,73 +1,100 @@
export const HOST_STATUS_INTERNAL = {
HOST_SUBMITTED: "Host Submitted",
HOST_TO_UPDATE: "Host To Update",
REJECTED: "Rejected",
APPROVED: "Approved",
DRAFT: "Draft",
}
HOST_SUBMITTED: 'Host Submitted',
HOST_TO_UPDATE: 'Host To Update',
REJECTED: 'Rejected',
APPROVED: 'Approved',
DRAFT: 'Draft',
};
export const HOST_STATUS_DISPLAY = {
DRAFT: "Draft",
UNDER_REVIEW: "Under Review",
ENHANCING: "Enhancing",
REJECTED: "Rejected",
APPROVED: "Approved",
}
DRAFT: 'Draft',
UNDER_REVIEW: 'Under Review',
ENHANCING: 'Enhancing',
REJECTED: 'Rejected',
APPROVED: 'Approved',
};
export const STEPPER = {
NOT_SUBMITTED: 1,
UNDER_REVIEW: 2,
COMPANY_DETAILS_APPROVED: 3,
BANK_DETAILS_UPDATED: 4,
AGREEMENT_ACCEPTED: 5,
REJECTED: 6
}
NOT_SUBMITTED: 1,
UNDER_REVIEW: 2,
COMPANY_DETAILS_APPROVED: 3,
BANK_DETAILS_UPDATED: 4,
AGREEMENT_ACCEPTED: 5,
REJECTED: 6,
};
export const ACTIVITY_INTERNAL_STATUS = {
DRAFT_PQ: 'Draft - PQ',
APPROVED: 'Approved',
REJECTED: 'Rejected',
DRAFT: 'Draft',
UNDER_REVIEW: 'Under-Review',
PQ_FAILED: 'PQ Failed',
PQ_TO_UPDATE: 'PQ To Update',
PQ_SUBMITTED: 'PQ Submitted',
PQ_APPROVED: 'PQ Approved'
}
DRAFT_PQ: 'Draft - PQ',
APPROVED: 'Approved',
REJECTED: 'Rejected',
DRAFT: 'Draft',
UNDER_REVIEW: 'Under-Review',
PQ_FAILED: 'PQ Failed',
PQ_TO_UPDATE: 'PQ To Update',
PQ_SUBMITTED: 'PQ Submitted',
PQ_APPROVED: 'PQ Approved',
ACTIVITY_DRAFT: 'Draft - Activity',
ACTIVITY_SUBMITTED: 'Activity Submitted',
ACTIVITY_TO_REVIEW: 'Activity To Review',
ACTIVITY_REJECTED: 'Activity Rejected',
ACTIVITY_APPROVED: 'Activity Approved',
ACTIVITY_LISTED: 'Activity Listed',
ACTIVITY_UNLISTED: 'Activity Un Listed By Host',
};
export const ACTIVITY_DISPLAY_STATUS = {
DRAFT_PQ: 'Draft - PQ',
APPROVED: 'Approved',
REJECTED: 'Rejected',
DRAFT: 'Draft',
UNDER_REVIEW: 'Under-Review',
PQ_FAILED: 'PQ Failed',
ENHANCING: 'Enchancing',
PQ_IN_REVIEW: 'PQ In Review',
PQ_APPROVED: 'PQ Approved'
}
DRAFT_PQ: 'Draft - PQ',
APPROVED: 'Approved',
REJECTED: 'Rejected',
DRAFT: 'Draft',
UNDER_REVIEW: 'Under-Review',
PQ_FAILED: 'PQ Failed',
ENHANCING: 'Enchancing',
PQ_IN_REVIEW: 'PQ In Review',
PQ_APPROVED: 'PQ Approved',
ACTIVITY_DRAFT: 'Draft - Activity',
ACTIVITY_IN_REVIEW: 'In Review',
ACTIVITY_TO_REVIEW: 'To Review',
ACTIVITY_NOT_LISTED: 'Not Listed',
ACTIVITY_LISTED: 'Listed',
ACTIVITY_UNLISTED: 'Un Listed',
};
export const ACTIVITY_AM_INTERNAL_STATUS = {
DRAFT_PQ: 'Draft - PQ',
APPROVED: 'Approved',
REJECTED: 'Rejected',
DRAFT: 'Draft',
UNDER_REVIEW: 'Under-Review',
PQ_FAILED: 'PQ Failed',
PQ_REJECTED: 'PQ Rejected',
PQ_TO_REVIEW: 'PQ To Review',
PQ_APPROVED: 'PQ Approved'
}
DRAFT_PQ: 'Draft - PQ',
APPROVED: 'Approved',
REJECTED: 'Rejected',
DRAFT: 'Draft',
UNDER_REVIEW: 'Under-Review',
PQ_FAILED: 'PQ Failed',
PQ_REJECTED: 'PQ Rejected',
PQ_TO_REVIEW: 'PQ To Review',
PQ_APPROVED: 'PQ Approved',
ACTIVITY_DRAFT: 'Draft - Activity',
ACTIVITY_TO_REVIEW: 'Activity To Review',
ACTIVITY_REJECTED: 'Activity Rejected',
ACTIVITY_APPROVED: 'Activity Approved',
ACTIVITY_LISTED: 'Activity Listed',
};
export const ACTIVITY_AM_DISPLAY_STATUS = {
DRAFT_PQ: 'Draft - PQ',
APPROVED: 'Approved',
REJECTED: 'Rejected',
DRAFT: 'Draft',
UNDER_REVIEW: 'Under-Review',
PQ_FAILED: 'PQ Failed',
ENHANCING: 'Enchancing',
NEW: 'New',
PQ_APPROVED: 'PQ Approved',
REVISED: 'Revised'
}
DRAFT_PQ: 'Draft - PQ',
APPROVED: 'Approved',
REJECTED: 'Rejected',
DRAFT: 'Draft',
UNDER_REVIEW: 'Under-Review',
PQ_FAILED: 'PQ Failed',
ENHANCING: 'Enchancing',
NEW: 'New',
PQ_APPROVED: 'PQ Approved',
REVISED: 'Revised',
ACTIVITY_DRAFT: 'Draft - Activity',
ACTIVITY_NEW: 'To Review',
ACTIVITY_ENHANCING: 'Enhancing',
ACTIVITY_NOT_LISTED: 'Not Listed',
ACTIVITY_LISTED: 'Listed',
};

View File

@@ -34,7 +34,10 @@ export const ACTIVITY_TRACK_STATUS = {
REJECTED_BY_AM: 'Rejected By AM',
ACCEPTED_BY_AM: 'Accepted By AM',
ENHANCING: 'Enhancing',
PQ_SUBMITTED: 'PQ Submitted'
PQ_SUBMITTED: 'PQ Submitted',
UNDER_REVIEW:'Under Review',
SUBMITTED:'Activity Submitted',
DRAFT:'Activity Draft'
}
// export const HOST_SUGGESTION_TITLES = {

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

@@ -0,0 +1,162 @@
import { z } from 'zod';
/* ================= MEDIA ================= */
export const MediaDto = z.object({
mediaType: z.string().optional(), // "image/jpeg", "video/mp4", etc.
mediaFileName: z.string(), // S3 file URL
});
/* ================= PRICE =================
* ❌ No tax info here; root-level only
*/
export const PriceDto = z.object({
noOfSession: z.number().int().optional().default(1),
isPackage: z.boolean().optional().default(false),
sessionValidity: z.number().int().optional().default(0),
sessionValidityFrequency: z.string().optional().default('Days'),
basePrice: z.number().int().optional().default(0),
sellPrice: z.number().int(), // required
});
/* ================= VENUE ================= */
export const VenueDto = z.object({
venueName: z.string(),
venueCapacity: z.number().int().optional().default(0),
availableSeats: z.number().int().optional().default(0),
isMinPeopleReqMandatory: z.boolean().optional().default(false),
minPeopleRequired: z.number().int().nullable().optional(),
minReqfullfilledBeforeMins: z.number().int().nullable().optional(),
venueDescription: z.string().optional(),
// ✅ new: media per venue (for ActivityVenueArtifacts)
media: z.array(MediaDto).optional().default([]),
// price list per venue
prices: z.array(PriceDto).optional().default([]),
});
/* ================= PICKUP / DROP ================= */
export const PickupDetailDto = z.object({
isPickUp: z.boolean().optional().default(false),
locationLat: z.number().nullable().optional(),
locationLong: z.number().nullable().optional(),
locationAddress: z.string().nullable().optional(),
transportBasePrice: z.number().int().optional().default(0),
transportTotalPrice: z.number().int().optional().default(0),
});
export const PickupTransportDto = z.object({
transportModeXid: z.number().int(),
isTransportModeChargeable: z.boolean().optional().default(false),
pickupDetails: z.array(PickupDetailDto).optional().default([]),
});
/* ================= EQUIPMENT ================= */
export const EquipmentDto = z.object({
equipmentName: z.string(),
isEquipmentChargeable: z.boolean().optional().default(false),
equipmentBasePrice: z.number().int().optional().default(0),
equipmentTotalPrice: z.number().int().optional().default(0),
});
/* ================= ELIGIBILITY ================= */
export const EligibilityDto = z.object({
isAgeRestriction: z.boolean().optional().default(false),
ageRestrictionXid: z.number().int().nullable().optional(),
isWeightRestriction: z.boolean().optional().default(false),
weightRestrictionName: z.string().nullable().optional(),
weightEntered: z.number().int().nullable().optional(),
weightIn: z.string().nullable().optional(),
minWeight: z.number().int().nullable().optional(),
maxWeight: z.number().int().nullable().optional(),
isHeightRestriction: z.boolean().optional().default(false),
heightRestrictionName: z.string().nullable().optional(),
heightEntered: z.number().int().nullable().optional(),
heightIn: z.string().nullable().optional(),
minHeight: z.number().int().nullable().optional(),
maxHeight: z.number().int().nullable().optional(),
});
/* ================= OTHER DETAILS ================= */
export const OtherDetailsDto = z.object({
exclusiveNotes: z.string().optional(),
dosNotes: z.string().optional(),
dontsNotes: z.string().optional(),
tipsNotes: z.string().optional(),
termsAndCondition: z.string().optional(),
});
/* ================= CREATE ACTIVITY ================= */
export const CreateActivityDto = z.object({
/* 🔑 REQUIRED */
activityXid: z.number().int(),
/* OPTIONAL CORE */
activityTypeXid: z.number().int().optional(),
frequenciesXid: z.number().int().nullable().optional(),
activityTitle: z.string().optional(),
activityDescription: z.string().optional(),
/* LOCATION */
checkInLat: z.number().nullable().optional(),
checkInLong: z.number().nullable().optional(),
checkInAddress: z.string().nullable().optional(),
isCheckOutSame: z.boolean().optional().default(true),
checkOutLat: z.number().nullable().optional(),
checkOutLong: z.number().nullable().optional(),
checkOutAddress: z.string().nullable().optional(),
/* DURATION / ENERGY */
energyLevelXid: z.number().int().nullable().optional(),
activityDurationMins: z.number().int().nullable().optional(),
durationHours: z.number().int().optional(),
durationMins: z.number().int().optional(),
/* FLAGS */
foodAvailable: z.boolean().optional().default(false),
foodIsChargeable: z.boolean().optional().default(false),
alcoholAvailable: z.boolean().optional().default(false),
trainerAvailable: z.boolean().optional().default(false),
trainerIsChargeable: z.boolean().optional().default(false),
pickUpDropAvailable: z.boolean().optional().default(false),
pickUpDropIsChargeable: z.boolean().optional().default(false),
inActivityAvailable: z.boolean().optional().default(false),
inActivityIsChargeable: z.boolean().optional().default(false),
equipmentAvailable: z.boolean().optional().default(false),
equipmentIsChargeable: z.boolean().optional().default(false),
cancellationAvailable: z.boolean().optional().default(false),
/* MONEY / CURRENCY */
currencyXid: z.number().int().nullable().optional(),
sustainabilityScore: z.number().int().nullable().optional(),
safetyScore: z.number().int().nullable().optional(),
isInstantBooking: z.boolean().optional().default(false),
/* 🔥 ROOT-LEVEL TAX (SINGLE SOURCE OF TRUTH) */
taxXids: z.array(z.number().int()).optional().default([]),
/* 🔥 MEDIA ARRAYS */
media: z.array(MediaDto).optional().default([]), // Activity-level media
venues: z.array(VenueDto).optional().default([]), // Each venues media + prices
/* RELATION ARRAYS */
foodTypeIds: z.array(z.number().int()).optional().default([]),
cuisineIds: z.array(z.number().int()).optional().default([]),
pickupTransports: z.array(PickupTransportDto).optional().default([]),
navigationModes: z.array(z.number().int()).optional().default([]),
equipments: z.array(EquipmentDto).optional().default([]),
amenitiesIds: z.array(z.number().int()).optional().default([]),
/* EXTRA OBJECTS */
eligibility: EligibilityDto.optional(),
otherDetails: OtherDetailsDto.optional(),
});
export type CreateActivityInput = z.infer<typeof CreateActivityDto>;

View File

@@ -0,0 +1,311 @@
import config from '../../../../../config/config';
import { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda';
import AWS from 'aws-sdk';
import Busboy from 'busboy';
import { prismaClient } from '../../../../../common/database/prisma.lambda.service';
import { verifyHostToken } from '../../../../../common/middlewares/jwt/authForHost';
import { safeHandler } from '../../../../../common/utils/handlers/safeHandler';
import ApiError from '../../../../../common/utils/helper/ApiError';
import {
CreateActivityDto,
CreateActivityInput,
} from '../../../dto/createActivity.schema';
import { HostService } from '../../../services/host.service';
const hostService = new HostService(prismaClient);
const s3 = new AWS.S3({ region: config.aws.region });
/* ------------------------------- Utilities ------------------------------- */
function getExtensionFromMime(mimeType: string) {
const map: Record<string, string> = {
'image/jpeg': 'jpg',
'image/png': 'png',
'image/webp': 'webp',
'video/mp4': 'mp4',
'video/quicktime': 'mov',
'video/x-msvideo': 'avi',
'video/x-matroska': 'mkv',
};
return map[mimeType] || 'bin';
}
function normalizeJsonField(fields: any, key: string) {
if (!fields[key]) return undefined;
if (typeof fields[key] === 'object') return fields[key];
try {
return JSON.parse(fields[key]);
} catch {
throw new ApiError(400, `Invalid JSON in field: ${key}`);
}
}
/* -------------------------------- Handler -------------------------------- */
export const handler = safeHandler(
async (event: APIGatewayProxyEvent): Promise<APIGatewayProxyResult> => {
/* 1⃣ AUTH */
const token =
event.headers['x-auth-token'] || event.headers['X-Auth-Token'];
if (!token) {
throw new ApiError(
401,
'This is a protected route. Please provide a valid token.',
);
}
const userInfo = await verifyHostToken(token);
/* 2⃣ CONTENT TYPE */
const contentType =
event.headers['content-type'] || event.headers['Content-Type'];
if (!contentType?.includes('multipart/form-data')) {
throw new ApiError(400, 'Content-Type must be multipart/form-data');
}
/* 3⃣ BODY BUFFER */
const bodyBuffer = event.isBase64Encoded
? Buffer.from(event.body as string, 'base64')
: Buffer.from(event.body as string);
const fields: Record<string, any> = {};
const files: Array<{
buffer: Buffer;
mimeType: string;
fileName: string;
fieldName: string;
}> = [];
await new Promise<void>((resolve, reject) => {
const bb = Busboy({
headers: {
...event.headers,
'content-type': contentType,
},
});
bb.on('field', (name, value) => {
fields[name] = value;
});
bb.on('file', (fieldName, file, info) => {
const { filename, mimeType } = info;
const chunks: Buffer[] = [];
let size = 0;
const MAX_SIZE = 5 * 1024 * 1024;
file.on('data', (chunk) => {
size += chunk.length;
if (size > MAX_SIZE) {
file.destroy(new Error('File exceeds 5MB limit'));
return;
}
chunks.push(chunk);
});
file.on('end', () => {
if (chunks.length > 0) {
files.push({
buffer: Buffer.concat(chunks),
mimeType: mimeType || 'application/octet-stream',
fileName: filename || 'unknown',
fieldName,
});
}
});
});
bb.on('finish', () => resolve());
bb.on('error', (err) => reject(new ApiError(400, err.message)));
bb.end(bodyBuffer);
});
/* 4⃣ FLAGS */
const isDraft = fields.isDraft === 'true' || fields.isDraft === true;
/* 5⃣ ACTIVITY PAYLOAD */
const activityPayload: any = normalizeJsonField(fields, 'activity');
if (!activityPayload) {
throw new ApiError(400, 'activity payload is required');
}
/* 6⃣ NORMALIZE IDS */
if (activityPayload.activityXid) {
activityPayload.activityXid = Number(activityPayload.activityXid);
}
const numberKeys = [
'currencyXid',
'energyLevelXid',
'activityDurationMins',
'activityTypeXid',
'frequenciesXid',
'trainerTotalAmount',
'pickupDropTotalPrice',
'navigationModeTotalPrice',
'sustainabilityScore',
'safetyScore',
'checkInLat',
'checkInLong',
'checkOutLat',
'checkOutLong',
];
for (const key of numberKeys) {
if (activityPayload[key] !== undefined && activityPayload[key] !== null && activityPayload[key] !== '') {
activityPayload[key] = Number(activityPayload[key]);
}
}
/* 7⃣ NORMALIZE BOOLEANS */
const booleanKeys = [
'isInstantBooking',
'foodAvailable',
'foodIsChargeable',
'alcoholAvailable',
'trainerAvailable',
'trainerIsChargeable',
'pickUpDropAvailable',
'pickUpDropIsChargeable',
'inActivityAvailable',
'inActivityIsChargeable',
'equipmentAvailable',
'equipmentIsChargeable',
'cancellationAvailable',
'isCheckOutSame',
];
for (const key of booleanKeys) {
if (activityPayload[key] === 'true') activityPayload[key] = true;
if (activityPayload[key] === 'false') activityPayload[key] = false;
}
/* 8⃣ UPLOAD ACTIVITY-LEVEL MEDIA (images/videos) */
const uploadedActivityMedia: Array<{ mediaType?: string; mediaFileName: string }> = [];
for (const file of files.filter(
(f) => f.fieldName === 'activityImages' || f.fieldName === 'activityVideos',
)) {
const s3Key = `ActivityOnboarding/Activity_${activityPayload.activityXid}/Media/${Date.now()}_${file.fileName}`;
if (s3Key.length > 900) {
throw new ApiError(400, 'Generated S3 key too long');
}
await s3
.upload({
Bucket: config.aws.bucketName,
Key: s3Key,
Body: file.buffer,
ContentType: file.mimeType,
ACL: 'private',
})
.promise();
uploadedActivityMedia.push({
mediaType: file.mimeType,
mediaFileName: `https://${config.aws.bucketName}.s3.${config.aws.region}.amazonaws.com/${s3Key}`,
});
}
/* 🔥 MERGE ACTIVITY MEDIA */
const existingMedia = Array.isArray(activityPayload.media)
? activityPayload.media
: [];
activityPayload.media = [...existingMedia, ...uploadedActivityMedia];
/* 9⃣ PROCESS VENUE MEDIA UPLOADS */
// Group venue files by index: venueImages[0], venueImages[1], etc.
const venueFilesMap: Map<number, Array<{ buffer: Buffer; mimeType: string; fileName: string }>> = new Map();
for (const file of files) {
// Match patterns like: venueImages[0], venueVideos[1], etc.
const match = file.fieldName.match(/^venue(Images|Videos)\[(\d+)\]$/);
if (match) {
const venueIndex = parseInt(match[2], 10);
if (!venueFilesMap.has(venueIndex)) {
venueFilesMap.set(venueIndex, []);
}
venueFilesMap.get(venueIndex)!.push(file);
}
}
// Upload venue files and attach to corresponding venues
if (Array.isArray(activityPayload.venues)) {
for (let i = 0; i < activityPayload.venues.length; i++) {
const venue = activityPayload.venues[i];
const venueFiles = venueFilesMap.get(i) || [];
const uploadedVenueMedia: Array<{ mediaType?: string; mediaFileName: string }> = [];
for (const file of venueFiles) {
const s3Key = `ActivityOnboarding/Activity_${activityPayload.activityXid}/Venue_${i}/Media/${Date.now()}_${file.fileName}`;
if (s3Key.length > 900) {
throw new ApiError(400, 'Generated S3 key too long for venue media');
}
await s3
.upload({
Bucket: config.aws.bucketName,
Key: s3Key,
Body: file.buffer,
ContentType: file.mimeType,
ACL: 'private',
})
.promise();
uploadedVenueMedia.push({
mediaType: file.mimeType,
mediaFileName: `https://${config.aws.bucketName}.s3.${config.aws.region}.amazonaws.com/${s3Key}`,
});
}
// Merge with existing venue media
const existingVenueMedia = Array.isArray(venue.media) ? venue.media : [];
venue.media = [...existingVenueMedia, ...uploadedVenueMedia];
}
}
/* 🔟 VALIDATION */
let parsedDto: CreateActivityInput;
if (!isDraft) {
const parsed = CreateActivityDto.safeParse(activityPayload);
if (!parsed.success) {
throw new ApiError(
400,
parsed.error.issues.map((i) => i.message).join(', '),
);
}
parsedDto = parsed.data;
} else {
parsedDto = activityPayload as CreateActivityInput;
}
/* 1⃣1⃣ SAVE ACTIVITY */
const createdActivity = await hostService.createOrUpdateActivity(
userInfo.id,
parsedDto,
isDraft,
);
/* 1⃣2⃣ RESPONSE */
return {
statusCode: 200,
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*',
},
body: JSON.stringify({
success: true,
message: isDraft
? 'Activity saved as draft successfully'
: 'Activity created successfully',
data: createdActivity,
}),
};
},
);

File diff suppressed because it is too large Load Diff

View File

@@ -748,21 +748,60 @@ export class MinglarService {
};
/** SEARCH FILTER **/
// if (search?.trim()) {
// const term = search.trim();
// if (/^\d+$/.test(term)) {
// filters.id = Number(term);
// } else {
// filters.user = {
// ...filters.user,
// OR: [
// { emailAddress: { contains: term, mode: 'insensitive' } },
// { firstName: { contains: term, mode: 'insensitive' } },
// { lastName: { contains: term, mode: 'insensitive' } },
// ],
// };
// }
// }
if (search?.trim()) {
const term = search.trim();
if (/^\d+$/.test(term)) {
filters.id = Number(term);
} else {
filters.user = {
...filters.user,
filters.AND = [
{
OR: [
{ emailAddress: { contains: term, mode: 'insensitive' } },
{ firstName: { contains: term, mode: 'insensitive' } },
{ lastName: { contains: term, mode: 'insensitive' } },
{
companyName: {
contains: term,
mode: 'insensitive',
},
},
{
user: {
OR: [
{
firstName: {
contains: term,
mode: 'insensitive',
},
},
{
lastName: {
contains: term,
mode: 'insensitive',
},
},
{
userRefNumber: {
contains: term,
mode: 'insensitive',
},
},
],
},
},
],
};
}
},
];
}
/** USER STATUS FILTER **/

View File

@@ -52,7 +52,11 @@ export async function sendAMRejectionMailtoHost(
<p> Your account manager has reviewed your application and provided some suggestions. <br/>
Please make the necessary improvements and re-submit your application to proceed with the onboarding process on Minglar.</p>
<p> You may access your application using the link below:<br/>
<strong>Link:</strong> ${config.HOST_LINK} </p>
<strong>Link:</strong>
<a href="${config.HOST_LINK}" target="_blank">
${config.HOST_LINK}
</a>
</p>
<p> If you have any questions, please feel free to contact the Minglar Support Team. </p>
<p> Best regards,<br/>
<strong>Minglar Team</strong> </p>

File diff suppressed because it is too large Load Diff