@7365admin1/core 2.52.0 → 2.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @iservice365/core
2
2
 
3
+ ## 2.54.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3aa4a97: get latest changes
8
+
9
+ ## 2.53.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 77eff04: release new/latest core package version (hot fix issue)
14
+
3
15
  ## 2.52.0
4
16
 
5
17
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -431,6 +431,7 @@ declare function useVerificationController(): {
431
431
  createServiceProviderInvite: (req: Request, res: Response, next: NextFunction) => Promise<void>;
432
432
  createForgetPassword: (req: Request, res: Response, next: NextFunction) => Promise<void>;
433
433
  verify: (req: Request, res: Response, next: NextFunction) => Promise<void>;
434
+ updateVerificationStatus: (req: Request, res: Response, next: NextFunction) => Promise<void>;
434
435
  cancelUserInvitation: (req: Request, res: Response, next: NextFunction) => Promise<void>;
435
436
  createSimpleUserInvite: (req: Request, res: Response, next: NextFunction) => Promise<void>;
436
437
  };
@@ -1854,7 +1855,8 @@ declare function useBuildingRepo(): {
1854
1855
  getById: (_id: string | ObjectId) => Promise<TBuilding | null>;
1855
1856
  updateById: (_id: ObjectId | string, value: Pick<TBuilding, "name" | "block" | "levels" | "buildingFiles">, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
1856
1857
  deleteById: (_id: string | ObjectId, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
1857
- getBuildingLevel: (site: string | ObjectId, block: number, isVMS: boolean) => Promise<bson.Document[] | TBuilding>;
1858
+ getBuildingLevel: (site: string | ObjectId, block: number) => Promise<mongodb.WithId<bson.Document> | TBuilding | null>;
1859
+ getBuildingLevelWithUnits: (site: string | ObjectId, block: number) => Promise<mongodb.WithId<bson.Document> | TBuilding>;
1858
1860
  };
1859
1861
 
1860
1862
  declare function useBuildingService(): {
@@ -1871,8 +1873,10 @@ declare function useBuildingController(): {
1871
1873
  deleteById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1872
1874
  getBuildingLevel: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1873
1875
  uploadSpreadsheetBuilding: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1876
+ getBuildingLevelWithUnits: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1874
1877
  };
1875
1878
 
1879
+ declare const building_units_namespace_collection = "building-units";
1876
1880
  declare function useBuildingUnitRepo(): {
1877
1881
  createIndexes: () => Promise<void>;
1878
1882
  add: (value: TBuildingUnit, session?: ClientSession) => Promise<ObjectId>;
@@ -1895,6 +1899,7 @@ declare function useBuildingUnitRepo(): {
1895
1899
  getBuildingUnits: (site: string | ObjectId, block: number, level: string) => Promise<{}>;
1896
1900
  getBuildingUnitsWithOwner: (site: string | ObjectId, unitIds?: ObjectId[]) => Promise<{}>;
1897
1901
  getUnitByBlockLevelUnitNumber: (block: number, level: string, unitNumber: string, site: string | ObjectId, session?: ClientSession) => Promise<TBuildingUnit>;
1902
+ getBySiteBuildingLevel: (site: string | ObjectId, block: number, level: string) => Promise<TBuildingUnit | null>;
1898
1903
  };
1899
1904
 
1900
1905
  declare function useBuildingUnitService(): {
@@ -6705,4 +6710,4 @@ declare function useRoleControllerV2(): {
6705
6710
  createRole: (req: Request, res: Response, next: NextFunction) => Promise<void>;
6706
6711
  };
6707
6712
 
6708
- export { ANPRMode, AccessTypeProps, AppServiceType, AssignCardConfig, BuildingStatus, BulkCardUpdate, BulletinOrder, BulletinRecipient, BulletinSort, BulletinStatus, BulletinVideoOrder, BulletinVideoSort, Camera, CameraType, DEVICE_STATUS, DOBStatus, DayOfWeek, EAccessCardTypes, EAccessCardUserTypes, EmailSender, EntryOrder, EntrySort, EventOrder, EventSort, EventStatus, EventType, FacilitySort, FacilityStatus, GuestSort, GuestStatus, IAccessCard, IAccessCardTransaction, MAccessCard, MAccessCardTransaction, MAddress, MAttendance, MAttendanceSettings, MBillingConfiguration, MBillingItem, MBuilding, MBuildingUnit, MBulletinBoard, MBulletinVideo, MChat, MCustomer, MCustomerSite, MDocumentManagement, MEntryPassSettings, MEventManagement, MFeedback, MFile, MGuestManagement, MIncidentReport, MManpowerDesignations, MManpowerMonitoring, MManpowerRemarks, MManpowerSites, MMember, MNfcPatrolLog, MNfcPatrolRoute, MNfcPatrolSettings, MNfcPatrolSettingsUpdate, MNfcPatrolTag, MOccurrenceBook, MOccurrenceEntry, MOccurrenceSubject, MOnlineForm, MOrg, MOvernightParkingApprovalHours, MOvernightParkingRequest, MPatrolLog, MPatrolQuestion, MPatrolRoute, MPerson, MPromoCode, MRobot, MRole, MRoleV2, MServiceProvider, MServiceProviderBilling, MSession, MSite, MSiteCamera, MSiteFacility, MSiteFacilityBooking, MStatementOfAccount, MSubscription, MUnitBilling, MUser, MVehicle, MVehicleTransaction, MVerification, MVerificationV2, MVisitorTransaction, MWorkOrder, OrgNature, OvernightParkingRequestSort, OvernightParkingRequestStatus, PERSON_TYPES, PMDashboardCollection, PStatus, Period, PersonStatus, PersonType, PersonTypes, QrTagProps, SiteAddress, SiteCategories, SiteStatus, SortFields, SortOrder, Status, SubjectOrder, SubjectSort, SubscriptionType, TAccessMngmntSettings, TActionStatus, TAddress, TAffectedEntities, TAffectedInjured, TAppServiceType, TApprovedBy, TApprover, TAttendance, TAttendanceCheckIn, TAttendanceCheckOut, TAttendanceCheckTime, TAttendanceLocation, TAttendanceSettings, TAttendanceSettingsGetBySite, TAuthorities, TAuthoritiesCalled, TBilling, TBillingConfiguration, TBillingItem, TBuilding, TBuildingUnit, TBulletinBoard, TBulletinVideo, TCamera, TChat, TCheckPoint$1 as TCheckPoint, TComplaintInfo, TComplaintReceivedTo, TCounter, TCustomer, TCustomerSite, TDayNumber, TDaySchedule, TDefaultAccessCard, TDesignations, TDocs, TDocumentManagement, TEntryPassSettings, TEventManagement, TFeedback, TFeedbackMetadata, TFeedbackUpdate, TFeedbackUpdateCategory, TFeedbackUpdateServiceProvider, TFeedbackUpdateStatus, TFeedbackUpdateToCompleted, TFile, TFiles, TGetAttendancesByUserQuery, TGetAttendancesQuery, TGuestManagement, TIncidentInformation, TIncidentReport, TIncidentTypeAndTime, TInvoice, TKeyRef, TManpowerDesignations, TManpowerDesignationsUpdate, TManpowerMonitoring, TManpowerMonitoringUpdate, TManpowerRemarks, TManpowerRemarksStatusUpdate, TManpowerRemarksUpdate, TManpowerSearchFilter, TManpowerSites, TMember, TMemberUpdateStatus, TMiniRole, TNfcPatrolLog, TNfcPatrolRoute, TNfcPatrolRouteEdit, TNfcPatrolSettings, TNfcPatrolSettingsGetBySite, TNfcPatrolSettingsUpdate, TNfcPatrolTag, TNfcPatrolTagConfigureReset, TNfcPatrolTagEdit, TNfcPatrolTagUpdateData, TOccurrenceBook, TOccurrenceEntry, TOccurrenceSubject, TOnlineForm, TOrg, TOvernightParkingApprovalHours, TOvernightParkingRequest, TPatrolLog, TPatrolQuestion, TPatrolRoute, TPerson, TPlaceOfIncident, TPlates, TPrice, TPriceType, TPromoCode, TPromoTier, TRecipientOfComplaint, TRemarks, TResident, TRobot, TRobotMetadata, TRole, TRoleV2, TRoute, TSOABillingItem, TSOAStatus, TServiceProvider, TServiceProviderBilling, TSession, TSessionCreate, TShifts, TSite, TSiteCamera, TSiteFacility, TSiteFacilityBooking, TSiteInfo, TSiteInformation, TSiteMetadata, TSiteUpdateBlock, TStatementOfAccount, TSubmissionForm, TSubscription, TUnitBilling, TUnits, TUpdateName, TUser, TUserCreate, TVehicle, TVehicleTransaction, TVehicleUpdate, TVerification, TVerificationMetadata, TVerificationMetadataV2, TVerificationV2, TVisitorTransaction, TWorkOrder, TWorkOrderMetadata, TWorkOrderUpdate, TWorkOrderUpdateStatus, TWorkOrderUpdateToCompleted, TanyoneDamageToProperty, UseAccessManagementRepo, UserStatus, VehicleCategory, VehicleOrder, VehicleSort, VehicleStatus, VehicleType, VerificationLinkType, VerificationStatus, VerificationSubjectType, VerificationType, VisitorSort, VisitorStatus, addressSchema, allowedFieldsSite, allowedNatures, attendanceSchema, attendanceSettingsSchema, buildings_namespace_collection, bulletin_boards_namespace_collection, calculatePercentage, chatSchema, createManpowerRemarksDaily, customerSchema, designationsSchema, events_namespace_collection, facility_bookings_namespace_collection, feedbackSchema, feedbacks2_namespace_collection, feedbacks_namespace_collection, formatDahuaDate, getPeriodRangeWithPrevious, guests_namespace_collection, incidentReport, incidentReportLog, incidents_namespace_collection, landscapeDashboardCollection, logCamera, mAndEDashboardCollection, manpowerDesignationsSchema, manpowerEvents, manpowerMonitoringSchema, manpowerRemarksSchema, manpowerSitesSchema, nfcPatrolSettingsSchema, nfcPatrolSettingsSchemaUpdate, occurrence_book_namespace_collection, orgSchema, overnight_parking_requests_namespace_collection, parseDahuaFind, pestDashboardCollection, poolDashboardCollection, promoCodeSchema, remarksSchema, robotSchema, schema, schemaApprovedBy, schemaApprover, schemaBilling, schemaBillingConfiguration, schemaBillingItem, schemaBuilding, schemaBuildingUnit, schemaBuildingUpdateOptions, schemaBulletinBoard, schemaBulletinVideo, schemaCustomerSite, schemaDocumentManagement, schemaEntryPassSettings, schemaEventManagement, schemaFiles, schemaGuestManagement, schemaIncidentReport, schemaNfcPatrolLog, schemaNfcPatrolRoute, schemaNfcPatrolTag, schemaNfcPatrolTagUpdateData, schemaOccurrenceBook, schemaOccurrenceEntry, schemaOccurrenceSubject, schemaOnlineForm, schemaOvernightParkingApprovalHours, schemaOvernightParkingRequest, schemaPatrolLog, schemaPatrolQuestion, schemaPatrolRoute, schemaPerson, schemaPlate, schemaServiceProvider, schemaServiceProviderBilling, schemaSiteCamera, schemaSiteFacility, schemaSiteFacilityBooking, schemaStatementOfAccount, schemaUnitBilling, schemaUpdateBulletinBoard, schemaUpdateBulletinVideo, schemaUpdateDocumentManagement, schemaUpdateEntryPassSettings, schemaUpdateEventManagement, schemaUpdateGuestManagement, schemaUpdateIncidentReport, schemaUpdateOccurrenceBook, schemaUpdateOccurrenceEntry, schemaUpdateOccurrenceSubject, schemaUpdateOnlineForm, schemaUpdateOptions, schemaUpdateOvernightParkingRequest, schemaUpdatePatrolLog, schemaUpdatePatrolQuestion, schemaUpdatePatrolRoute, schemaUpdatePerson, schemaUpdateServiceProviderBilling, schemaUpdateSiteBillingConfiguration, schemaUpdateSiteBillingItem, schemaUpdateSiteCamera, schemaUpdateSiteFacility, schemaUpdateSiteFacilityBooking, schemaUpdateSiteUnitBilling, schemaUpdateStatementOfAccount, schemaUpdateVisTrans, schemaVehicleTransaction, schemaVisitorTransaction, schemeCamera, schemeLogCamera, securityDashboardCollection, shiftSchema, siteSchema, site_people_namespace_collection, tokenSchema, updateRemarksStatusEod, updateRemarksisAcknowledged, updateSiteSchema, useAccessManagementController, useAddressRepo, useAttendanceController, useAttendanceRepository, useAttendanceSettingsController, useAttendanceSettingsRepository, useAttendanceSettingsService, useAuthController, useAuthControllerV2, useAuthService, useAuthServiceV2, useBuildingController, useBuildingRepo, useBuildingService, useBuildingUnitController, useBuildingUnitRepo, useBuildingUnitService, useBulletinBoardController, useBulletinBoardRepo, useBulletinBoardService, useBulletinVideoController, useBulletinVideoRepo, useBulletinVideoService, useChatController, useChatRepo, useCounterModel, useCounterRepo, useCustomerController, useCustomerRepo, useCustomerSiteController, useCustomerSiteRepo, useCustomerSiteService, useDahuaService, useDashboardController, useDashboardRepo, useDocumentManagementController, useDocumentManagementRepo, useDocumentManagementService, useEntryPassSettingsController, useEntryPassSettingsRepo, useEventManagementController, useEventManagementRepo, useEventManagementService, useFeedbackController, useFeedbackRepo, useFeedbackService, useFileController, useFileRepo, useFileService, useGuestManagementController, useGuestManagementRepo, useGuestManagementService, useHrmLabsAttendanceCtrl, useHrmLabsAttendanceSrvc, useIncidentReportController, useIncidentReportRepo, useIncidentReportService, useInvoiceController, useInvoiceModel, useInvoiceRepo, useManpowerDesignationCtrl, useManpowerDesignationRepo, useManpowerMonitoringCtrl, useManpowerMonitoringRepo, useManpowerMonitoringSrvc, useManpowerRemarkCtrl, useManpowerRemarksRepo, useManpowerSitesCtrl, useManpowerSitesRepo, useManpowerSitesSrvc, useMemberController, useMemberRepo, useNewDashboardController, useNewDashboardRepo, useNfcPatrolLogController, useNfcPatrolLogRepo, useNfcPatrolLogService, useNfcPatrolRouteController, useNfcPatrolRouteRepo, useNfcPatrolRouteService, useNfcPatrolSettingsController, useNfcPatrolSettingsRepository, useNfcPatrolSettingsService, useNfcPatrolTagController, useNfcPatrolTagRepo, useNfcPatrolTagService, useOccurrenceBookController, useOccurrenceBookRepo, useOccurrenceBookService, useOccurrenceEntryController, useOccurrenceEntryRepo, useOccurrenceEntryService, useOccurrenceSubjectController, useOccurrenceSubjectRepo, useOccurrenceSubjectService, useOnlineFormController, useOnlineFormRepo, useOrgController, useOrgRepo, useOvernightParkingController, useOvernightParkingRepo, useOvernightParkingRequestController, useOvernightParkingRequestRepo, useOvernightParkingRequestService, usePatrolLogController, usePatrolLogRepo, usePatrolQuestionController, usePatrolQuestionRepo, usePatrolRouteController, usePatrolRouteRepo, usePersonController, usePersonRepo, usePriceController, usePriceModel, usePriceRepo, usePromoCodeController, usePromoCodeRepo, useRedDotPaymentController, useRedDotPaymentRepo, useRedDotPaymentSvc, useRobotController, useRobotRepo, useRobotService, useRoleController, useRoleControllerV2, useRoleRepo, useRoleRepoV2, useRoleServiceV2, useServiceProviderBillingController, useServiceProviderBillingRepo, useServiceProviderBillingService, useServiceProviderController, useServiceProviderRepo, useSessionRepo, useSiteBillingConfigurationController, useSiteBillingConfigurationRepo, useSiteBillingItemController, useSiteBillingItemRepo, useSiteCameraController, useSiteCameraRepo, useSiteCameraService, useSiteController, useSiteFacilityBookingController, useSiteFacilityBookingRepo, useSiteFacilityBookingService, useSiteFacilityController, useSiteFacilityRepo, useSiteFacilityService, useSiteRepo, useSiteService, useSiteUnitBillingController, useSiteUnitBillingRepo, useSiteUnitBillingService, useStatementOfAccountController, useStatementOfAccountRepo, useSubscriptionController, useSubscriptionRepo, useSubscriptionService, useUserController, useUserControllerV2, useUserRepo, useUserRepoV2, useUserService, useUserServiceV2, useVehicleController, useVehicleRepo, useVehicleService, useVerificationController, useVerificationControllerV2, useVerificationRepo, useVerificationRepoV2, useVerificationService, useVerificationServiceV2, useVisitorTransactionController, useVisitorTransactionRepo, useVisitorTransactionService, useWorkOrderController, useWorkOrderRepo, useWorkOrderService, userSchema, vehicleSchema, vehicles_namespace_collection, visitors_namespace_collection, workOrderSchema, work_orders2_namespace_collection, work_orders_namespace_collection };
6713
+ export { ANPRMode, AccessTypeProps, AppServiceType, AssignCardConfig, BuildingStatus, BulkCardUpdate, BulletinOrder, BulletinRecipient, BulletinSort, BulletinStatus, BulletinVideoOrder, BulletinVideoSort, Camera, CameraType, DEVICE_STATUS, DOBStatus, DayOfWeek, EAccessCardTypes, EAccessCardUserTypes, EmailSender, EntryOrder, EntrySort, EventOrder, EventSort, EventStatus, EventType, FacilitySort, FacilityStatus, GuestSort, GuestStatus, IAccessCard, IAccessCardTransaction, MAccessCard, MAccessCardTransaction, MAddress, MAttendance, MAttendanceSettings, MBillingConfiguration, MBillingItem, MBuilding, MBuildingUnit, MBulletinBoard, MBulletinVideo, MChat, MCustomer, MCustomerSite, MDocumentManagement, MEntryPassSettings, MEventManagement, MFeedback, MFile, MGuestManagement, MIncidentReport, MManpowerDesignations, MManpowerMonitoring, MManpowerRemarks, MManpowerSites, MMember, MNfcPatrolLog, MNfcPatrolRoute, MNfcPatrolSettings, MNfcPatrolSettingsUpdate, MNfcPatrolTag, MOccurrenceBook, MOccurrenceEntry, MOccurrenceSubject, MOnlineForm, MOrg, MOvernightParkingApprovalHours, MOvernightParkingRequest, MPatrolLog, MPatrolQuestion, MPatrolRoute, MPerson, MPromoCode, MRobot, MRole, MRoleV2, MServiceProvider, MServiceProviderBilling, MSession, MSite, MSiteCamera, MSiteFacility, MSiteFacilityBooking, MStatementOfAccount, MSubscription, MUnitBilling, MUser, MVehicle, MVehicleTransaction, MVerification, MVerificationV2, MVisitorTransaction, MWorkOrder, OrgNature, OvernightParkingRequestSort, OvernightParkingRequestStatus, PERSON_TYPES, PMDashboardCollection, PStatus, Period, PersonStatus, PersonType, PersonTypes, QrTagProps, SiteAddress, SiteCategories, SiteStatus, SortFields, SortOrder, Status, SubjectOrder, SubjectSort, SubscriptionType, TAccessMngmntSettings, TActionStatus, TAddress, TAffectedEntities, TAffectedInjured, TAppServiceType, TApprovedBy, TApprover, TAttendance, TAttendanceCheckIn, TAttendanceCheckOut, TAttendanceCheckTime, TAttendanceLocation, TAttendanceSettings, TAttendanceSettingsGetBySite, TAuthorities, TAuthoritiesCalled, TBilling, TBillingConfiguration, TBillingItem, TBuilding, TBuildingUnit, TBulletinBoard, TBulletinVideo, TCamera, TChat, TCheckPoint$1 as TCheckPoint, TComplaintInfo, TComplaintReceivedTo, TCounter, TCustomer, TCustomerSite, TDayNumber, TDaySchedule, TDefaultAccessCard, TDesignations, TDocs, TDocumentManagement, TEntryPassSettings, TEventManagement, TFeedback, TFeedbackMetadata, TFeedbackUpdate, TFeedbackUpdateCategory, TFeedbackUpdateServiceProvider, TFeedbackUpdateStatus, TFeedbackUpdateToCompleted, TFile, TFiles, TGetAttendancesByUserQuery, TGetAttendancesQuery, TGuestManagement, TIncidentInformation, TIncidentReport, TIncidentTypeAndTime, TInvoice, TKeyRef, TManpowerDesignations, TManpowerDesignationsUpdate, TManpowerMonitoring, TManpowerMonitoringUpdate, TManpowerRemarks, TManpowerRemarksStatusUpdate, TManpowerRemarksUpdate, TManpowerSearchFilter, TManpowerSites, TMember, TMemberUpdateStatus, TMiniRole, TNfcPatrolLog, TNfcPatrolRoute, TNfcPatrolRouteEdit, TNfcPatrolSettings, TNfcPatrolSettingsGetBySite, TNfcPatrolSettingsUpdate, TNfcPatrolTag, TNfcPatrolTagConfigureReset, TNfcPatrolTagEdit, TNfcPatrolTagUpdateData, TOccurrenceBook, TOccurrenceEntry, TOccurrenceSubject, TOnlineForm, TOrg, TOvernightParkingApprovalHours, TOvernightParkingRequest, TPatrolLog, TPatrolQuestion, TPatrolRoute, TPerson, TPlaceOfIncident, TPlates, TPrice, TPriceType, TPromoCode, TPromoTier, TRecipientOfComplaint, TRemarks, TResident, TRobot, TRobotMetadata, TRole, TRoleV2, TRoute, TSOABillingItem, TSOAStatus, TServiceProvider, TServiceProviderBilling, TSession, TSessionCreate, TShifts, TSite, TSiteCamera, TSiteFacility, TSiteFacilityBooking, TSiteInfo, TSiteInformation, TSiteMetadata, TSiteUpdateBlock, TStatementOfAccount, TSubmissionForm, TSubscription, TUnitBilling, TUnits, TUpdateName, TUser, TUserCreate, TVehicle, TVehicleTransaction, TVehicleUpdate, TVerification, TVerificationMetadata, TVerificationMetadataV2, TVerificationV2, TVisitorTransaction, TWorkOrder, TWorkOrderMetadata, TWorkOrderUpdate, TWorkOrderUpdateStatus, TWorkOrderUpdateToCompleted, TanyoneDamageToProperty, UseAccessManagementRepo, UserStatus, VehicleCategory, VehicleOrder, VehicleSort, VehicleStatus, VehicleType, VerificationLinkType, VerificationStatus, VerificationSubjectType, VerificationType, VisitorSort, VisitorStatus, addressSchema, allowedFieldsSite, allowedNatures, attendanceSchema, attendanceSettingsSchema, building_units_namespace_collection, buildings_namespace_collection, bulletin_boards_namespace_collection, calculatePercentage, chatSchema, createManpowerRemarksDaily, customerSchema, designationsSchema, events_namespace_collection, facility_bookings_namespace_collection, feedbackSchema, feedbacks2_namespace_collection, feedbacks_namespace_collection, formatDahuaDate, getPeriodRangeWithPrevious, guests_namespace_collection, incidentReport, incidentReportLog, incidents_namespace_collection, landscapeDashboardCollection, logCamera, mAndEDashboardCollection, manpowerDesignationsSchema, manpowerEvents, manpowerMonitoringSchema, manpowerRemarksSchema, manpowerSitesSchema, nfcPatrolSettingsSchema, nfcPatrolSettingsSchemaUpdate, occurrence_book_namespace_collection, orgSchema, overnight_parking_requests_namespace_collection, parseDahuaFind, pestDashboardCollection, poolDashboardCollection, promoCodeSchema, remarksSchema, robotSchema, schema, schemaApprovedBy, schemaApprover, schemaBilling, schemaBillingConfiguration, schemaBillingItem, schemaBuilding, schemaBuildingUnit, schemaBuildingUpdateOptions, schemaBulletinBoard, schemaBulletinVideo, schemaCustomerSite, schemaDocumentManagement, schemaEntryPassSettings, schemaEventManagement, schemaFiles, schemaGuestManagement, schemaIncidentReport, schemaNfcPatrolLog, schemaNfcPatrolRoute, schemaNfcPatrolTag, schemaNfcPatrolTagUpdateData, schemaOccurrenceBook, schemaOccurrenceEntry, schemaOccurrenceSubject, schemaOnlineForm, schemaOvernightParkingApprovalHours, schemaOvernightParkingRequest, schemaPatrolLog, schemaPatrolQuestion, schemaPatrolRoute, schemaPerson, schemaPlate, schemaServiceProvider, schemaServiceProviderBilling, schemaSiteCamera, schemaSiteFacility, schemaSiteFacilityBooking, schemaStatementOfAccount, schemaUnitBilling, schemaUpdateBulletinBoard, schemaUpdateBulletinVideo, schemaUpdateDocumentManagement, schemaUpdateEntryPassSettings, schemaUpdateEventManagement, schemaUpdateGuestManagement, schemaUpdateIncidentReport, schemaUpdateOccurrenceBook, schemaUpdateOccurrenceEntry, schemaUpdateOccurrenceSubject, schemaUpdateOnlineForm, schemaUpdateOptions, schemaUpdateOvernightParkingRequest, schemaUpdatePatrolLog, schemaUpdatePatrolQuestion, schemaUpdatePatrolRoute, schemaUpdatePerson, schemaUpdateServiceProviderBilling, schemaUpdateSiteBillingConfiguration, schemaUpdateSiteBillingItem, schemaUpdateSiteCamera, schemaUpdateSiteFacility, schemaUpdateSiteFacilityBooking, schemaUpdateSiteUnitBilling, schemaUpdateStatementOfAccount, schemaUpdateVisTrans, schemaVehicleTransaction, schemaVisitorTransaction, schemeCamera, schemeLogCamera, securityDashboardCollection, shiftSchema, siteSchema, site_people_namespace_collection, tokenSchema, updateRemarksStatusEod, updateRemarksisAcknowledged, updateSiteSchema, useAccessManagementController, useAddressRepo, useAttendanceController, useAttendanceRepository, useAttendanceSettingsController, useAttendanceSettingsRepository, useAttendanceSettingsService, useAuthController, useAuthControllerV2, useAuthService, useAuthServiceV2, useBuildingController, useBuildingRepo, useBuildingService, useBuildingUnitController, useBuildingUnitRepo, useBuildingUnitService, useBulletinBoardController, useBulletinBoardRepo, useBulletinBoardService, useBulletinVideoController, useBulletinVideoRepo, useBulletinVideoService, useChatController, useChatRepo, useCounterModel, useCounterRepo, useCustomerController, useCustomerRepo, useCustomerSiteController, useCustomerSiteRepo, useCustomerSiteService, useDahuaService, useDashboardController, useDashboardRepo, useDocumentManagementController, useDocumentManagementRepo, useDocumentManagementService, useEntryPassSettingsController, useEntryPassSettingsRepo, useEventManagementController, useEventManagementRepo, useEventManagementService, useFeedbackController, useFeedbackRepo, useFeedbackService, useFileController, useFileRepo, useFileService, useGuestManagementController, useGuestManagementRepo, useGuestManagementService, useHrmLabsAttendanceCtrl, useHrmLabsAttendanceSrvc, useIncidentReportController, useIncidentReportRepo, useIncidentReportService, useInvoiceController, useInvoiceModel, useInvoiceRepo, useManpowerDesignationCtrl, useManpowerDesignationRepo, useManpowerMonitoringCtrl, useManpowerMonitoringRepo, useManpowerMonitoringSrvc, useManpowerRemarkCtrl, useManpowerRemarksRepo, useManpowerSitesCtrl, useManpowerSitesRepo, useManpowerSitesSrvc, useMemberController, useMemberRepo, useNewDashboardController, useNewDashboardRepo, useNfcPatrolLogController, useNfcPatrolLogRepo, useNfcPatrolLogService, useNfcPatrolRouteController, useNfcPatrolRouteRepo, useNfcPatrolRouteService, useNfcPatrolSettingsController, useNfcPatrolSettingsRepository, useNfcPatrolSettingsService, useNfcPatrolTagController, useNfcPatrolTagRepo, useNfcPatrolTagService, useOccurrenceBookController, useOccurrenceBookRepo, useOccurrenceBookService, useOccurrenceEntryController, useOccurrenceEntryRepo, useOccurrenceEntryService, useOccurrenceSubjectController, useOccurrenceSubjectRepo, useOccurrenceSubjectService, useOnlineFormController, useOnlineFormRepo, useOrgController, useOrgRepo, useOvernightParkingController, useOvernightParkingRepo, useOvernightParkingRequestController, useOvernightParkingRequestRepo, useOvernightParkingRequestService, usePatrolLogController, usePatrolLogRepo, usePatrolQuestionController, usePatrolQuestionRepo, usePatrolRouteController, usePatrolRouteRepo, usePersonController, usePersonRepo, usePriceController, usePriceModel, usePriceRepo, usePromoCodeController, usePromoCodeRepo, useRedDotPaymentController, useRedDotPaymentRepo, useRedDotPaymentSvc, useRobotController, useRobotRepo, useRobotService, useRoleController, useRoleControllerV2, useRoleRepo, useRoleRepoV2, useRoleServiceV2, useServiceProviderBillingController, useServiceProviderBillingRepo, useServiceProviderBillingService, useServiceProviderController, useServiceProviderRepo, useSessionRepo, useSiteBillingConfigurationController, useSiteBillingConfigurationRepo, useSiteBillingItemController, useSiteBillingItemRepo, useSiteCameraController, useSiteCameraRepo, useSiteCameraService, useSiteController, useSiteFacilityBookingController, useSiteFacilityBookingRepo, useSiteFacilityBookingService, useSiteFacilityController, useSiteFacilityRepo, useSiteFacilityService, useSiteRepo, useSiteService, useSiteUnitBillingController, useSiteUnitBillingRepo, useSiteUnitBillingService, useStatementOfAccountController, useStatementOfAccountRepo, useSubscriptionController, useSubscriptionRepo, useSubscriptionService, useUserController, useUserControllerV2, useUserRepo, useUserRepoV2, useUserService, useUserServiceV2, useVehicleController, useVehicleRepo, useVehicleService, useVerificationController, useVerificationControllerV2, useVerificationRepo, useVerificationRepoV2, useVerificationService, useVerificationServiceV2, useVisitorTransactionController, useVisitorTransactionRepo, useVisitorTransactionService, useWorkOrderController, useWorkOrderRepo, useWorkOrderService, userSchema, vehicleSchema, vehicles_namespace_collection, visitors_namespace_collection, workOrderSchema, work_orders2_namespace_collection, work_orders_namespace_collection };
package/dist/index.js CHANGED
@@ -155,6 +155,7 @@ __export(src_exports, {
155
155
  allowedNatures: () => allowedNatures,
156
156
  attendanceSchema: () => attendanceSchema,
157
157
  attendanceSettingsSchema: () => attendanceSettingsSchema,
158
+ building_units_namespace_collection: () => building_units_namespace_collection,
158
159
  buildings_namespace_collection: () => buildings_namespace_collection,
159
160
  bulletin_boards_namespace_collection: () => bulletin_boards_namespace_collection,
160
161
  calculatePercentage: () => calculatePercentage,
@@ -4485,12 +4486,13 @@ function useOrgRepo() {
4485
4486
  status = "active",
4486
4487
  nature = ""
4487
4488
  }) {
4488
- page = page > 0 ? page - 1 : 0;
4489
4489
  const query = { status };
4490
4490
  sort = Object.keys(sort).length > 0 ? sort : { _id: -1 };
4491
4491
  const cacheOptions = {
4492
4492
  status,
4493
- sort
4493
+ sort,
4494
+ page,
4495
+ limit
4494
4496
  };
4495
4497
  if (search) {
4496
4498
  query.$text = { $search: search };
@@ -4506,11 +4508,12 @@ function useOrgRepo() {
4506
4508
  import_node_server_utils17.logger.info(`Cache hit for key: ${cacheKey}`);
4507
4509
  return cachedData;
4508
4510
  }
4511
+ const normalizedPage = page > 0 ? page - 1 : 0;
4509
4512
  try {
4510
4513
  const items = await collection.aggregate([
4511
4514
  { $match: query },
4512
4515
  { $sort: sort },
4513
- { $skip: page * limit },
4516
+ { $skip: normalizedPage * limit },
4514
4517
  { $limit: limit },
4515
4518
  {
4516
4519
  $project: {
@@ -4524,7 +4527,7 @@ function useOrgRepo() {
4524
4527
  }
4525
4528
  ]).toArray();
4526
4529
  const length = await collection.countDocuments(query);
4527
- const data = (0, import_node_server_utils17.paginate)(items, page, limit, length);
4530
+ const data = (0, import_node_server_utils17.paginate)(items, normalizedPage, limit, length);
4528
4531
  setCache(cacheKey, data, 15 * 60).then(() => {
4529
4532
  import_node_server_utils17.logger.info(`Cache set for key: ${cacheKey}`);
4530
4533
  }).catch((err) => {
@@ -5658,11 +5661,16 @@ function useVerificationService() {
5658
5661
  const existing = await useVerificationRepo().findOne({
5659
5662
  type,
5660
5663
  email,
5661
- "metadata.org": metadata?.org,
5662
- "metadata.siteId": metadata?.siteId
5664
+ "metadata.app": metadata.app
5663
5665
  });
5664
- if (existing)
5666
+ if (existing) {
5667
+ if (existing.status === "complete") {
5668
+ throw new import_node_server_utils21.BadRequestError(
5669
+ `User already completed invite for app: ${metadata.app}`
5670
+ );
5671
+ }
5665
5672
  return existing._id;
5673
+ }
5666
5674
  const value = {
5667
5675
  type,
5668
5676
  email,
@@ -7894,6 +7902,7 @@ function useVerificationController() {
7894
7902
  createServiceProviderInvite: _createServiceProviderInvite,
7895
7903
  createForgetPassword: _createForgetPassword,
7896
7904
  verify: _verify,
7905
+ updateStatusById: _updateStatusById,
7897
7906
  cancelUserInvitation: _cancelUserInvitation
7898
7907
  } = useVerificationService();
7899
7908
  const { getVerifications: _getVerifications } = useVerificationRepo();
@@ -8107,6 +8116,28 @@ function useVerificationController() {
8107
8116
  return;
8108
8117
  }
8109
8118
  }
8119
+ async function updateVerificationStatus(req, res, next) {
8120
+ const validation = import_joi16.default.object({
8121
+ id: import_joi16.default.string().hex().required(),
8122
+ status: import_joi16.default.string().valid("pending", "complete", "expired", "cancelled").required()
8123
+ });
8124
+ const { error } = validation.validate(req.body);
8125
+ if (error) {
8126
+ import_node_server_utils32.logger.log({ level: "error", message: error.message });
8127
+ next(new import_node_server_utils32.BadRequestError(error.message));
8128
+ return;
8129
+ }
8130
+ try {
8131
+ const { id, status } = req.body;
8132
+ const result = await _updateStatusById(id, status);
8133
+ res.json({ message: result });
8134
+ return;
8135
+ } catch (error2) {
8136
+ import_node_server_utils32.logger.log({ level: "error", message: error2.message });
8137
+ next(error2);
8138
+ return;
8139
+ }
8140
+ }
8110
8141
  async function cancelUserInvitation(req, res, next) {
8111
8142
  const validation = import_joi16.default.string().hex().required();
8112
8143
  const otpId = req.params.id;
@@ -8134,6 +8165,7 @@ function useVerificationController() {
8134
8165
  createServiceProviderInvite,
8135
8166
  createForgetPassword,
8136
8167
  verify,
8168
+ updateVerificationStatus,
8137
8169
  cancelUserInvitation,
8138
8170
  createSimpleUserInvite
8139
8171
  };
@@ -13922,9 +13954,26 @@ function useVisitorTransactionRepo() {
13922
13954
  ...status && { status },
13923
13955
  ...tab == "Overnight Parking" && { isOvernightParking: true }
13924
13956
  };
13925
- sort = Object.keys(sort).length > 0 ? sort : { _id: -1 };
13957
+ sort = Object.keys(sort).length > 0 ? sort : { latestDate: -1 };
13926
13958
  try {
13927
- const basePipeline = [{ $match: query }];
13959
+ const basePipeline = [
13960
+ { $match: query },
13961
+ {
13962
+ $addFields: {
13963
+ latestDate: {
13964
+ $max: ["$createdAt", "$updatedAt"]
13965
+ }
13966
+ }
13967
+ },
13968
+ { $sort: { latestDate: -1 } },
13969
+ { $skip: skip },
13970
+ { $limit: limit },
13971
+ {
13972
+ $project: {
13973
+ latestDate: 0
13974
+ }
13975
+ }
13976
+ ];
13928
13977
  const [items, countResult] = await Promise.all([
13929
13978
  collection.aggregate([
13930
13979
  ...basePipeline,
@@ -14064,9 +14113,6 @@ function useVisitorTransactionRepo() {
14064
14113
  as: "passKeys"
14065
14114
  }
14066
14115
  },
14067
- { $sort: sort },
14068
- { $skip: skip },
14069
- { $limit: limit },
14070
14116
  {
14071
14117
  $lookup: {
14072
14118
  from: "users",
@@ -16044,14 +16090,16 @@ function MBuildingUnit(value) {
16044
16090
 
16045
16091
  // src/repositories/building-unit.repository.ts
16046
16092
  var import_mongodb45 = require("mongodb");
16093
+ var building_units_namespace_collection = "building-units";
16047
16094
  function useBuildingUnitRepo() {
16048
16095
  const db = import_node_server_utils73.useAtlas.getDb();
16049
16096
  if (!db) {
16050
16097
  throw new Error("Unable to connect to server.");
16051
16098
  }
16052
- const namespace_collection = "building-units";
16053
- const collection = db.collection(namespace_collection);
16054
- const { getCache, setCache, delNamespace, delCache } = (0, import_node_server_utils73.useCache)(namespace_collection);
16099
+ const collection = db.collection(building_units_namespace_collection);
16100
+ const { getCache, setCache, delNamespace, delCache } = (0, import_node_server_utils73.useCache)(
16101
+ building_units_namespace_collection
16102
+ );
16055
16103
  async function createIndexes() {
16056
16104
  try {
16057
16105
  await collection.createIndexes([
@@ -16077,12 +16125,12 @@ function useBuildingUnitRepo() {
16077
16125
  delNamespace().then(() => {
16078
16126
  import_node_server_utils73.logger.log({
16079
16127
  level: "info",
16080
- message: `Cache namespace cleared for ${namespace_collection}`
16128
+ message: `Cache namespace cleared for ${building_units_namespace_collection}`
16081
16129
  });
16082
16130
  }).catch((err) => {
16083
16131
  import_node_server_utils73.logger.log({
16084
16132
  level: "error",
16085
- message: `Failed to clear cache namespace for ${namespace_collection}: ${err.message}`
16133
+ message: `Failed to clear cache namespace for ${building_units_namespace_collection}: ${err.message}`
16086
16134
  });
16087
16135
  });
16088
16136
  }
@@ -16229,7 +16277,10 @@ function useBuildingUnitRepo() {
16229
16277
  ...building && { building },
16230
16278
  ...status && { status }
16231
16279
  };
16232
- const cacheKey = (0, import_node_server_utils73.makeCacheKey)(namespace_collection, cacheParams);
16280
+ const cacheKey = (0, import_node_server_utils73.makeCacheKey)(
16281
+ building_units_namespace_collection,
16282
+ cacheParams
16283
+ );
16233
16284
  import_node_server_utils73.logger.log({
16234
16285
  level: "info",
16235
16286
  message: `Cache key for getAll building units: ${cacheKey}`
@@ -16300,7 +16351,9 @@ function useBuildingUnitRepo() {
16300
16351
  } catch (error) {
16301
16352
  throw new import_node_server_utils73.BadRequestError("Invalid ID.");
16302
16353
  }
16303
- const cacheKey = (0, import_node_server_utils73.makeCacheKey)(namespace_collection, { _id: String(_id) });
16354
+ const cacheKey = (0, import_node_server_utils73.makeCacheKey)(building_units_namespace_collection, {
16355
+ _id: String(_id)
16356
+ });
16304
16357
  try {
16305
16358
  const cached = await getCache(cacheKey);
16306
16359
  if (cached) {
@@ -16343,7 +16396,7 @@ function useBuildingUnitRepo() {
16343
16396
  } catch (error) {
16344
16397
  throw new import_node_server_utils73.BadRequestError("Invalid building ID.");
16345
16398
  }
16346
- const cacheKey = (0, import_node_server_utils73.makeCacheKey)(namespace_collection, {
16399
+ const cacheKey = (0, import_node_server_utils73.makeCacheKey)(building_units_namespace_collection, {
16347
16400
  building: String(building),
16348
16401
  level
16349
16402
  });
@@ -16417,7 +16470,7 @@ function useBuildingUnitRepo() {
16417
16470
  } catch (error) {
16418
16471
  throw new import_node_server_utils73.BadRequestError("Invalid building ID.");
16419
16472
  }
16420
- const cacheKey = (0, import_node_server_utils73.makeCacheKey)(namespace_collection, {
16473
+ const cacheKey = (0, import_node_server_utils73.makeCacheKey)(building_units_namespace_collection, {
16421
16474
  building: String(building)
16422
16475
  });
16423
16476
  try {
@@ -16491,7 +16544,10 @@ function useBuildingUnitRepo() {
16491
16544
  block,
16492
16545
  level
16493
16546
  };
16494
- const cacheKey = (0, import_node_server_utils73.makeCacheKey)(namespace_collection, cacheOptions);
16547
+ const cacheKey = (0, import_node_server_utils73.makeCacheKey)(
16548
+ building_units_namespace_collection,
16549
+ cacheOptions
16550
+ );
16495
16551
  const cachedData = await getCache(cacheKey);
16496
16552
  if (cachedData) {
16497
16553
  import_node_server_utils73.logger.info(`Cache hit for key: ${cacheKey}`);
@@ -16529,7 +16585,10 @@ function useBuildingUnitRepo() {
16529
16585
  const cacheOptions = {
16530
16586
  site: site.toString()
16531
16587
  };
16532
- const cacheKey = (0, import_node_server_utils73.makeCacheKey)(namespace_collection, cacheOptions);
16588
+ const cacheKey = (0, import_node_server_utils73.makeCacheKey)(
16589
+ building_units_namespace_collection,
16590
+ cacheOptions
16591
+ );
16533
16592
  const cachedData = await getCache(cacheKey);
16534
16593
  if (cachedData) {
16535
16594
  import_node_server_utils73.logger.info(`Cache hit for key: ${cacheKey}`);
@@ -16577,7 +16636,10 @@ function useBuildingUnitRepo() {
16577
16636
  { deletedAt: "" }
16578
16637
  ]
16579
16638
  };
16580
- const cacheKey = (0, import_node_server_utils73.makeCacheKey)(namespace_collection, cacheOptions);
16639
+ const cacheKey = (0, import_node_server_utils73.makeCacheKey)(
16640
+ building_units_namespace_collection,
16641
+ cacheOptions
16642
+ );
16581
16643
  try {
16582
16644
  const cached = await getCache(cacheKey);
16583
16645
  if (cached) {
@@ -16613,6 +16675,54 @@ function useBuildingUnitRepo() {
16613
16675
  }
16614
16676
  }
16615
16677
  }
16678
+ async function getBySiteBuildingLevel(site, block, level) {
16679
+ try {
16680
+ site = new import_mongodb45.ObjectId(site);
16681
+ } catch (error) {
16682
+ throw new import_node_server_utils73.BadRequestError("Invalid site ID.");
16683
+ }
16684
+ const cacheKey = (0, import_node_server_utils73.makeCacheKey)(building_units_namespace_collection, {
16685
+ site: site.toString(),
16686
+ block,
16687
+ level
16688
+ });
16689
+ try {
16690
+ const cached = await getCache(cacheKey);
16691
+ if (cached) {
16692
+ import_node_server_utils73.logger.log({
16693
+ level: "info",
16694
+ message: `Cache hit for getById building unit: ${cacheKey}`
16695
+ });
16696
+ return cached;
16697
+ }
16698
+ const query = {
16699
+ site,
16700
+ block,
16701
+ level,
16702
+ status: "active"
16703
+ };
16704
+ console.log(query);
16705
+ const result = await collection.findOne(query);
16706
+ setCache(cacheKey, result, 300).then(() => {
16707
+ import_node_server_utils73.logger.log({
16708
+ level: "info",
16709
+ message: `Cache set for building unit by id: ${cacheKey}`
16710
+ });
16711
+ }).catch((err) => {
16712
+ import_node_server_utils73.logger.log({
16713
+ level: "error",
16714
+ message: `Failed to set cache for building unit by id: ${err.message}`
16715
+ });
16716
+ });
16717
+ return result;
16718
+ } catch (error) {
16719
+ if (error instanceof import_node_server_utils73.AppError) {
16720
+ throw error;
16721
+ } else {
16722
+ throw new import_node_server_utils73.InternalServerError("Failed to get building unit.");
16723
+ }
16724
+ }
16725
+ }
16616
16726
  return {
16617
16727
  createIndexes,
16618
16728
  add,
@@ -16626,7 +16736,8 @@ function useBuildingUnitRepo() {
16626
16736
  updateByBuildingId,
16627
16737
  getBuildingUnits,
16628
16738
  getBuildingUnitsWithOwner,
16629
- getUnitByBlockLevelUnitNumber
16739
+ getUnitByBlockLevelUnitNumber,
16740
+ getBySiteBuildingLevel
16630
16741
  };
16631
16742
  }
16632
16743
 
@@ -19288,6 +19399,7 @@ function useBuildingRepo() {
19288
19399
  throw new Error("Failed to create index on buildings. " + error.message);
19289
19400
  }
19290
19401
  }
19402
+ const { getBySiteBuildingLevel: _getBySiteBuildingLevel } = useBuildingUnitRepo();
19291
19403
  async function add(value, session) {
19292
19404
  try {
19293
19405
  value = MBuilding(value);
@@ -19481,7 +19593,7 @@ function useBuildingRepo() {
19481
19593
  }
19482
19594
  }
19483
19595
  }
19484
- async function getBuildingLevel(site, block, isVMS) {
19596
+ async function getBuildingLevel(site, block) {
19485
19597
  try {
19486
19598
  site = new import_mongodb49.ObjectId(site);
19487
19599
  } catch (error) {
@@ -19491,7 +19603,8 @@ function useBuildingRepo() {
19491
19603
  site,
19492
19604
  block
19493
19605
  };
19494
- const cacheKey = (0, import_node_server_utils82.makeCacheKey)(buildings_namespace_collection, { ...query, isVMS });
19606
+ const cacheOptions = { ...query };
19607
+ const cacheKey = (0, import_node_server_utils82.makeCacheKey)(buildings_namespace_collection, cacheOptions);
19495
19608
  try {
19496
19609
  const cached = await getCache(cacheKey);
19497
19610
  if (cached) {
@@ -19501,24 +19614,65 @@ function useBuildingRepo() {
19501
19614
  });
19502
19615
  return cached;
19503
19616
  }
19504
- const pipeline = [{ $match: { ...query } }];
19505
- if (isVMS) {
19506
- pipeline.push({
19507
- $lookup: {
19508
- from: "building-levels",
19509
- let: { id: "$_id" },
19510
- pipeline: [
19511
- {
19512
- $match: {
19513
- $expr: { $eq: ["$block", "$$id"] }
19514
- }
19515
- }
19516
- ],
19517
- as: "building_levels"
19518
- }
19617
+ const result = await collection.findOne(query);
19618
+ setCache(cacheKey, result, 300).then(() => {
19619
+ import_node_server_utils82.logger.log({
19620
+ level: "info",
19621
+ message: `Cache set for building by id: ${cacheKey}`
19519
19622
  });
19623
+ }).catch((err) => {
19624
+ import_node_server_utils82.logger.log({
19625
+ level: "error",
19626
+ message: `Failed to set cache for building by id: ${err.message}`
19627
+ });
19628
+ });
19629
+ return result;
19630
+ } catch (error) {
19631
+ if (error instanceof import_node_server_utils82.AppError) {
19632
+ throw error;
19633
+ } else {
19634
+ throw new import_node_server_utils82.InternalServerError("Failed to get building.");
19520
19635
  }
19521
- const result = await collection.aggregate(pipeline).toArray();
19636
+ }
19637
+ }
19638
+ async function getBuildingLevelWithUnits(site, block) {
19639
+ try {
19640
+ site = new import_mongodb49.ObjectId(site);
19641
+ } catch (error) {
19642
+ throw new import_node_server_utils82.BadRequestError("Invalid ID.");
19643
+ }
19644
+ const query = {
19645
+ site,
19646
+ block
19647
+ };
19648
+ const cacheOptions = { ...query };
19649
+ const cacheKey = (0, import_node_server_utils82.makeCacheKey)(buildings_namespace_collection, cacheOptions);
19650
+ try {
19651
+ const cached = await getCache(cacheKey);
19652
+ if (cached) {
19653
+ import_node_server_utils82.logger.log({
19654
+ level: "info",
19655
+ message: `Cache hit for getById building: ${cacheKey}`
19656
+ });
19657
+ return cached;
19658
+ }
19659
+ const result = await collection.findOne(query);
19660
+ if (!result) {
19661
+ throw new import_node_server_utils82.BadRequestError("Building not found.");
19662
+ }
19663
+ const validLevels = [];
19664
+ for (const level of result.levels ?? []) {
19665
+ const units = await _getBySiteBuildingLevel(
19666
+ result.site,
19667
+ result.block,
19668
+ level
19669
+ );
19670
+ if (units) {
19671
+ validLevels.push(level);
19672
+ }
19673
+ }
19674
+ result.levels = validLevels;
19675
+ console.log(result);
19522
19676
  setCache(cacheKey, result, 300).then(() => {
19523
19677
  import_node_server_utils82.logger.log({
19524
19678
  level: "info",
@@ -19559,7 +19713,8 @@ function useBuildingRepo() {
19559
19713
  getById,
19560
19714
  updateById,
19561
19715
  deleteById,
19562
- getBuildingLevel
19716
+ getBuildingLevel,
19717
+ getBuildingLevelWithUnits
19563
19718
  };
19564
19719
  }
19565
19720
 
@@ -19713,7 +19868,8 @@ function useBuildingController() {
19713
19868
  const {
19714
19869
  getAll: _getAll,
19715
19870
  getById: _getById,
19716
- getBuildingLevel: _getBuildingLevel
19871
+ getBuildingLevel: _getBuildingLevel,
19872
+ getBuildingLevelWithUnits: _getBuildingLevelWithUnits
19717
19873
  } = useBuildingRepo();
19718
19874
  const {
19719
19875
  updateById: _updateById,
@@ -19853,7 +20009,6 @@ function useBuildingController() {
19853
20009
  async function getBuildingLevel(req, res, next) {
19854
20010
  const site = req.params.site ?? "";
19855
20011
  let block = req.query.block;
19856
- const isVMS = req.query.isVMS;
19857
20012
  const validation = import_joi44.default.object({
19858
20013
  site: import_joi44.default.string().hex().required(),
19859
20014
  block: import_joi44.default.number().required()
@@ -19865,7 +20020,7 @@ function useBuildingController() {
19865
20020
  }
19866
20021
  block = parseInt(block) ?? 0;
19867
20022
  try {
19868
- const siteBlock = await _getBuildingLevel(site, block, isVMS);
20023
+ const siteBlock = await _getBuildingLevel(site, block);
19869
20024
  res.json(siteBlock);
19870
20025
  return;
19871
20026
  } catch (error2) {
@@ -19983,6 +20138,27 @@ function useBuildingController() {
19983
20138
  next(error);
19984
20139
  }
19985
20140
  }
20141
+ async function getBuildingLevelWithUnits(req, res, next) {
20142
+ const site = req.params.site ?? "";
20143
+ let block = req.query.block;
20144
+ const validation = import_joi44.default.object({
20145
+ site: import_joi44.default.string().hex().required(),
20146
+ block: import_joi44.default.number().required()
20147
+ });
20148
+ const { error } = validation.validate({ site, block });
20149
+ if (error) {
20150
+ next(new import_node_server_utils84.BadRequestError(error.message));
20151
+ return;
20152
+ }
20153
+ block = parseInt(block) ?? 0;
20154
+ try {
20155
+ const siteBlock = await _getBuildingLevelWithUnits(site, block);
20156
+ res.json(siteBlock);
20157
+ return;
20158
+ } catch (error2) {
20159
+ next(error2);
20160
+ }
20161
+ }
19986
20162
  return {
19987
20163
  createBuilding,
19988
20164
  getAll,
@@ -19990,7 +20166,8 @@ function useBuildingController() {
19990
20166
  updateById,
19991
20167
  deleteById,
19992
20168
  getBuildingLevel,
19993
- uploadSpreadsheetBuilding
20169
+ uploadSpreadsheetBuilding,
20170
+ getBuildingLevelWithUnits
19994
20171
  };
19995
20172
  }
19996
20173
 
@@ -20668,7 +20845,8 @@ function useVehicleController() {
20668
20845
  recNo: import_joi46.default.string().optional().allow(null, ""),
20669
20846
  type: import_joi46.default.string().optional().valid(...Object.values(VehicleType)).allow(null, ""),
20670
20847
  peopleId: import_joi46.default.string().hex().length(24).optional().allow(null, ""),
20671
- seasonPassType: import_joi46.default.string().optional().allow("", null)
20848
+ seasonPassType: import_joi46.default.string().optional().allow("", null),
20849
+ remarks: import_joi46.default.string().optional().allow("", null)
20672
20850
  });
20673
20851
  const { error, value } = schema2.validate(
20674
20852
  {
@@ -23980,6 +24158,8 @@ function useVisitorTransactionService() {
23980
24158
  }
23981
24159
  if (value.unit) {
23982
24160
  value.unit = typeof value.unit === "string" ? new import_mongodb59.ObjectId(value.unit) : value.unit;
24161
+ const unit = await _getUnitById(value.unit);
24162
+ value.unitName = unit?.name;
23983
24163
  }
23984
24164
  await _updateVisitorTansactionById(id, value, session);
23985
24165
  await session?.commitTransaction();
@@ -51588,6 +51768,7 @@ function useRoleControllerV2() {
51588
51768
  allowedNatures,
51589
51769
  attendanceSchema,
51590
51770
  attendanceSettingsSchema,
51771
+ building_units_namespace_collection,
51591
51772
  buildings_namespace_collection,
51592
51773
  bulletin_boards_namespace_collection,
51593
51774
  calculatePercentage,