@7365admin1/core 3.12.0 → 3.13.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 +6 -0
- package/dist/index.d.ts +45 -3
- package/dist/index.js +181 -154
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +180 -154
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -367,6 +367,36 @@ declare function useMemberController(): {
|
|
|
367
367
|
completeOnboarding: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
368
368
|
};
|
|
369
369
|
|
|
370
|
+
declare function useMemberService(): {
|
|
371
|
+
createMember: (id: string) => Promise<{
|
|
372
|
+
member: string;
|
|
373
|
+
}>;
|
|
374
|
+
createMemberDirect: ({ userId, orgId, roleId, app, siteId, siteName, onboardingRequired, }: {
|
|
375
|
+
userId: string;
|
|
376
|
+
orgId: string;
|
|
377
|
+
roleId: string;
|
|
378
|
+
app: string;
|
|
379
|
+
siteId?: string | undefined;
|
|
380
|
+
siteName?: string | undefined;
|
|
381
|
+
onboardingRequired?: boolean | undefined;
|
|
382
|
+
}) => Promise<{
|
|
383
|
+
member: string;
|
|
384
|
+
}>;
|
|
385
|
+
updateRoleById: (id: string, role: string, type: string, org: string) => Promise<{
|
|
386
|
+
message: string;
|
|
387
|
+
}>;
|
|
388
|
+
updateSiteById: (id: string, siteId: string, siteName: string) => Promise<{
|
|
389
|
+
message: string;
|
|
390
|
+
}>;
|
|
391
|
+
getAllByUser: (user: string) => Promise<{
|
|
392
|
+
items: TMember[];
|
|
393
|
+
total: number;
|
|
394
|
+
}>;
|
|
395
|
+
completeOnboarding: (memberId: string) => Promise<{
|
|
396
|
+
message: string;
|
|
397
|
+
}>;
|
|
398
|
+
};
|
|
399
|
+
|
|
370
400
|
type TVerificationMetadata = {
|
|
371
401
|
name?: string;
|
|
372
402
|
app?: string;
|
|
@@ -421,6 +451,13 @@ declare function useVerificationRepo(): {
|
|
|
421
451
|
updateStatusById: (_id: string | ObjectId, status: string, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
422
452
|
getByStatus: (status: string) => Promise<TVerification[]>;
|
|
423
453
|
findOne: (query: any) => Promise<mongodb.WithId<bson.Document> | null>;
|
|
454
|
+
completePendingInvites: ({ email, orgId, siteId, app, session, }: {
|
|
455
|
+
email: string;
|
|
456
|
+
orgId: string;
|
|
457
|
+
siteId?: string | undefined;
|
|
458
|
+
app?: string | undefined;
|
|
459
|
+
session?: ClientSession | undefined;
|
|
460
|
+
}) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
424
461
|
};
|
|
425
462
|
|
|
426
463
|
type TKeyValuePair<K extends string | number | symbol = string, V = any> = {
|
|
@@ -2910,7 +2947,6 @@ declare function useVisitorTransactionService(): {
|
|
|
2910
2947
|
updateVisitorTransactionById: (id: string | ObjectId, value: TVisitorTransaction) => Promise<string>;
|
|
2911
2948
|
processTransactionDahuaStatus: () => Promise<void>;
|
|
2912
2949
|
inviteVisitor: (value: TVisitorTransaction, userId: string) => Promise<any>;
|
|
2913
|
-
changeVisitorTransactionKeysById: (id: string, visitorPass?: TKeyRef[] | null, passKeys?: TKeyRef[] | null) => Promise<string>;
|
|
2914
2950
|
};
|
|
2915
2951
|
|
|
2916
2952
|
declare function useVisitorTransactionController(): {
|
|
@@ -2920,7 +2956,6 @@ declare function useVisitorTransactionController(): {
|
|
|
2920
2956
|
deleteVisitorTransaction: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
2921
2957
|
inviteVisitor: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
2922
2958
|
getVisitorTransactionById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
2923
|
-
changeVisitorTransactionKeysById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
2924
2959
|
};
|
|
2925
2960
|
|
|
2926
2961
|
declare enum GuestStatus {
|
|
@@ -6849,6 +6884,13 @@ declare function useVerificationRepoV2(): {
|
|
|
6849
6884
|
countPendingOrgInvites: (orgId: string | ObjectId) => Promise<number>;
|
|
6850
6885
|
getPendingVerificationByEmail: (email: string) => Promise<TVerificationV2 | null>;
|
|
6851
6886
|
updateVerificationCodeById: (_id: string | ObjectId, verificationCode: string, expireAt: string, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
6887
|
+
completePendingInvites: ({ email, orgId, siteId, app, session, }: {
|
|
6888
|
+
email: string;
|
|
6889
|
+
orgId: string;
|
|
6890
|
+
siteId?: string | undefined;
|
|
6891
|
+
app?: string | undefined;
|
|
6892
|
+
session?: ClientSession | undefined;
|
|
6893
|
+
}) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
6852
6894
|
};
|
|
6853
6895
|
|
|
6854
6896
|
declare function useVerificationServiceV2(): {
|
|
@@ -7896,4 +7938,4 @@ declare function useHidAmicoController(): {
|
|
|
7896
7938
|
runObjectOperation: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
7897
7939
|
};
|
|
7898
7940
|
|
|
7899
|
-
export { ANPRMode, AccessTypeProps, AppServiceType, AssignCardConfig, BidStatus, BidType, BuildingLevelStatus, BuildingStatus, BulkCardUpdate, BulletinOrder, BulletinRecipient, BulletinSort, BulletinStatus, BulletinVideoOrder, BulletinVideoSort, Camera, CameraType, DEVICE_STATUS, DOBStatus, DayOfWeek, DynamicFormFields, EAccessCardTypes, EAccessCardUserTypes, EmailSender, EntryOrder, EntrySort, EventOrder, EventSort, EventStatus, EventType, FacilitySort, FacilityStatus, FormEntryStatus, GuestSort, GuestStatus, IAccessCard, IAccessCardTransaction, MAccessCard, MAccessCardTransaction, MAddress, MAttendance, MAttendanceSettings, MBidPreloved, MBillingConfiguration, MBillingItem, MBuilding, MBuildingLevel, MBuildingUnit, MBulletinBoard, MBulletinVideo, MCategoryPreloved, MChannelPreloved, MChat, MChatPreloved, MCustomer, MCustomerSite, MDocumentManagement, MEntryPassSettings, MEventManagement, MFeedback, MFile, MFormEntry, MGuestManagement, MHidAmicoEvent, MHidAmicoIdentity, MHidAmicoReader, MIncidentReport, MManpowerDesignations, MManpowerMonitoring, MManpowerRemarks, MManpowerSites, MMember, MNfcPatrolLog, MNfcPatrolRoute, MNfcPatrolSettings, MNfcPatrolSettingsUpdate, MNfcPatrolTag, MOccurrenceBook, MOccurrenceEntry, MOccurrenceSubject, MOnlineForm, MOrg, MOvernightParkingApprovalHours, MOvernightParkingRequest, MPatrolLog, MPatrolQuestion, MPatrolRoute, MPerson, MPost, MPostFavorite, MPromoCode, MRobot, MRole, MRoleV2, MServiceProvider, MServiceProviderBilling, MSession, MSite, MSiteCamera, MSiteFacility, MSiteFacilityBooking, MStatementOfAccount, MSubcategoryPreloved, MSubscription, MUnitBilling, MUser, MVehicle, MVehicleTransaction, MVerification, MVerificationV2, MVisitorTransaction, MWorkOrder, OrgNature, OvernightParkingRequestSort, OvernightParkingRequestStatus, PERSON_TYPES, PStatus, Period, PersonStatus, PersonType, PersonTypes, PostOrder, PostSort, PostStatus, 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, TBidPreloved, TBilling, TBillingConfiguration, TBillingItem, TBuilding, TBuildingLevel, TBuildingUnit, TBulletinBoard, TBulletinVideo, TCamera, TCategoryPreloved, TChannelPreloved, TChat, TChatPreloved, TCheckPoint$1 as TCheckPoint, TComplaintInfo, TComplaintReceivedTo, TCounter, TCustomer, TCustomerSite, TDayNumber, TDaySchedule, TDefaultAccessCard, TDesignations, TDocs, TDocumentCreate, TDocumentManagement, TEntryPassSettings, TEventManagement, TFeedback, TFeedbackMetadata, TFeedbackUpdate, TFeedbackUpdateCategory, TFeedbackUpdateServiceProvider, TFeedbackUpdateStatus, TFeedbackUpdateToCompleted, TFile, TFiles, TFormEntry, TGetAttendancesByUserQuery, TGetAttendancesQuery, TGuestManagement, THidAmicoEvent, THidAmicoIdentity, THidAmicoReader, TIncidentInformation, TIncidentReport, TIncidentTypeAndTime, TInvoice, TKeyRef, TManpowerDesignations, TManpowerDesignationsUpdate, TManpowerMonitoring, TManpowerMonitoringUpdate, TManpowerRemarks, TManpowerRemarksStatusUpdate, TManpowerRemarksUpdate, TManpowerSearchFilter, TManpowerSites, TMember, TMemberUpdateStatus, TMessagePreloved, TMiniRole, TNfcPatrolLog, TNfcPatrolRoute, TNfcPatrolRouteEdit, TNfcPatrolSettings, TNfcPatrolSettingsGetBySite, TNfcPatrolSettingsUpdate, TNfcPatrolTag, TNfcPatrolTagConfigureReset, TNfcPatrolTagEdit, TNfcPatrolTagUpdateData, TOccurrenceBook, TOccurrenceEntry, TOccurrenceSubject, TOnlineForm, TOrg, TOvernightParkingApprovalHours, TOvernightParkingRequest, TPatrolLog, TPatrolQuestion, TPatrolRoute, TPerson, TPlaceOfIncident, TPlates, TPost, TPostFavorite, 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, TSubcategoryPreloved, TSubmissionForm, TSubscription, TUnitBilling, TUnits, TUpdateFormEntry, 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_level_namespace_collection, building_units_namespace_collection, buildings_namespace_collection, bulletin_boards_namespace_collection, chatSchema, createManpowerRemarksDaily, customerSchema, designationsSchema, events_namespace_collection, facility_bookings_namespace_collection, feedbackSchema, feedbacks2_namespace_collection, feedbacks_namespace_collection, formatDahuaDate, guests_namespace_collection, incidentReport, incidentReportLog, incidents_namespace_collection, logCamera, manpowerDesignationsSchema, manpowerEvents, manpowerMonitoringSchema, manpowerRemarksSchema, manpowerSitesSchema, nfcPatrolSettingsSchema, nfcPatrolSettingsSchemaUpdate, occurrence_book_namespace_collection, online_forms_namespace_collection, orgSchema, overnight_parking_requests_namespace_collection, parseDahuaFind, promoCodeSchema, remarksSchema, residentFormEntry, robotSchema, schema, schemaApprovedBy, schemaApprover, schemaBidPreloved, schemaBilling, schemaBillingConfiguration, schemaBillingItem, schemaBuilding, schemaBuildingLevel, schemaBuildingUnit, schemaBuildingUpdateOptions, schemaBulletinBoard, schemaBulletinVideo, schemaCategoryPreloved, schemaChannelPreloved, schemaChatPreloved, schemaCreateHidAmicoIdentity, schemaCustomerSite, schemaDocumentManagement, schemaEntryPassSettings, schemaEventManagement, schemaFiles, schemaFormEntry, schemaGuestManagement, schemaHidAmicoConfiguration, schemaHidAmicoEvent, schemaHidAmicoExecuteActions, schemaHidAmicoIdentity, schemaHidAmicoIdentityIdParams, schemaHidAmicoIdentityQuery, schemaHidAmicoLogQuery, schemaHidAmicoNotificationParams, schemaHidAmicoObjectOperation, schemaHidAmicoReader, schemaHidAmicoReaderIdParams, schemaHidAmicoReaderListQuery, schemaHidAmicoSetConfiguration, schemaHidAmicoSync, schemaHidAmicoUserImageParams, schemaIncidentReport, schemaMultipleDocumentManagement, schemaNfcPatrolLog, schemaNfcPatrolRoute, schemaNfcPatrolTag, schemaNfcPatrolTagUpdateData, schemaOccurrenceBook, schemaOccurrenceEntry, schemaOccurrenceSubject, schemaOnlineForm, schemaOvernightParkingApprovalHours, schemaOvernightParkingRequest, schemaPatrolLog, schemaPatrolQuestion, schemaPatrolRoute, schemaPerson, schemaPlate, schemaPost, schemaPostFavorite, schemaServiceProvider, schemaServiceProviderBilling, schemaSiteCamera, schemaSiteFacility, schemaSiteFacilityBooking, schemaStatementOfAccount, schemaSubcategoryPreloved, schemaUnitBilling, schemaUpdateBidPreloved, schemaUpdateBuildingLevel, schemaUpdateBulletinBoard, schemaUpdateBulletinVideo, schemaUpdateCategoryPreloved, schemaUpdateChatPreloved, schemaUpdateDocumentManagement, schemaUpdateEntryPassSettings, schemaUpdateEventManagement, schemaUpdateFormEntry, schemaUpdateGuestManagement, schemaUpdateHidAmicoIdentity, schemaUpdateHidAmicoReader, schemaUpdateIncidentReport, schemaUpdateOccurrenceBook, schemaUpdateOccurrenceEntry, schemaUpdateOccurrenceSubject, schemaUpdateOnlineForm, schemaUpdateOptions, schemaUpdateOvernightParkingRequest, schemaUpdatePatrolLog, schemaUpdatePatrolQuestion, schemaUpdatePatrolRoute, schemaUpdatePerson, schemaUpdatePost, schemaUpdatePostFavorite, schemaUpdateServiceProviderBilling, schemaUpdateSiteBillingConfiguration, schemaUpdateSiteBillingItem, schemaUpdateSiteCamera, schemaUpdateSiteFacility, schemaUpdateSiteFacilityBooking, schemaUpdateSiteUnitBilling, schemaUpdateStatementOfAccount, schemaUpdateSubcategoryPreloved, schemaUpdateVisTrans, schemaVehicleTransaction, schemaVisitorTransaction, schemeCamera, schemeLogCamera, shiftSchema, siteSchema, site_people_namespace_collection, tokenSchema, updateRemarksStatusEod, updateRemarksisAcknowledged, updateSiteSchema, useAccessManagementController, useAddressRepo, useAttendanceController, useAttendanceRepository, useAttendanceSettingsController, useAttendanceSettingsRepository, useAttendanceSettingsService, useAuthController, useAuthControllerV2, useAuthService, useAuthServiceV2, useBidPrelovedController, useBidPrelovedRepo, useBuildingController, useBuildingLevelController, useBuildingLevelRepo, useBuildingLevelService, useBuildingRepo, useBuildingService, useBuildingUnitController, useBuildingUnitRepo, useBuildingUnitService, useBulletinBoardController, useBulletinBoardRepo, useBulletinBoardService, useBulletinVideoController, useBulletinVideoRepo, useBulletinVideoService, useCategoryPrelovedController, useCategoryPrelovedRepo, useChannelPrelovedController, useChannelPrelovedRepo, useChatController, useChatPrelovedController, useChatPrelovedRepo, useChatPrelovedService, 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, useFormEntryController, useFormEntryRepo, useGuestManagementController, useGuestManagementRepo, useGuestManagementService, useHidAmicoController, useHidAmicoRepo, useHidAmicoService, 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, useOrgControllerV2, useOrgRepo, useOvernightParkingController, useOvernightParkingRepo, useOvernightParkingRequestController, useOvernightParkingRequestRepo, useOvernightParkingRequestService, usePatrolLogController, usePatrolLogRepo, usePatrolQuestionController, usePatrolQuestionRepo, usePatrolRouteController, usePatrolRouteRepo, usePersonController, usePersonRepo, usePostFavoriteController, usePostFavoriteRepo, usePostFavoriteService, usePostPrelovedController, usePostPrelovedRepo, 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, useSubcategoryPrelovedController, useSubcategoryPrelovedRepo, 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 };
|
|
7941
|
+
export { ANPRMode, AccessTypeProps, AppServiceType, AssignCardConfig, BidStatus, BidType, BuildingLevelStatus, BuildingStatus, BulkCardUpdate, BulletinOrder, BulletinRecipient, BulletinSort, BulletinStatus, BulletinVideoOrder, BulletinVideoSort, Camera, CameraType, DEVICE_STATUS, DOBStatus, DayOfWeek, DynamicFormFields, EAccessCardTypes, EAccessCardUserTypes, EmailSender, EntryOrder, EntrySort, EventOrder, EventSort, EventStatus, EventType, FacilitySort, FacilityStatus, FormEntryStatus, GuestSort, GuestStatus, IAccessCard, IAccessCardTransaction, MAccessCard, MAccessCardTransaction, MAddress, MAttendance, MAttendanceSettings, MBidPreloved, MBillingConfiguration, MBillingItem, MBuilding, MBuildingLevel, MBuildingUnit, MBulletinBoard, MBulletinVideo, MCategoryPreloved, MChannelPreloved, MChat, MChatPreloved, MCustomer, MCustomerSite, MDocumentManagement, MEntryPassSettings, MEventManagement, MFeedback, MFile, MFormEntry, MGuestManagement, MHidAmicoEvent, MHidAmicoIdentity, MHidAmicoReader, MIncidentReport, MManpowerDesignations, MManpowerMonitoring, MManpowerRemarks, MManpowerSites, MMember, MNfcPatrolLog, MNfcPatrolRoute, MNfcPatrolSettings, MNfcPatrolSettingsUpdate, MNfcPatrolTag, MOccurrenceBook, MOccurrenceEntry, MOccurrenceSubject, MOnlineForm, MOrg, MOvernightParkingApprovalHours, MOvernightParkingRequest, MPatrolLog, MPatrolQuestion, MPatrolRoute, MPerson, MPost, MPostFavorite, MPromoCode, MRobot, MRole, MRoleV2, MServiceProvider, MServiceProviderBilling, MSession, MSite, MSiteCamera, MSiteFacility, MSiteFacilityBooking, MStatementOfAccount, MSubcategoryPreloved, MSubscription, MUnitBilling, MUser, MVehicle, MVehicleTransaction, MVerification, MVerificationV2, MVisitorTransaction, MWorkOrder, OrgNature, OvernightParkingRequestSort, OvernightParkingRequestStatus, PERSON_TYPES, PStatus, Period, PersonStatus, PersonType, PersonTypes, PostOrder, PostSort, PostStatus, 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, TBidPreloved, TBilling, TBillingConfiguration, TBillingItem, TBuilding, TBuildingLevel, TBuildingUnit, TBulletinBoard, TBulletinVideo, TCamera, TCategoryPreloved, TChannelPreloved, TChat, TChatPreloved, TCheckPoint$1 as TCheckPoint, TComplaintInfo, TComplaintReceivedTo, TCounter, TCustomer, TCustomerSite, TDayNumber, TDaySchedule, TDefaultAccessCard, TDesignations, TDocs, TDocumentCreate, TDocumentManagement, TEntryPassSettings, TEventManagement, TFeedback, TFeedbackMetadata, TFeedbackUpdate, TFeedbackUpdateCategory, TFeedbackUpdateServiceProvider, TFeedbackUpdateStatus, TFeedbackUpdateToCompleted, TFile, TFiles, TFormEntry, TGetAttendancesByUserQuery, TGetAttendancesQuery, TGuestManagement, THidAmicoEvent, THidAmicoIdentity, THidAmicoReader, TIncidentInformation, TIncidentReport, TIncidentTypeAndTime, TInvoice, TKeyRef, TManpowerDesignations, TManpowerDesignationsUpdate, TManpowerMonitoring, TManpowerMonitoringUpdate, TManpowerRemarks, TManpowerRemarksStatusUpdate, TManpowerRemarksUpdate, TManpowerSearchFilter, TManpowerSites, TMember, TMemberUpdateStatus, TMessagePreloved, TMiniRole, TNfcPatrolLog, TNfcPatrolRoute, TNfcPatrolRouteEdit, TNfcPatrolSettings, TNfcPatrolSettingsGetBySite, TNfcPatrolSettingsUpdate, TNfcPatrolTag, TNfcPatrolTagConfigureReset, TNfcPatrolTagEdit, TNfcPatrolTagUpdateData, TOccurrenceBook, TOccurrenceEntry, TOccurrenceSubject, TOnlineForm, TOrg, TOvernightParkingApprovalHours, TOvernightParkingRequest, TPatrolLog, TPatrolQuestion, TPatrolRoute, TPerson, TPlaceOfIncident, TPlates, TPost, TPostFavorite, 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, TSubcategoryPreloved, TSubmissionForm, TSubscription, TUnitBilling, TUnits, TUpdateFormEntry, 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_level_namespace_collection, building_units_namespace_collection, buildings_namespace_collection, bulletin_boards_namespace_collection, chatSchema, createManpowerRemarksDaily, customerSchema, designationsSchema, events_namespace_collection, facility_bookings_namespace_collection, feedbackSchema, feedbacks2_namespace_collection, feedbacks_namespace_collection, formatDahuaDate, guests_namespace_collection, incidentReport, incidentReportLog, incidents_namespace_collection, logCamera, manpowerDesignationsSchema, manpowerEvents, manpowerMonitoringSchema, manpowerRemarksSchema, manpowerSitesSchema, nfcPatrolSettingsSchema, nfcPatrolSettingsSchemaUpdate, occurrence_book_namespace_collection, online_forms_namespace_collection, orgSchema, overnight_parking_requests_namespace_collection, parseDahuaFind, promoCodeSchema, remarksSchema, residentFormEntry, robotSchema, schema, schemaApprovedBy, schemaApprover, schemaBidPreloved, schemaBilling, schemaBillingConfiguration, schemaBillingItem, schemaBuilding, schemaBuildingLevel, schemaBuildingUnit, schemaBuildingUpdateOptions, schemaBulletinBoard, schemaBulletinVideo, schemaCategoryPreloved, schemaChannelPreloved, schemaChatPreloved, schemaCreateHidAmicoIdentity, schemaCustomerSite, schemaDocumentManagement, schemaEntryPassSettings, schemaEventManagement, schemaFiles, schemaFormEntry, schemaGuestManagement, schemaHidAmicoConfiguration, schemaHidAmicoEvent, schemaHidAmicoExecuteActions, schemaHidAmicoIdentity, schemaHidAmicoIdentityIdParams, schemaHidAmicoIdentityQuery, schemaHidAmicoLogQuery, schemaHidAmicoNotificationParams, schemaHidAmicoObjectOperation, schemaHidAmicoReader, schemaHidAmicoReaderIdParams, schemaHidAmicoReaderListQuery, schemaHidAmicoSetConfiguration, schemaHidAmicoSync, schemaHidAmicoUserImageParams, schemaIncidentReport, schemaMultipleDocumentManagement, schemaNfcPatrolLog, schemaNfcPatrolRoute, schemaNfcPatrolTag, schemaNfcPatrolTagUpdateData, schemaOccurrenceBook, schemaOccurrenceEntry, schemaOccurrenceSubject, schemaOnlineForm, schemaOvernightParkingApprovalHours, schemaOvernightParkingRequest, schemaPatrolLog, schemaPatrolQuestion, schemaPatrolRoute, schemaPerson, schemaPlate, schemaPost, schemaPostFavorite, schemaServiceProvider, schemaServiceProviderBilling, schemaSiteCamera, schemaSiteFacility, schemaSiteFacilityBooking, schemaStatementOfAccount, schemaSubcategoryPreloved, schemaUnitBilling, schemaUpdateBidPreloved, schemaUpdateBuildingLevel, schemaUpdateBulletinBoard, schemaUpdateBulletinVideo, schemaUpdateCategoryPreloved, schemaUpdateChatPreloved, schemaUpdateDocumentManagement, schemaUpdateEntryPassSettings, schemaUpdateEventManagement, schemaUpdateFormEntry, schemaUpdateGuestManagement, schemaUpdateHidAmicoIdentity, schemaUpdateHidAmicoReader, schemaUpdateIncidentReport, schemaUpdateOccurrenceBook, schemaUpdateOccurrenceEntry, schemaUpdateOccurrenceSubject, schemaUpdateOnlineForm, schemaUpdateOptions, schemaUpdateOvernightParkingRequest, schemaUpdatePatrolLog, schemaUpdatePatrolQuestion, schemaUpdatePatrolRoute, schemaUpdatePerson, schemaUpdatePost, schemaUpdatePostFavorite, schemaUpdateServiceProviderBilling, schemaUpdateSiteBillingConfiguration, schemaUpdateSiteBillingItem, schemaUpdateSiteCamera, schemaUpdateSiteFacility, schemaUpdateSiteFacilityBooking, schemaUpdateSiteUnitBilling, schemaUpdateStatementOfAccount, schemaUpdateSubcategoryPreloved, schemaUpdateVisTrans, schemaVehicleTransaction, schemaVisitorTransaction, schemeCamera, schemeLogCamera, shiftSchema, siteSchema, site_people_namespace_collection, tokenSchema, updateRemarksStatusEod, updateRemarksisAcknowledged, updateSiteSchema, useAccessManagementController, useAddressRepo, useAttendanceController, useAttendanceRepository, useAttendanceSettingsController, useAttendanceSettingsRepository, useAttendanceSettingsService, useAuthController, useAuthControllerV2, useAuthService, useAuthServiceV2, useBidPrelovedController, useBidPrelovedRepo, useBuildingController, useBuildingLevelController, useBuildingLevelRepo, useBuildingLevelService, useBuildingRepo, useBuildingService, useBuildingUnitController, useBuildingUnitRepo, useBuildingUnitService, useBulletinBoardController, useBulletinBoardRepo, useBulletinBoardService, useBulletinVideoController, useBulletinVideoRepo, useBulletinVideoService, useCategoryPrelovedController, useCategoryPrelovedRepo, useChannelPrelovedController, useChannelPrelovedRepo, useChatController, useChatPrelovedController, useChatPrelovedRepo, useChatPrelovedService, 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, useFormEntryController, useFormEntryRepo, useGuestManagementController, useGuestManagementRepo, useGuestManagementService, useHidAmicoController, useHidAmicoRepo, useHidAmicoService, useHrmLabsAttendanceCtrl, useHrmLabsAttendanceSrvc, useIncidentReportController, useIncidentReportRepo, useIncidentReportService, useInvoiceController, useInvoiceModel, useInvoiceRepo, useManpowerDesignationCtrl, useManpowerDesignationRepo, useManpowerMonitoringCtrl, useManpowerMonitoringRepo, useManpowerMonitoringSrvc, useManpowerRemarkCtrl, useManpowerRemarksRepo, useManpowerSitesCtrl, useManpowerSitesRepo, useManpowerSitesSrvc, useMemberController, useMemberRepo, useMemberService, 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, useOrgControllerV2, useOrgRepo, useOvernightParkingController, useOvernightParkingRepo, useOvernightParkingRequestController, useOvernightParkingRequestRepo, useOvernightParkingRequestService, usePatrolLogController, usePatrolLogRepo, usePatrolQuestionController, usePatrolQuestionRepo, usePatrolRouteController, usePatrolRouteRepo, usePersonController, usePersonRepo, usePostFavoriteController, usePostFavoriteRepo, usePostFavoriteService, usePostPrelovedController, usePostPrelovedRepo, 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, useSubcategoryPrelovedController, useSubcategoryPrelovedRepo, 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
|
@@ -6267,6 +6267,7 @@ __export(src_exports, {
|
|
|
6267
6267
|
useManpowerSitesSrvc: () => useManpowerSitesSrvc,
|
|
6268
6268
|
useMemberController: () => useMemberController,
|
|
6269
6269
|
useMemberRepo: () => useMemberRepo,
|
|
6270
|
+
useMemberService: () => useMemberService,
|
|
6270
6271
|
useNewDashboardController: () => useNewDashboardController,
|
|
6271
6272
|
useNewDashboardRepo: () => useNewDashboardRepo,
|
|
6272
6273
|
useNfcPatrolLogController: () => useNfcPatrolLogController,
|
|
@@ -10577,6 +10578,56 @@ function useVerificationRepo() {
|
|
|
10577
10578
|
async function findOne(query) {
|
|
10578
10579
|
return await collection.findOne(query);
|
|
10579
10580
|
}
|
|
10581
|
+
async function completePendingInvites({
|
|
10582
|
+
email,
|
|
10583
|
+
orgId,
|
|
10584
|
+
siteId,
|
|
10585
|
+
app,
|
|
10586
|
+
session
|
|
10587
|
+
}) {
|
|
10588
|
+
const orgCandidates = [orgId];
|
|
10589
|
+
try {
|
|
10590
|
+
orgCandidates.push(new import_mongodb13.ObjectId(orgId));
|
|
10591
|
+
} catch {
|
|
10592
|
+
}
|
|
10593
|
+
const query = {
|
|
10594
|
+
email: { $regex: `^${email}$`, $options: "i" },
|
|
10595
|
+
status: "pending",
|
|
10596
|
+
type: {
|
|
10597
|
+
$in: ["user-invite" /* USER_INVITE */, "member-invite" /* MEMBER_INVITE */]
|
|
10598
|
+
},
|
|
10599
|
+
"metadata.org": { $in: orgCandidates }
|
|
10600
|
+
};
|
|
10601
|
+
if (siteId) {
|
|
10602
|
+
const siteCandidates = [siteId];
|
|
10603
|
+
try {
|
|
10604
|
+
siteCandidates.push(new import_mongodb13.ObjectId(siteId));
|
|
10605
|
+
} catch {
|
|
10606
|
+
}
|
|
10607
|
+
query["metadata.siteId"] = { $in: siteCandidates };
|
|
10608
|
+
}
|
|
10609
|
+
if (app) {
|
|
10610
|
+
query["metadata.app"] = app;
|
|
10611
|
+
}
|
|
10612
|
+
try {
|
|
10613
|
+
const result = await collection.updateMany(
|
|
10614
|
+
query,
|
|
10615
|
+
{ $set: { status: "complete", updatedAt: (/* @__PURE__ */ new Date()).toISOString() } },
|
|
10616
|
+
{ session }
|
|
10617
|
+
);
|
|
10618
|
+
delNamespace().then(() => {
|
|
10619
|
+
import_node_server_utils15.logger.info(`Cache cleared for namespace: ${namespace_collection}`);
|
|
10620
|
+
}).catch((err) => {
|
|
10621
|
+
import_node_server_utils15.logger.error(
|
|
10622
|
+
`Failed to clear cache for namespace: ${namespace_collection}`,
|
|
10623
|
+
err
|
|
10624
|
+
);
|
|
10625
|
+
});
|
|
10626
|
+
return result;
|
|
10627
|
+
} catch (error) {
|
|
10628
|
+
throw new import_node_server_utils15.InternalServerError("Failed to complete pending invites.");
|
|
10629
|
+
}
|
|
10630
|
+
}
|
|
10580
10631
|
return {
|
|
10581
10632
|
createIndex,
|
|
10582
10633
|
createTextIndex,
|
|
@@ -10586,7 +10637,8 @@ function useVerificationRepo() {
|
|
|
10586
10637
|
getByIdByType,
|
|
10587
10638
|
updateStatusById,
|
|
10588
10639
|
getByStatus,
|
|
10589
|
-
findOne
|
|
10640
|
+
findOne,
|
|
10641
|
+
completePendingInvites
|
|
10590
10642
|
};
|
|
10591
10643
|
}
|
|
10592
10644
|
|
|
@@ -12163,6 +12215,61 @@ function useVerificationRepoV2() {
|
|
|
12163
12215
|
throw new import_node_server_utils20.InternalServerError("Failed to update verification code.");
|
|
12164
12216
|
}
|
|
12165
12217
|
}
|
|
12218
|
+
async function completePendingInvites({
|
|
12219
|
+
email,
|
|
12220
|
+
orgId,
|
|
12221
|
+
siteId,
|
|
12222
|
+
app,
|
|
12223
|
+
session
|
|
12224
|
+
}) {
|
|
12225
|
+
const orgCandidates = [orgId];
|
|
12226
|
+
try {
|
|
12227
|
+
orgCandidates.push(new import_mongodb18.ObjectId(orgId));
|
|
12228
|
+
} catch {
|
|
12229
|
+
}
|
|
12230
|
+
const query = {
|
|
12231
|
+
email: { $regex: `^${email}$`, $options: "i" },
|
|
12232
|
+
status: "pending" /* PENDING */,
|
|
12233
|
+
type: {
|
|
12234
|
+
$in: ["user-invite" /* USER_INVITE */, "member-invite" /* MEMBER_INVITE */]
|
|
12235
|
+
},
|
|
12236
|
+
"metadata.org": { $in: orgCandidates }
|
|
12237
|
+
};
|
|
12238
|
+
if (siteId) {
|
|
12239
|
+
const siteCandidates = [siteId];
|
|
12240
|
+
try {
|
|
12241
|
+
siteCandidates.push(new import_mongodb18.ObjectId(siteId));
|
|
12242
|
+
} catch {
|
|
12243
|
+
}
|
|
12244
|
+
query["metadata.siteId"] = { $in: siteCandidates };
|
|
12245
|
+
}
|
|
12246
|
+
if (app) {
|
|
12247
|
+
query["metadata.app"] = app;
|
|
12248
|
+
}
|
|
12249
|
+
try {
|
|
12250
|
+
const result = await collection.updateMany(
|
|
12251
|
+
query,
|
|
12252
|
+
{
|
|
12253
|
+
$set: {
|
|
12254
|
+
status: "complete" /* COMPLETE */,
|
|
12255
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
12256
|
+
}
|
|
12257
|
+
},
|
|
12258
|
+
{ session }
|
|
12259
|
+
);
|
|
12260
|
+
delNamespace().then(() => {
|
|
12261
|
+
import_node_server_utils20.logger.info(`Cache cleared for namespace: ${namespace_collection}`);
|
|
12262
|
+
}).catch((err) => {
|
|
12263
|
+
import_node_server_utils20.logger.error(
|
|
12264
|
+
`Failed to clear cache for namespace: ${namespace_collection}`,
|
|
12265
|
+
err
|
|
12266
|
+
);
|
|
12267
|
+
});
|
|
12268
|
+
return result;
|
|
12269
|
+
} catch (error) {
|
|
12270
|
+
throw new import_node_server_utils20.InternalServerError("Failed to complete pending invites.");
|
|
12271
|
+
}
|
|
12272
|
+
}
|
|
12166
12273
|
return {
|
|
12167
12274
|
createIndex,
|
|
12168
12275
|
createTextIndex,
|
|
@@ -12174,7 +12281,8 @@ function useVerificationRepoV2() {
|
|
|
12174
12281
|
updateStatusById,
|
|
12175
12282
|
countPendingOrgInvites,
|
|
12176
12283
|
getPendingVerificationByEmail,
|
|
12177
|
-
updateVerificationCodeById
|
|
12284
|
+
updateVerificationCodeById,
|
|
12285
|
+
completePendingInvites
|
|
12178
12286
|
};
|
|
12179
12287
|
}
|
|
12180
12288
|
|
|
@@ -14262,7 +14370,7 @@ function useMemberService() {
|
|
|
14262
14370
|
getAllByUserId: _getAllByUserId,
|
|
14263
14371
|
completeOnboardingById: _completeOnboardingById
|
|
14264
14372
|
} = useMemberRepo();
|
|
14265
|
-
const { getById: _getVerificationById, updateStatusById } = useVerificationRepo();
|
|
14373
|
+
const { getById: _getVerificationById, updateStatusById, completePendingInvites } = useVerificationRepo();
|
|
14266
14374
|
const { getUserByEmail, updateDefaultOrgByEmail, getUserById } = useUserRepo();
|
|
14267
14375
|
const { getById: getOrgById } = useOrgRepo();
|
|
14268
14376
|
const { getSiteById } = useSiteRepo();
|
|
@@ -14366,6 +14474,13 @@ function useMemberService() {
|
|
|
14366
14474
|
session
|
|
14367
14475
|
);
|
|
14368
14476
|
}
|
|
14477
|
+
await completePendingInvites({
|
|
14478
|
+
email: user.email,
|
|
14479
|
+
orgId,
|
|
14480
|
+
siteId,
|
|
14481
|
+
app,
|
|
14482
|
+
session
|
|
14483
|
+
});
|
|
14369
14484
|
await session?.commitTransaction();
|
|
14370
14485
|
return { member };
|
|
14371
14486
|
} catch (error) {
|
|
@@ -21318,6 +21433,7 @@ async function convertObjectIdUtil2(id, fieldName) {
|
|
|
21318
21433
|
throw new Error(`Invalid ID conversion to ObjectId of ${fieldName}.`);
|
|
21319
21434
|
return new import_mongodb40.ObjectId(id);
|
|
21320
21435
|
} catch (_) {
|
|
21436
|
+
console.log(`Invalid ID conversion to ObjectId of ${fieldName}. : `, id);
|
|
21321
21437
|
throw new Error(`Invalid ID conversion to ObjectId of ${fieldName}.`);
|
|
21322
21438
|
}
|
|
21323
21439
|
}
|
|
@@ -33624,12 +33740,28 @@ var KeyRepo = class {
|
|
|
33624
33740
|
return Promise.reject("Server internal error.");
|
|
33625
33741
|
}
|
|
33626
33742
|
}
|
|
33627
|
-
static async updateKeyById(keyId, key, site, session, isChild, visitorId) {
|
|
33743
|
+
static async updateKeyById(keyId, key, site, session, isChild, visitorId, isDifferentStatus, isPassKeyVisitorAdd) {
|
|
33628
33744
|
keyId = await convertObjectIdUtil2(keyId, "keyId");
|
|
33629
33745
|
if (site)
|
|
33630
33746
|
site = await convertObjectIdUtil2(site, "Site");
|
|
33631
|
-
if (visitorId)
|
|
33632
|
-
visitorId = await convertObjectIdUtil2(visitorId, "
|
|
33747
|
+
if (visitorId) {
|
|
33748
|
+
visitorId = await convertObjectIdUtil2(visitorId, "Visitor Id");
|
|
33749
|
+
if (!isPassKeyVisitorAdd) {
|
|
33750
|
+
const findOptions = { sort: { _id: -1 } };
|
|
33751
|
+
const latestHistory = await this.collectionDynamic("keys-histories").findOne(
|
|
33752
|
+
{ passOrKeyId: keyId },
|
|
33753
|
+
findOptions
|
|
33754
|
+
);
|
|
33755
|
+
console.log("visitorId", visitorId.toString());
|
|
33756
|
+
console.log("latestHistory.visitorId", latestHistory?.visitorId.toString());
|
|
33757
|
+
if (latestHistory?.visitorId && latestHistory.visitorId?.toString() !== visitorId.toString()) {
|
|
33758
|
+
console.log("Not updating keyId", keyId);
|
|
33759
|
+
return;
|
|
33760
|
+
} else {
|
|
33761
|
+
console.log("updating keyId", keyId);
|
|
33762
|
+
}
|
|
33763
|
+
}
|
|
33764
|
+
}
|
|
33633
33765
|
if (key.updatedBy)
|
|
33634
33766
|
key.updatedBy = await convertObjectIdUtil2(key.updatedBy, "Updated By");
|
|
33635
33767
|
if (!key.status)
|
|
@@ -33637,9 +33769,14 @@ var KeyRepo = class {
|
|
|
33637
33769
|
try {
|
|
33638
33770
|
key.updatedAt = /* @__PURE__ */ new Date();
|
|
33639
33771
|
const query = { _id: keyId, ...site && { site } };
|
|
33640
|
-
let find = query;
|
|
33641
|
-
if (isChild)
|
|
33772
|
+
let find = { ...query };
|
|
33773
|
+
if (isChild) {
|
|
33642
33774
|
find = { parentId: keyId, site };
|
|
33775
|
+
} else {
|
|
33776
|
+
if (isDifferentStatus && typeof key?.status == "string") {
|
|
33777
|
+
find.status = { $ne: key.status };
|
|
33778
|
+
}
|
|
33779
|
+
}
|
|
33643
33780
|
const result = await this.collection().updateMany(
|
|
33644
33781
|
find,
|
|
33645
33782
|
{ $set: key },
|
|
@@ -33665,7 +33802,11 @@ var KeyRepo = class {
|
|
|
33665
33802
|
session
|
|
33666
33803
|
});
|
|
33667
33804
|
} else {
|
|
33668
|
-
|
|
33805
|
+
if (visitorId) {
|
|
33806
|
+
console.log(`visitorId: ${visitorId} keyId: ${keyId} Not Updated`);
|
|
33807
|
+
} else {
|
|
33808
|
+
throw new Error("Failed Updating Keys");
|
|
33809
|
+
}
|
|
33669
33810
|
}
|
|
33670
33811
|
return result;
|
|
33671
33812
|
} catch (error) {
|
|
@@ -34030,40 +34171,6 @@ function useVisitorTransactionService() {
|
|
|
34030
34171
|
}
|
|
34031
34172
|
return normalized;
|
|
34032
34173
|
}
|
|
34033
|
-
async function syncTransactionKeys({
|
|
34034
|
-
current,
|
|
34035
|
-
incoming,
|
|
34036
|
-
site,
|
|
34037
|
-
session
|
|
34038
|
-
}) {
|
|
34039
|
-
const currentIds = current.map((item) => item.keyId.toString());
|
|
34040
|
-
const incomingIds = incoming.map((item) => item.keyId.toString());
|
|
34041
|
-
const currentSet = new Set(currentIds);
|
|
34042
|
-
const incomingSet = new Set(incomingIds);
|
|
34043
|
-
const removedIds = currentIds.filter((id) => !incomingSet.has(id));
|
|
34044
|
-
const addedIds = incomingIds.filter((id) => !currentSet.has(id));
|
|
34045
|
-
for (const keyId of removedIds) {
|
|
34046
|
-
const existingKey = await KeyRepo.getById(keyId);
|
|
34047
|
-
if (!existingKey)
|
|
34048
|
-
continue;
|
|
34049
|
-
if (existingKey.status === "In Use" /* IN_USE */) {
|
|
34050
|
-
await KeyRepo.updateKeyById(
|
|
34051
|
-
keyId,
|
|
34052
|
-
{ status: "Available" /* AVAILABLE */ },
|
|
34053
|
-
site,
|
|
34054
|
-
session
|
|
34055
|
-
);
|
|
34056
|
-
}
|
|
34057
|
-
}
|
|
34058
|
-
for (const keyId of addedIds) {
|
|
34059
|
-
await KeyRepo.updateKeyById(
|
|
34060
|
-
keyId,
|
|
34061
|
-
{ status: "In Use" /* IN_USE */ },
|
|
34062
|
-
site,
|
|
34063
|
-
session
|
|
34064
|
-
);
|
|
34065
|
-
}
|
|
34066
|
-
}
|
|
34067
34174
|
async function add(value) {
|
|
34068
34175
|
const session = import_node_server_utils106.useAtlas.getClient()?.startSession();
|
|
34069
34176
|
const allowedPersonTypes = [
|
|
@@ -34199,7 +34306,9 @@ function useVisitorTransactionService() {
|
|
|
34199
34306
|
value.site,
|
|
34200
34307
|
session,
|
|
34201
34308
|
void 0,
|
|
34202
|
-
visitorId
|
|
34309
|
+
visitorId,
|
|
34310
|
+
void 0,
|
|
34311
|
+
true
|
|
34203
34312
|
);
|
|
34204
34313
|
}
|
|
34205
34314
|
for (const item of preparedPassKeys) {
|
|
@@ -34211,7 +34320,11 @@ function useVisitorTransactionService() {
|
|
|
34211
34320
|
visitorId
|
|
34212
34321
|
},
|
|
34213
34322
|
value.site,
|
|
34214
|
-
session
|
|
34323
|
+
session,
|
|
34324
|
+
void 0,
|
|
34325
|
+
visitorId,
|
|
34326
|
+
void 0,
|
|
34327
|
+
true
|
|
34215
34328
|
);
|
|
34216
34329
|
}
|
|
34217
34330
|
})
|
|
@@ -34267,7 +34380,9 @@ function useVisitorTransactionService() {
|
|
|
34267
34380
|
value.site,
|
|
34268
34381
|
session,
|
|
34269
34382
|
void 0,
|
|
34270
|
-
result
|
|
34383
|
+
result,
|
|
34384
|
+
void 0,
|
|
34385
|
+
true
|
|
34271
34386
|
);
|
|
34272
34387
|
}
|
|
34273
34388
|
}
|
|
@@ -34279,7 +34394,9 @@ function useVisitorTransactionService() {
|
|
|
34279
34394
|
value.site,
|
|
34280
34395
|
session,
|
|
34281
34396
|
void 0,
|
|
34282
|
-
result
|
|
34397
|
+
result,
|
|
34398
|
+
void 0,
|
|
34399
|
+
true
|
|
34283
34400
|
);
|
|
34284
34401
|
}
|
|
34285
34402
|
}
|
|
@@ -34415,7 +34532,8 @@ function useVisitorTransactionService() {
|
|
|
34415
34532
|
value.site,
|
|
34416
34533
|
session,
|
|
34417
34534
|
void 0,
|
|
34418
|
-
id
|
|
34535
|
+
id,
|
|
34536
|
+
true
|
|
34419
34537
|
);
|
|
34420
34538
|
delete item.receivedDate;
|
|
34421
34539
|
item.lastUpdate = /* @__PURE__ */ new Date();
|
|
@@ -34462,7 +34580,8 @@ function useVisitorTransactionService() {
|
|
|
34462
34580
|
value.site,
|
|
34463
34581
|
session,
|
|
34464
34582
|
void 0,
|
|
34465
|
-
id
|
|
34583
|
+
id,
|
|
34584
|
+
true
|
|
34466
34585
|
);
|
|
34467
34586
|
delete item.receivedDate;
|
|
34468
34587
|
item.lastUpdate = /* @__PURE__ */ new Date();
|
|
@@ -34633,63 +34752,12 @@ function useVisitorTransactionService() {
|
|
|
34633
34752
|
session?.endSession();
|
|
34634
34753
|
}
|
|
34635
34754
|
}
|
|
34636
|
-
async function changeVisitorTransactionKeysById(id, visitorPass, passKeys) {
|
|
34637
|
-
const session = import_node_server_utils106.useAtlas.getClient()?.startSession();
|
|
34638
|
-
if (!session) {
|
|
34639
|
-
throw new Error(
|
|
34640
|
-
"Unable to start session for visitor transaction service."
|
|
34641
|
-
);
|
|
34642
|
-
}
|
|
34643
|
-
try {
|
|
34644
|
-
session.startTransaction();
|
|
34645
|
-
const visitorTransaction = await _getVisitorTransactionById(id);
|
|
34646
|
-
if (!visitorTransaction) {
|
|
34647
|
-
throw new Error("Visitor transaction not found.");
|
|
34648
|
-
}
|
|
34649
|
-
const updatePayload = {};
|
|
34650
|
-
if (visitorPass !== void 0) {
|
|
34651
|
-
const currentVisitorPass = normalizeKeyRefs(
|
|
34652
|
-
visitorTransaction.visitorPass
|
|
34653
|
-
);
|
|
34654
|
-
const incomingVisitorPass = normalizeKeyRefs(visitorPass);
|
|
34655
|
-
await syncTransactionKeys({
|
|
34656
|
-
current: currentVisitorPass,
|
|
34657
|
-
incoming: incomingVisitorPass,
|
|
34658
|
-
site: visitorTransaction.site,
|
|
34659
|
-
session
|
|
34660
|
-
});
|
|
34661
|
-
updatePayload.visitorPass = incomingVisitorPass;
|
|
34662
|
-
}
|
|
34663
|
-
if (passKeys !== void 0) {
|
|
34664
|
-
const currentPassKeys = normalizeKeyRefs(visitorTransaction.passKeys);
|
|
34665
|
-
const incomingPassKeys = normalizeKeyRefs(passKeys);
|
|
34666
|
-
await syncTransactionKeys({
|
|
34667
|
-
current: currentPassKeys,
|
|
34668
|
-
incoming: incomingPassKeys,
|
|
34669
|
-
site: visitorTransaction.site,
|
|
34670
|
-
session
|
|
34671
|
-
});
|
|
34672
|
-
updatePayload.passKeys = incomingPassKeys;
|
|
34673
|
-
}
|
|
34674
|
-
if (Object.keys(updatePayload).length > 0) {
|
|
34675
|
-
await _updateVisitorTansactionById(id, updatePayload, session);
|
|
34676
|
-
}
|
|
34677
|
-
await session.commitTransaction();
|
|
34678
|
-
return "Successfully changed visitor transaction keys.";
|
|
34679
|
-
} catch (error) {
|
|
34680
|
-
await session.abortTransaction();
|
|
34681
|
-
import_node_server_utils106.logger.error("Error in visitor transaction change keys by id:", error);
|
|
34682
|
-
throw error;
|
|
34683
|
-
} finally {
|
|
34684
|
-
session.endSession();
|
|
34685
|
-
}
|
|
34686
|
-
}
|
|
34687
34755
|
return {
|
|
34688
34756
|
add,
|
|
34689
34757
|
updateVisitorTransactionById,
|
|
34690
34758
|
processTransactionDahuaStatus,
|
|
34691
|
-
inviteVisitor
|
|
34692
|
-
changeVisitorTransactionKeysById
|
|
34759
|
+
inviteVisitor
|
|
34760
|
+
// changeVisitorTransactionKeysById,
|
|
34693
34761
|
};
|
|
34694
34762
|
}
|
|
34695
34763
|
|
|
@@ -34700,8 +34768,8 @@ function useVisitorTransactionController() {
|
|
|
34700
34768
|
const {
|
|
34701
34769
|
add: _add,
|
|
34702
34770
|
updateVisitorTransactionById: _updateVisitorTransactionById,
|
|
34703
|
-
inviteVisitor: _inviteVisitor
|
|
34704
|
-
changeVisitorTransactionKeysById: _changeVisitorTransactionKeysById
|
|
34771
|
+
inviteVisitor: _inviteVisitor
|
|
34772
|
+
// changeVisitorTransactionKeysById: _changeVisitorTransactionKeysById,
|
|
34705
34773
|
} = useVisitorTransactionService();
|
|
34706
34774
|
const {
|
|
34707
34775
|
getAll: _getAll,
|
|
@@ -34858,7 +34926,12 @@ function useVisitorTransactionController() {
|
|
|
34858
34926
|
return;
|
|
34859
34927
|
} catch (error2) {
|
|
34860
34928
|
import_node_server_utils107.logger.log({ level: "error", message: error2.message });
|
|
34861
|
-
|
|
34929
|
+
console.log("error", error2);
|
|
34930
|
+
if (error2?.message) {
|
|
34931
|
+
next(new import_node_server_utils107.BadRequestError(error2?.message));
|
|
34932
|
+
} else {
|
|
34933
|
+
next(error2);
|
|
34934
|
+
}
|
|
34862
34935
|
return;
|
|
34863
34936
|
}
|
|
34864
34937
|
}
|
|
@@ -34951,61 +35024,14 @@ function useVisitorTransactionController() {
|
|
|
34951
35024
|
}
|
|
34952
35025
|
}
|
|
34953
35026
|
}
|
|
34954
|
-
async function changeVisitorTransactionKeysById(req, res, next) {
|
|
34955
|
-
const idValidation = import_joi57.default.string().hex().length(24).required();
|
|
34956
|
-
const bodyValidation = import_joi57.default.object({
|
|
34957
|
-
visitorPass: import_joi57.default.array().items(
|
|
34958
|
-
import_joi57.default.object({
|
|
34959
|
-
keyId: import_joi57.default.string().hex().length(24).required()
|
|
34960
|
-
})
|
|
34961
|
-
).optional(),
|
|
34962
|
-
passKeys: import_joi57.default.array().items(
|
|
34963
|
-
import_joi57.default.object({
|
|
34964
|
-
keyId: import_joi57.default.string().hex().length(24).required()
|
|
34965
|
-
})
|
|
34966
|
-
).optional()
|
|
34967
|
-
}).or("visitorPass", "passKeys");
|
|
34968
|
-
const _id = req.params.id;
|
|
34969
|
-
const { error: idError } = idValidation.validate(_id);
|
|
34970
|
-
if (idError) {
|
|
34971
|
-
import_node_server_utils107.logger.log({ level: "error", message: idError.message });
|
|
34972
|
-
next(new import_node_server_utils107.BadRequestError(idError.message));
|
|
34973
|
-
return;
|
|
34974
|
-
}
|
|
34975
|
-
const { error, value } = bodyValidation.validate(req.body, {
|
|
34976
|
-
abortEarly: false
|
|
34977
|
-
});
|
|
34978
|
-
if (error) {
|
|
34979
|
-
const message = error.details.map((d) => d.message).join(", ");
|
|
34980
|
-
import_node_server_utils107.logger.log({ level: "error", message });
|
|
34981
|
-
next(new import_node_server_utils107.BadRequestError(message));
|
|
34982
|
-
return;
|
|
34983
|
-
}
|
|
34984
|
-
try {
|
|
34985
|
-
const { visitorPass, passKeys } = value;
|
|
34986
|
-
const result = await _changeVisitorTransactionKeysById(
|
|
34987
|
-
_id,
|
|
34988
|
-
visitorPass,
|
|
34989
|
-
passKeys
|
|
34990
|
-
);
|
|
34991
|
-
res.status(200).json({
|
|
34992
|
-
message: result || "Successfully changed visitor transaction keys."
|
|
34993
|
-
});
|
|
34994
|
-
return;
|
|
34995
|
-
} catch (error2) {
|
|
34996
|
-
import_node_server_utils107.logger.log({ level: "error", message: error2.message });
|
|
34997
|
-
next(error2);
|
|
34998
|
-
return;
|
|
34999
|
-
}
|
|
35000
|
-
}
|
|
35001
35027
|
return {
|
|
35002
35028
|
add,
|
|
35003
35029
|
getAll,
|
|
35004
35030
|
updateVisitorTansactionById,
|
|
35005
35031
|
deleteVisitorTransaction,
|
|
35006
35032
|
inviteVisitor,
|
|
35007
|
-
getVisitorTransactionById
|
|
35008
|
-
changeVisitorTransactionKeysById
|
|
35033
|
+
getVisitorTransactionById
|
|
35034
|
+
// changeVisitorTransactionKeysById,
|
|
35009
35035
|
};
|
|
35010
35036
|
}
|
|
35011
35037
|
|
|
@@ -69768,6 +69794,7 @@ function useHidAmicoController() {
|
|
|
69768
69794
|
useManpowerSitesSrvc,
|
|
69769
69795
|
useMemberController,
|
|
69770
69796
|
useMemberRepo,
|
|
69797
|
+
useMemberService,
|
|
69771
69798
|
useNewDashboardController,
|
|
69772
69799
|
useNewDashboardRepo,
|
|
69773
69800
|
useNfcPatrolLogController,
|