@7365admin1/core 3.32.2-staging.81 → 3.32.2-staging.82

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/dist/index.d.ts CHANGED
@@ -9594,12 +9594,20 @@ declare function useNotificationRepo(): {
9594
9594
  pageRange: string;
9595
9595
  }>;
9596
9596
  markAsReadById: (_id: string, userId: string) => Promise<mongodb.WithId<TNotification>>;
9597
+ markAllAsRead: (userId: string, appSlug?: string) => Promise<{
9598
+ modifiedCount: number;
9599
+ }>;
9600
+ getUnreadCount: (userId: string, appSlug?: string) => Promise<{
9601
+ unread: number;
9602
+ }>;
9597
9603
  };
9598
9604
 
9599
9605
  declare function useNotificationController(): {
9600
9606
  add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
9601
9607
  getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
9602
9608
  markAsRead: (req: Request, res: Response, next: NextFunction) => Promise<void>;
9609
+ markAllAsRead: (req: Request, res: Response, next: NextFunction) => Promise<void>;
9610
+ getUnreadCount: (req: Request, res: Response, next: NextFunction) => Promise<void>;
9603
9611
  };
9604
9612
 
9605
9613
  export { ANPRMode, AccessTypeProps, AppServiceType, AssignCardConfig, BidStatus, BidType, BuildingLevelStatus, BuildingStatus, BulkCardUpdate, BulletinOrder, BulletinRecipient, BulletinSort, BulletinStatus, BulletinVideoOrder, BulletinVideoSort, CAMERA_ANPR_PERMISSIONS, CAMERA_CAPABILITIES, CAMERA_CAPABILITY_REASONS, CAMERA_NOT_PATROL_OR_CCTV, CAMERA_PTZ_PERMISSIONS, CAMERA_REQUEST_TIMEOUT_MS, CAMERA_RTSP_TIMEOUT_MS, CAMERA_SETUP_PERMISSIONS, CAMERA_SNAPSHOT_CACHE_SECONDS, CAMERA_SNAPSHOT_MAX_BYTES, CAMERA_TEST_MIN_INTERVAL_SECONDS, CAMERA_TEST_ROUND_LIMIT, CAMERA_TEST_ROUND_SECONDS, CAMERA_TYPE_ANPR, CAMERA_TYPE_IP, CAMERA_VIEW_PERMISSIONS, CLOCK_DRIFT_WARN_SECONDS, CURRENT_TIME_ENDPOINT, Camera, CameraAddressInput, CameraCapability, CameraCapabilityContext, CameraCapabilityDescriptor, CameraCapabilityEntry, CameraCapabilityReason, CameraCapabilityState, CameraCapabilityTrace, CameraDevice, CameraMembership, CameraTestStatus, CameraTransport, CameraType, DEVICE_STATUS, DOBStatus, DayOfWeek, DeviceHttpTarget, DeviceProbeResult, DynamicFormFields, EAccessCardTypes, EAccessCardUserTypes, EmailSender, EntryOrder, EntrySort, EventOrder, EventSort, EventStatus, EventType, FacilitySort, FacilityStatus, FormEntryStatus, GuestSort, GuestStatus, HID_PERMISSION_CATEGORIES, IAccessCard, IAccessCardTransaction, MAX_CAMERA_CHANNEL, 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, MHidSipAccount, MHidSitePermissions, MIncidentReport, MManpowerDesignations, MManpowerMonitoring, MManpowerRemarks, MManpowerSites, MMember, MNfcPatrolLog, MNfcPatrolRoute, MNfcPatrolSettings, MNfcPatrolSettingsUpdate, MNfcPatrolTag, MNotification, 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, MSubscriptionPlan, MUnitBilling, MUser, MVehicle, MVehicleTransaction, MVerification, MVerificationV2, MVisitorTransaction, MWorkOrder, NotificationAppSlug, NotificationModule, OrgNature, OvernightParkingRequestSort, OvernightParkingRequestStatus, PATROL_CCTV_CAMERA_FILTER, PERSON_TYPES, PStatus, PTZ_ALLOWED_ACTIONS, PTZ_ALLOWED_CODES, Period, PersonStatus, PersonType, PersonTypes, PostOrder, PostSort, PostStatus, QrTagProps, ResidentAppModuleKey, SOFTWARE_VERSION_ENDPOINT, 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, TCreateNfcPatrolLog, TCustomer, TCustomerSite, TDayNumber, TDaySchedule, TDefaultAccessCard, TDesignations, TDocs, TDocumentCreate, TDocumentManagement, TEntryPassSettings, TEventManagement, TFeedback, TFeedbackMetadata, TFeedbackUpdate, TFeedbackUpdateCategory, TFeedbackUpdateServiceProvider, TFeedbackUpdateStatus, TFeedbackUpdateToCompleted, TFile, TFiles, TFolderUpdate, TFormEntry, TGetAttendancesByUserQuery, TGetAttendancesQuery, TGuestManagement, THidAmicoEvent, THidAmicoIdentity, THidAmicoReader, THidPermissionAssignment, THidPermissionCategory, THidSipAccount, THidSitePermissions, 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, TNotification, TOccurrenceBook, TOccurrenceEntry, TOccurrenceSubject, TOnlineForm, TOrg, TOvernightParkingApprovalHours, TOvernightParkingRequest, TPatrolLog, TPatrolQuestion, TPatrolRoute, TPerson, TPlaceOfIncident, TPlates, TPost, TPostFavorite, TPrice, TPriceType, TPromoCode, TPromoTier, TRANSPORT_DEVICE_HTTP, TRANSPORT_RELAY_PLAYER, TRANSPORT_RTSP_FRAME, TRecipientOfComplaint, TRemarks, TResident, TResidentAppModules, TRobot, TRobotMetadata, TRole, TRoleV2, TRoute, TSOABillingItem, TSOAStatus, TServiceProvider, TServiceProviderBilling, TSession, TSessionCreate, TShifts, TSignNfcPatrolLog, TSite, TSiteCamera, TSiteFacility, TSiteFacilityBooking, TSiteInfo, TSiteInformation, TSiteMetadata, TSiteUpdateBlock, TStatementOfAccount, TSubcategoryPreloved, TSubmissionForm, TSubscription, TSubscriptionPlan, TSubscriptionPlanApplication, 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, allowedPlanApplications, attendanceSchema, attendanceSettingsSchema, building_level_namespace_collection, building_units_namespace_collection, buildings_namespace_collection, bulletin_boards_namespace_collection, cameraBaseUrl, cameraCapabilitiesFor, cameraDevices, cameraGrant, cameraHealthSummary, cameraManagePermissions, cameraTransports, chatPrelovedEvents, chatSchema, clampPtzSpeed, clockDriftSeconds, createManpowerRemarksDaily, customerSchema, deriveCameraHost, describeCameraCapabilities, designationsSchema, deviceControlEnabled, deviceHttpEnabled, deviceHttpTargets, deviceHttpTimeoutMs, deviceProbeTtlSeconds, events_namespace_collection, facility_bookings_namespace_collection, feedbackSchema, feedbacks2_namespace_collection, feedbacks_namespace_collection, ffmpegFrameArgs, ffmpegPath, formatCapabilityTrace, formatDahuaDate, guests_namespace_collection, hasAnyCapability, hasAnyPermission, incidentReport, incidentReportLog, incidents_namespace_collection, isCameraEntitled, isPatrolCctvCamera, isRelayPlayerUrl, logCamera, manpowerDesignationsSchema, manpowerEvents, manpowerMonitoringSchema, manpowerRemarksSchema, manpowerSitesSchema, mapWithLimit, nfcPatrolSettingsSchema, nfcPatrolSettingsSchemaUpdate, occurrence_book_namespace_collection, online_forms_namespace_collection, orgSchema, overnight_parking_requests_namespace_collection, parseCameraChannel, parseCameraHost, parseDahuaFind, parseDeviceTime, parseSoftwareVersion, promoCodeSchema, ptzEndpoint, publicCameraFields, registerCameraTransport, relayForRecorder, remarksSchema, resetCameraTransports, residentAppModuleKeys, residentFormEntry, resolutionRefusalReason, resolveCamera, resolveDeviceHttp, robotSchema, rtspUrl, schema, schemaAppSlugNotification, schemaApprovedBy, schemaApprover, schemaBidPreloved, schemaBilling, schemaBillingConfiguration, schemaBillingItem, schemaBuilding, schemaBuildingLevel, schemaBuildingUnit, schemaBuildingUpdateOptions, schemaBulletinBoard, schemaBulletinVideo, schemaCategoryPreloved, schemaChannelPreloved, schemaChatPreloved, schemaCreateHidAmicoIdentity, schemaCreateNfcPatrolLog, schemaCreateNotification, schemaCustomerSite, schemaDocumentManagement, schemaEntryPassSettings, schemaEventManagement, schemaFiles, schemaFormEntry, schemaGuestManagement, schemaHidAmicoConfiguration, schemaHidAmicoEvent, schemaHidAmicoExecuteActions, schemaHidAmicoIdentity, schemaHidAmicoIdentityIdParams, schemaHidAmicoIdentityQuery, schemaHidAmicoIntercomCall, schemaHidAmicoLogQuery, schemaHidAmicoNotificationParams, schemaHidAmicoObjectOperation, schemaHidAmicoReader, schemaHidAmicoReaderIdParams, schemaHidAmicoReaderListQuery, schemaHidAmicoSetConfiguration, schemaHidAmicoSiteIdParams, schemaHidAmicoSync, schemaHidAmicoUserImageParams, schemaHidAmicoUserImageUploadQuery, schemaHidAmicoVisitorImageParams, schemaHidAmicoVisitorImageUploadQuery, schemaHidAmicoVisitorQr, schemaHidPermissionCandidateQuery, schemaHidPermissionScopeQuery, schemaHidSipAccountRequest, schemaIncidentReport, schemaListNotification, schemaMultipleDocumentManagement, schemaNfcPatrolLog, schemaNfcPatrolRoute, schemaNfcPatrolTag, schemaNfcPatrolTagUpdateData, schemaNotification, schemaOccurrenceBook, schemaOccurrenceEntry, schemaOccurrenceSubject, schemaOnlineForm, schemaOvernightParkingApprovalHours, schemaOvernightParkingRequest, schemaPatrolLog, schemaPatrolQuestion, schemaPatrolRoute, schemaPerson, schemaPlate, schemaPost, schemaPostFavorite, schemaServiceProvider, schemaServiceProviderBilling, schemaSignNfcPatrolLog, schemaSiteCamera, schemaSiteFacility, schemaSiteFacilityBooking, schemaStatementOfAccount, schemaSubcategoryPreloved, schemaUnitBilling, schemaUpdateBidPreloved, schemaUpdateBuildingLevel, schemaUpdateBulletinBoard, schemaUpdateBulletinVideo, schemaUpdateCategoryPreloved, schemaUpdateChatPreloved, schemaUpdateDocumentManagement, schemaUpdateEntryPassSettings, schemaUpdateEventManagement, schemaUpdateFolderManagement, schemaUpdateFormEntry, schemaUpdateGuestManagement, schemaUpdateHidAmicoIdentity, schemaUpdateHidAmicoReader, schemaUpdateHidSitePermissions, schemaUpdateIncidentReport, schemaUpdateNotification, 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, sessionSchema, shiftSchema, siteSchema, site_people_namespace_collection, snapshotEndpoint, snapshotRefusalReason, subscriptionPlanSchema, updateRemarksStatusEod, updateRemarksisAcknowledged, updateSiteSchema, useAccessManagementController, useAddressRepo, useAttendanceController, useAttendanceRepository, useAttendanceSettingsController, useAttendanceSettingsRepository, useAttendanceSettingsService, useAuthController, useAuthControllerV2, useAuthService, useAuthServiceV2, useBidPrelovedController, useBidPrelovedRepo, useBidPrelovedService, useBuildingController, useBuildingLevelController, useBuildingLevelRepo, useBuildingLevelService, useBuildingRepo, useBuildingService, useBuildingUnitController, useBuildingUnitRepo, useBuildingUnitService, useBulletinBoardController, useBulletinBoardRepo, useBulletinBoardService, useBulletinVideoController, useBulletinVideoRepo, useBulletinVideoService, useCameraViewController, useCameraViewService, 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, useNotificationController, useNotificationRepo, 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, useSubscriptionPlanController, useSubscriptionPlanRepo, 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, visitorPersonRepo, visitorPersonService, visitorType, visitors_namespace_collection, wallConfig, workOrderSchema, work_orders2_namespace_collection, work_orders_namespace_collection };
package/dist/index.js CHANGED
@@ -38835,7 +38835,8 @@ var schemaListNotification = import_joi60.default.object({
38835
38835
  user: import_joi60.default.string().hex().length(24).optional()
38836
38836
  });
38837
38837
  var schemaAppSlugNotification = import_joi60.default.object({
38838
- appSlug: schemaNotification.extract("appSlug")
38838
+ appSlug: schemaNotification.extract("appSlug"),
38839
+ user: import_joi60.default.string().hex().length(24).required()
38839
38840
  });
38840
38841
  function MNotification(value) {
38841
38842
  const { error } = schemaNotification.validate(value);
@@ -39023,11 +39024,53 @@ function useNotificationRepo() {
39023
39024
  throw new import_node_server_utils114.InternalServerError("Failed to update notification.");
39024
39025
  }
39025
39026
  }
39027
+ async function markAllAsRead(userId, appSlug) {
39028
+ if (!import_mongodb70.ObjectId.isValid(userId)) {
39029
+ throw new import_node_server_utils114.BadRequestError("Invalid user ID format.");
39030
+ }
39031
+ try {
39032
+ const now = /* @__PURE__ */ new Date();
39033
+ const res = await collection().updateMany(
39034
+ {
39035
+ userId: new import_mongodb70.ObjectId(userId),
39036
+ hasRead: false,
39037
+ status: { $ne: "deleted" },
39038
+ ...appSlug && { appSlug }
39039
+ },
39040
+ { $set: { hasRead: true, readAt: now, updatedAt: now } }
39041
+ );
39042
+ return { modifiedCount: res.modifiedCount };
39043
+ } catch (error) {
39044
+ if (error instanceof import_node_server_utils114.AppError)
39045
+ throw error;
39046
+ import_node_server_utils114.logger.log({ level: "error", message: error.message });
39047
+ throw new import_node_server_utils114.InternalServerError("Failed to update notifications.");
39048
+ }
39049
+ }
39050
+ async function getUnreadCount(userId, appSlug) {
39051
+ if (!import_mongodb70.ObjectId.isValid(userId)) {
39052
+ throw new import_node_server_utils114.BadRequestError("Invalid user ID format.");
39053
+ }
39054
+ try {
39055
+ const unread = await collection().countDocuments({
39056
+ userId: new import_mongodb70.ObjectId(userId),
39057
+ status: { $ne: "deleted" },
39058
+ hasRead: false,
39059
+ ...appSlug && { appSlug }
39060
+ });
39061
+ return { unread };
39062
+ } catch (error) {
39063
+ import_node_server_utils114.logger.log({ level: "error", message: error.message });
39064
+ throw new import_node_server_utils114.InternalServerError("Failed to retrieve unread count.");
39065
+ }
39066
+ }
39026
39067
  return {
39027
39068
  createIndexes,
39028
39069
  addMany,
39029
39070
  getByUserId,
39030
- markAsReadById
39071
+ markAsReadById,
39072
+ markAllAsRead,
39073
+ getUnreadCount
39031
39074
  };
39032
39075
  }
39033
39076
 
@@ -39074,6 +39117,7 @@ var NotificationService = class {
39074
39117
  status: payload.status,
39075
39118
  module: "feedback",
39076
39119
  screen: "/(user)/bulletinInfo",
39120
+ siteId: payload.siteId?.toString(),
39077
39121
  params: {
39078
39122
  id: payload.bulletinId.toString()
39079
39123
  }
@@ -39126,6 +39170,7 @@ var NotificationService = class {
39126
39170
  status: payload.status,
39127
39171
  module: "onlineForm",
39128
39172
  screen,
39173
+ siteId: payload.siteId?.toString(),
39129
39174
  params
39130
39175
  },
39131
39176
  false,
@@ -39142,6 +39187,7 @@ var NotificationService = class {
39142
39187
  status: payload.status,
39143
39188
  module: "feedback",
39144
39189
  screen: "/(user)/(bulletin-board)",
39190
+ siteId: payload.siteId?.toString(),
39145
39191
  params: {
39146
39192
  id: payload.bulletinId.toString()
39147
39193
  }
@@ -39160,6 +39206,7 @@ var NotificationService = class {
39160
39206
  status: payload.status,
39161
39207
  module: "event",
39162
39208
  screen: "/(user)/(events)",
39209
+ siteId: payload.siteId?.toString(),
39163
39210
  params: {
39164
39211
  id: payload.eventId.toString()
39165
39212
  }
@@ -39195,6 +39242,7 @@ var NotificationService = class {
39195
39242
  status: payload.status,
39196
39243
  module: "bulletinBoard",
39197
39244
  screen: "/(user)/bulletinInfo",
39245
+ siteId: payload.siteId?.toString(),
39198
39246
  params: {
39199
39247
  id: payload.bulletinId.toString()
39200
39248
  }
@@ -46720,14 +46768,16 @@ function useBulletinBoardService() {
46720
46768
  to: userIds,
46721
46769
  bulletinId: bulletinBoardId,
46722
46770
  subject: "Bulletin Board",
46723
- status: bulletinBoardStatus
46771
+ status: bulletinBoardStatus,
46772
+ siteId
46724
46773
  });
46725
46774
  }
46726
46775
  NotificationService.bulletinBoardCreatedForMA({
46727
46776
  to: userIds,
46728
46777
  bulletinId: bulletinBoardId,
46729
46778
  subject: "Bulletin Board",
46730
- status: bulletinBoardStatus
46779
+ status: bulletinBoardStatus,
46780
+ siteId
46731
46781
  });
46732
46782
  }
46733
46783
  if (recipients?.find((item) => item === "mechanical_electrical")) {
@@ -46744,7 +46794,8 @@ function useBulletinBoardService() {
46744
46794
  to: users2,
46745
46795
  bulletinId: bulletinBoardId,
46746
46796
  subject: "Bulletin Board",
46747
- status: bulletinBoardStatus
46797
+ status: bulletinBoardStatus,
46798
+ siteId
46748
46799
  },
46749
46800
  "iservice365-m-and-e-mobile-app"
46750
46801
  );
@@ -46763,7 +46814,8 @@ function useBulletinBoardService() {
46763
46814
  to: users2,
46764
46815
  bulletinId: bulletinBoardId,
46765
46816
  subject: "Bulletin Board",
46766
- status: bulletinBoardStatus
46817
+ status: bulletinBoardStatus,
46818
+ siteId
46767
46819
  },
46768
46820
  "iservice365-pest-control-mobile-app"
46769
46821
  );
@@ -46782,7 +46834,8 @@ function useBulletinBoardService() {
46782
46834
  to: users2,
46783
46835
  bulletinId: bulletinBoardId,
46784
46836
  subject: "Bulletin Board",
46785
- status: bulletinBoardStatus
46837
+ status: bulletinBoardStatus,
46838
+ siteId
46786
46839
  },
46787
46840
  "iservice365-pool-maintenance-mobile-app"
46788
46841
  );
@@ -46801,7 +46854,8 @@ function useBulletinBoardService() {
46801
46854
  to: users2,
46802
46855
  bulletinId: bulletinBoardId,
46803
46856
  subject: "Bulletin Board",
46804
- status: bulletinBoardStatus
46857
+ status: bulletinBoardStatus,
46858
+ siteId
46805
46859
  },
46806
46860
  "iservice365-landscaping-mobile-app"
46807
46861
  );
@@ -46820,7 +46874,8 @@ function useBulletinBoardService() {
46820
46874
  to: users2,
46821
46875
  bulletinId: bulletinBoardId,
46822
46876
  subject: "Bulletin Board",
46823
- status: bulletinBoardStatus
46877
+ status: bulletinBoardStatus,
46878
+ siteId
46824
46879
  },
46825
46880
  "iservice365-hygiene-mobile-app"
46826
46881
  );
@@ -48761,7 +48816,8 @@ function useEventManagementService() {
48761
48816
  NotificationService.eventCreatedForMA({
48762
48817
  to: userIds,
48763
48818
  eventId: response,
48764
- status: value.status
48819
+ status: value.status,
48820
+ siteId: value.site
48765
48821
  });
48766
48822
  }
48767
48823
  await session?.commitTransaction();
@@ -74181,7 +74237,8 @@ function useFormEntryRepo() {
74181
74237
  await NotificationService.onlineFormRequestStatusUpdated({
74182
74238
  to: userId,
74183
74239
  onlineFormId: onlineFormRequest._id,
74184
- status: onlineFormRequest.status
74240
+ status: onlineFormRequest.status,
74241
+ siteId: onlineFormRequest.site
74185
74242
  });
74186
74243
  return res.modifiedCount;
74187
74244
  } catch (error) {
@@ -77973,7 +78030,9 @@ function useNotificationController() {
77973
78030
  const {
77974
78031
  addMany: _addMany,
77975
78032
  getByUserId: _getByUserId,
77976
- markAsReadById: _markAsReadById
78033
+ markAsReadById: _markAsReadById,
78034
+ markAllAsRead: _markAllAsRead,
78035
+ getUnreadCount: _getUnreadCount
77977
78036
  } = useNotificationRepo();
77978
78037
  async function add(req, res, next) {
77979
78038
  const { error, value } = schemaCreateNotification.validate(req.body);
@@ -78042,10 +78101,47 @@ function useNotificationController() {
78042
78101
  return;
78043
78102
  }
78044
78103
  }
78104
+ async function markAllAsRead(req, res, next) {
78105
+ const { error, value } = schemaAppSlugNotification.validate(req.query);
78106
+ if (error) {
78107
+ next(new import_node_server_utils271.BadRequestError(error.message));
78108
+ return;
78109
+ }
78110
+ try {
78111
+ const data = await _markAllAsRead(value.user, value.appSlug || void 0);
78112
+ res.status(200).json({ message: "success", data });
78113
+ return;
78114
+ } catch (error2) {
78115
+ import_node_server_utils271.logger.log({ level: "error", message: error2.message });
78116
+ next(error2);
78117
+ return;
78118
+ }
78119
+ }
78120
+ async function getUnreadCount(req, res, next) {
78121
+ const { error, value } = schemaAppSlugNotification.validate(req.query);
78122
+ if (error) {
78123
+ next(new import_node_server_utils271.BadRequestError(error.message));
78124
+ return;
78125
+ }
78126
+ try {
78127
+ const data = await _getUnreadCount(
78128
+ value.user,
78129
+ value.appSlug || void 0
78130
+ );
78131
+ res.status(200).json({ data });
78132
+ return;
78133
+ } catch (error2) {
78134
+ import_node_server_utils271.logger.log({ level: "error", message: error2.message });
78135
+ next(error2);
78136
+ return;
78137
+ }
78138
+ }
78045
78139
  return {
78046
78140
  add,
78047
78141
  getAll,
78048
- markAsRead
78142
+ markAsRead,
78143
+ markAllAsRead,
78144
+ getUnreadCount
78049
78145
  };
78050
78146
  }
78051
78147
  // Annotate the CommonJS export names for ESM import in node: