@7365admin1/core 3.32.2-staging.71 → 3.32.2-staging.73
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 +16 -0
- package/dist/index.js +134 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +138 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -9520,10 +9520,26 @@ declare function MNotification(value: TNotification): {
|
|
|
9520
9520
|
declare function useNotificationRepo(): {
|
|
9521
9521
|
createIndexes: () => Promise<string>;
|
|
9522
9522
|
addMany: (userIds: string[], base: Omit<TNotification, "_id" | "userId">) => Promise<number>;
|
|
9523
|
+
getByUserId: ({ userId, appSlug, page, limit, hasRead, siteId, search, }: {
|
|
9524
|
+
userId: string;
|
|
9525
|
+
appSlug?: string | undefined;
|
|
9526
|
+
page?: number | undefined;
|
|
9527
|
+
limit?: number | undefined;
|
|
9528
|
+
hasRead?: boolean | undefined;
|
|
9529
|
+
siteId?: string | undefined;
|
|
9530
|
+
search?: string | undefined;
|
|
9531
|
+
}) => Promise<{
|
|
9532
|
+
items: any[];
|
|
9533
|
+
pages: number;
|
|
9534
|
+
pageRange: string;
|
|
9535
|
+
}>;
|
|
9536
|
+
markAsReadById: (_id: string, userId: string) => Promise<mongodb.WithId<TNotification>>;
|
|
9523
9537
|
};
|
|
9524
9538
|
|
|
9525
9539
|
declare function useNotificationController(): {
|
|
9526
9540
|
add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
9541
|
+
getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
9542
|
+
markAsRead: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
9527
9543
|
};
|
|
9528
9544
|
|
|
9529
9545
|
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, 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, 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, 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, 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, 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
|
@@ -38071,6 +38071,7 @@ var schemaNotification = import_joi58.default.object({
|
|
|
38071
38071
|
});
|
|
38072
38072
|
var schemaUpdateNotification = import_joi58.default.object({
|
|
38073
38073
|
_id: import_joi58.default.string().hex().length(24).required(),
|
|
38074
|
+
user: import_joi58.default.string().hex().length(24).required(),
|
|
38074
38075
|
hasRead: import_joi58.default.boolean().optional()
|
|
38075
38076
|
});
|
|
38076
38077
|
var schemaCreateNotification = import_joi58.default.object({
|
|
@@ -38088,8 +38089,9 @@ var schemaListNotification = import_joi58.default.object({
|
|
|
38088
38089
|
limit: import_joi58.default.number().integer().min(1).max(50).allow("", null).default(10),
|
|
38089
38090
|
search: import_joi58.default.string().trim().optional().allow("", null).default(""),
|
|
38090
38091
|
hasRead: schemaNotification.extract("hasRead").allow("", null),
|
|
38091
|
-
|
|
38092
|
-
appSlug: schemaNotification.extract("appSlug")
|
|
38092
|
+
siteId: schemaNotification.extract("siteId"),
|
|
38093
|
+
appSlug: schemaNotification.extract("appSlug"),
|
|
38094
|
+
user: import_joi58.default.string().hex().length(24).optional()
|
|
38093
38095
|
});
|
|
38094
38096
|
var schemaAppSlugNotification = import_joi58.default.object({
|
|
38095
38097
|
appSlug: schemaNotification.extract("appSlug")
|
|
@@ -38168,10 +38170,10 @@ function useNotificationRepo() {
|
|
|
38168
38170
|
key: {
|
|
38169
38171
|
userId: 1,
|
|
38170
38172
|
appSlug: 1,
|
|
38171
|
-
|
|
38173
|
+
siteId: 1,
|
|
38172
38174
|
createdAt: -1
|
|
38173
38175
|
},
|
|
38174
|
-
name: "
|
|
38176
|
+
name: "inbox_list_by_site"
|
|
38175
38177
|
}
|
|
38176
38178
|
]);
|
|
38177
38179
|
return `Successfully created indexes for ${namespace_collection}.`;
|
|
@@ -38209,9 +38211,82 @@ function useNotificationRepo() {
|
|
|
38209
38211
|
throw new import_node_server_utils111.InternalServerError("Failed to create notifications.");
|
|
38210
38212
|
}
|
|
38211
38213
|
}
|
|
38214
|
+
async function getByUserId({
|
|
38215
|
+
userId,
|
|
38216
|
+
appSlug,
|
|
38217
|
+
page = 1,
|
|
38218
|
+
limit = 10,
|
|
38219
|
+
hasRead,
|
|
38220
|
+
siteId,
|
|
38221
|
+
search = ""
|
|
38222
|
+
}) {
|
|
38223
|
+
if (!import_mongodb68.ObjectId.isValid(userId)) {
|
|
38224
|
+
throw new import_node_server_utils111.BadRequestError("Invalid user ID format.");
|
|
38225
|
+
}
|
|
38226
|
+
if (siteId && !import_mongodb68.ObjectId.isValid(siteId)) {
|
|
38227
|
+
throw new import_node_server_utils111.BadRequestError("Invalid site ID format.");
|
|
38228
|
+
}
|
|
38229
|
+
page = page > 0 ? page - 1 : 0;
|
|
38230
|
+
const query2 = {
|
|
38231
|
+
userId: new import_mongodb68.ObjectId(userId),
|
|
38232
|
+
status: { $ne: "deleted" },
|
|
38233
|
+
...appSlug && { appSlug },
|
|
38234
|
+
...hasRead !== void 0 && { hasRead },
|
|
38235
|
+
...siteId && { siteId: new import_mongodb68.ObjectId(siteId) },
|
|
38236
|
+
...search && {
|
|
38237
|
+
$or: [
|
|
38238
|
+
{ title: { $regex: search, $options: "i" } },
|
|
38239
|
+
{ body: { $regex: search, $options: "i" } }
|
|
38240
|
+
]
|
|
38241
|
+
}
|
|
38242
|
+
};
|
|
38243
|
+
try {
|
|
38244
|
+
const [items, totalCount] = await Promise.all([
|
|
38245
|
+
collection().find(query2).sort({ createdAt: -1, _id: -1 }).skip(page * limit).limit(limit).toArray(),
|
|
38246
|
+
collection().countDocuments(query2)
|
|
38247
|
+
]);
|
|
38248
|
+
return (0, import_node_server_utils111.paginate)(items, page, limit, totalCount);
|
|
38249
|
+
} catch (error) {
|
|
38250
|
+
if (error instanceof import_node_server_utils111.AppError)
|
|
38251
|
+
throw error;
|
|
38252
|
+
import_node_server_utils111.logger.log({ level: "error", message: error.message });
|
|
38253
|
+
throw new import_node_server_utils111.InternalServerError("Failed to retrieve notifications.");
|
|
38254
|
+
}
|
|
38255
|
+
}
|
|
38256
|
+
async function markAsReadById(_id, userId) {
|
|
38257
|
+
if (!import_mongodb68.ObjectId.isValid(_id)) {
|
|
38258
|
+
throw new import_node_server_utils111.BadRequestError("Invalid notification ID format.");
|
|
38259
|
+
}
|
|
38260
|
+
if (!import_mongodb68.ObjectId.isValid(userId)) {
|
|
38261
|
+
throw new import_node_server_utils111.BadRequestError("Invalid user ID format.");
|
|
38262
|
+
}
|
|
38263
|
+
try {
|
|
38264
|
+
const now = /* @__PURE__ */ new Date();
|
|
38265
|
+
const doc = await collection().findOneAndUpdate(
|
|
38266
|
+
{
|
|
38267
|
+
_id: new import_mongodb68.ObjectId(_id),
|
|
38268
|
+
userId: new import_mongodb68.ObjectId(userId),
|
|
38269
|
+
status: { $ne: "deleted" }
|
|
38270
|
+
},
|
|
38271
|
+
{ $set: { hasRead: true, readAt: now, updatedAt: now } },
|
|
38272
|
+
{ returnDocument: "after" }
|
|
38273
|
+
);
|
|
38274
|
+
if (!doc) {
|
|
38275
|
+
throw new import_node_server_utils111.NotFoundError("Notification not found.");
|
|
38276
|
+
}
|
|
38277
|
+
return doc;
|
|
38278
|
+
} catch (error) {
|
|
38279
|
+
if (error instanceof import_node_server_utils111.AppError)
|
|
38280
|
+
throw error;
|
|
38281
|
+
import_node_server_utils111.logger.log({ level: "error", message: error.message });
|
|
38282
|
+
throw new import_node_server_utils111.InternalServerError("Failed to update notification.");
|
|
38283
|
+
}
|
|
38284
|
+
}
|
|
38212
38285
|
return {
|
|
38213
38286
|
createIndexes,
|
|
38214
|
-
addMany
|
|
38287
|
+
addMany,
|
|
38288
|
+
getByUserId,
|
|
38289
|
+
markAsReadById
|
|
38215
38290
|
};
|
|
38216
38291
|
}
|
|
38217
38292
|
|
|
@@ -38276,6 +38351,7 @@ var NotificationService = class {
|
|
|
38276
38351
|
status: payload.status,
|
|
38277
38352
|
module: "prelovedMarketplace",
|
|
38278
38353
|
screen: "/(user)/(marketplace)/prelovedPostInfo",
|
|
38354
|
+
siteId: payload.siteId?.toString(),
|
|
38279
38355
|
params: {
|
|
38280
38356
|
id: payload.prelovedId.toString()
|
|
38281
38357
|
}
|
|
@@ -71205,7 +71281,8 @@ function usePostFavoriteService() {
|
|
|
71205
71281
|
to: userIds,
|
|
71206
71282
|
prelovedId: postId,
|
|
71207
71283
|
subject: "Preloved Marketplace Post",
|
|
71208
|
-
status: "Published"
|
|
71284
|
+
status: "Published",
|
|
71285
|
+
siteId
|
|
71209
71286
|
});
|
|
71210
71287
|
}
|
|
71211
71288
|
await session?.commitTransaction();
|
|
@@ -76858,15 +76935,11 @@ function useHidAmicoController() {
|
|
|
76858
76935
|
// src/controllers/notification.controller.ts
|
|
76859
76936
|
var import_node_server_utils268 = require("@7365admin1/node-server-utils");
|
|
76860
76937
|
function useNotificationController() {
|
|
76861
|
-
const {
|
|
76862
|
-
|
|
76863
|
-
|
|
76864
|
-
|
|
76865
|
-
|
|
76866
|
-
throw new import_node_server_utils268.BadRequestError("Unable to resolve current user.");
|
|
76867
|
-
}
|
|
76868
|
-
return String(id);
|
|
76869
|
-
}
|
|
76938
|
+
const {
|
|
76939
|
+
addMany: _addMany,
|
|
76940
|
+
getByUserId: _getByUserId,
|
|
76941
|
+
markAsReadById: _markAsReadById
|
|
76942
|
+
} = useNotificationRepo();
|
|
76870
76943
|
async function add(req, res, next) {
|
|
76871
76944
|
const { error, value } = schemaCreateNotification.validate(req.body);
|
|
76872
76945
|
if (error) {
|
|
@@ -76891,8 +76964,53 @@ function useNotificationController() {
|
|
|
76891
76964
|
return;
|
|
76892
76965
|
}
|
|
76893
76966
|
}
|
|
76967
|
+
async function getAll(req, res, next) {
|
|
76968
|
+
const { error, value } = schemaListNotification.validate(req.query);
|
|
76969
|
+
if (error) {
|
|
76970
|
+
next(new import_node_server_utils268.BadRequestError(error.message));
|
|
76971
|
+
return;
|
|
76972
|
+
}
|
|
76973
|
+
try {
|
|
76974
|
+
const data = await _getByUserId({
|
|
76975
|
+
userId: value.user,
|
|
76976
|
+
appSlug: value.appSlug || void 0,
|
|
76977
|
+
page: value.page,
|
|
76978
|
+
limit: value.limit,
|
|
76979
|
+
hasRead: value.hasRead === "" ? void 0 : value.hasRead,
|
|
76980
|
+
siteId: value.siteId || void 0,
|
|
76981
|
+
search: value.search
|
|
76982
|
+
});
|
|
76983
|
+
res.status(200).json({ data });
|
|
76984
|
+
return;
|
|
76985
|
+
} catch (error2) {
|
|
76986
|
+
import_node_server_utils268.logger.log({ level: "error", message: error2.message });
|
|
76987
|
+
next(error2);
|
|
76988
|
+
return;
|
|
76989
|
+
}
|
|
76990
|
+
}
|
|
76991
|
+
async function markAsRead(req, res, next) {
|
|
76992
|
+
const { error, value } = schemaUpdateNotification.validate({
|
|
76993
|
+
_id: req.params.id,
|
|
76994
|
+
user: req.params.user
|
|
76995
|
+
});
|
|
76996
|
+
if (error) {
|
|
76997
|
+
next(new import_node_server_utils268.BadRequestError(error.message));
|
|
76998
|
+
return;
|
|
76999
|
+
}
|
|
77000
|
+
try {
|
|
77001
|
+
const data = await _markAsReadById(value._id, value.user);
|
|
77002
|
+
res.status(200).json({ message: "success", data });
|
|
77003
|
+
return;
|
|
77004
|
+
} catch (error2) {
|
|
77005
|
+
import_node_server_utils268.logger.log({ level: "error", message: error2.message });
|
|
77006
|
+
next(error2);
|
|
77007
|
+
return;
|
|
77008
|
+
}
|
|
77009
|
+
}
|
|
76894
77010
|
return {
|
|
76895
|
-
add
|
|
77011
|
+
add,
|
|
77012
|
+
getAll,
|
|
77013
|
+
markAsRead
|
|
76896
77014
|
};
|
|
76897
77015
|
}
|
|
76898
77016
|
// Annotate the CommonJS export names for ESM import in node:
|