@7365admin1/core 2.63.0 → 2.64.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 +74 -1
- package/dist/index.js +372 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +371 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -6810,4 +6810,77 @@ declare function useRoleControllerV2(): {
|
|
|
6810
6810
|
createRole: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
6811
6811
|
};
|
|
6812
6812
|
|
|
6813
|
-
export { ANPRMode, AccessTypeProps, AppServiceType, AssignCardConfig, BuildingStatus, BulkCardUpdate, BulletinOrder, BulletinRecipient, BulletinSort, BulletinStatus, BulletinVideoOrder, BulletinVideoSort, Camera, CameraType, DEVICE_STATUS, DOBStatus, DayOfWeek, EAccessCardTypes, EAccessCardUserTypes, EmailSender, EntryOrder, EntrySort, EventOrder, EventSort, EventStatus, EventType, FacilitySort, FacilityStatus, GuestSort, GuestStatus, IAccessCard, IAccessCardTransaction, MAccessCard, MAccessCardTransaction, MAddress, MAttendance, MAttendanceSettings, MBillingConfiguration, MBillingItem, MBuilding, MBuildingUnit, MBulletinBoard, MBulletinVideo, MChat, MCustomer, MCustomerSite, MDocumentManagement, MEntryPassSettings, MEventManagement, MFeedback, MFile, MGuestManagement, MIncidentReport, MManpowerDesignations, MManpowerMonitoring, MManpowerRemarks, MManpowerSites, MMember, MNfcPatrolLog, MNfcPatrolRoute, MNfcPatrolSettings, MNfcPatrolSettingsUpdate, MNfcPatrolTag, MOccurrenceBook, MOccurrenceEntry, MOccurrenceSubject, MOnlineForm, MOrg, MOvernightParkingApprovalHours, MOvernightParkingRequest, MPatrolLog, MPatrolQuestion, MPatrolRoute, MPerson, MPromoCode, MRobot, MRole, MRoleV2, MServiceProvider, MServiceProviderBilling, MSession, MSite, MSiteCamera, MSiteFacility, MSiteFacilityBooking, MStatementOfAccount, MSubscription, MUnitBilling, MUser, MVehicle, MVehicleTransaction, MVerification, MVerificationV2, MVisitorTransaction, MWorkOrder, OrgNature, OvernightParkingRequestSort, OvernightParkingRequestStatus, PERSON_TYPES, PMDashboardCollection, PStatus, Period, PersonStatus, PersonType, PersonTypes, QrTagProps, SiteAddress, SiteCategories, SiteStatus, SortFields, SortOrder, Status, SubjectOrder, SubjectSort, SubscriptionType, TAccessMngmntSettings, TActionStatus, TAddress, TAffectedEntities, TAffectedInjured, TAppServiceType, TApprovedBy, TApprover, TAttendance, TAttendanceCheckIn, TAttendanceCheckOut, TAttendanceCheckTime, TAttendanceLocation, TAttendanceSettings, TAttendanceSettingsGetBySite, TAuthorities, TAuthoritiesCalled, TBilling, TBillingConfiguration, TBillingItem, TBuilding, TBuildingUnit, TBulletinBoard, TBulletinVideo, TCamera, TChat, TCheckPoint$1 as TCheckPoint, TComplaintInfo, TComplaintReceivedTo, TCounter, TCustomer, TCustomerSite, TDayNumber, TDaySchedule, TDefaultAccessCard, TDesignations, TDocs, TDocumentManagement, TEntryPassSettings, TEventManagement, TFeedback, TFeedbackMetadata, TFeedbackUpdate, TFeedbackUpdateCategory, TFeedbackUpdateServiceProvider, TFeedbackUpdateStatus, TFeedbackUpdateToCompleted, TFile, TFiles, TGetAttendancesByUserQuery, TGetAttendancesQuery, TGuestManagement, TIncidentInformation, TIncidentReport, TIncidentTypeAndTime, TInvoice, TKeyRef, TManpowerDesignations, TManpowerDesignationsUpdate, TManpowerMonitoring, TManpowerMonitoringUpdate, TManpowerRemarks, TManpowerRemarksStatusUpdate, TManpowerRemarksUpdate, TManpowerSearchFilter, TManpowerSites, TMember, TMemberUpdateStatus, TMiniRole, TNfcPatrolLog, TNfcPatrolRoute, TNfcPatrolRouteEdit, TNfcPatrolSettings, TNfcPatrolSettingsGetBySite, TNfcPatrolSettingsUpdate, TNfcPatrolTag, TNfcPatrolTagConfigureReset, TNfcPatrolTagEdit, TNfcPatrolTagUpdateData, TOccurrenceBook, TOccurrenceEntry, TOccurrenceSubject, TOnlineForm, TOrg, TOvernightParkingApprovalHours, TOvernightParkingRequest, TPatrolLog, TPatrolQuestion, TPatrolRoute, TPerson, TPlaceOfIncident, TPlates, TPrice, TPriceType, TPromoCode, TPromoTier, TRecipientOfComplaint, TRemarks, TResident, TRobot, TRobotMetadata, TRole, TRoleV2, TRoute, TSOABillingItem, TSOAStatus, TServiceProvider, TServiceProviderBilling, TSession, TSessionCreate, TShifts, TSite, TSiteCamera, TSiteFacility, TSiteFacilityBooking, TSiteInfo, TSiteInformation, TSiteMetadata, TSiteUpdateBlock, TStatementOfAccount, TSubmissionForm, TSubscription, TUnitBilling, TUnits, TUpdateName, TUser, TUserCreate, TVehicle, TVehicleTransaction, TVehicleUpdate, TVerification, TVerificationMetadata, TVerificationMetadataV2, TVerificationV2, TVisitorTransaction, TWorkOrder, TWorkOrderMetadata, TWorkOrderUpdate, TWorkOrderUpdateStatus, TWorkOrderUpdateToCompleted, TanyoneDamageToProperty, UseAccessManagementRepo, UserStatus, VehicleCategory, VehicleOrder, VehicleSort, VehicleStatus, VehicleType, VerificationLinkType, VerificationStatus, VerificationSubjectType, VerificationType, VisitorSort, VisitorStatus, addressSchema, allowedFieldsSite, allowedNatures, attendanceSchema, attendanceSettingsSchema, building_units_namespace_collection, buildings_namespace_collection, bulletin_boards_namespace_collection, calculatePercentage, chatSchema, createManpowerRemarksDaily, customerSchema, designationsSchema, events_namespace_collection, facility_bookings_namespace_collection, feedbackSchema, feedbacks2_namespace_collection, feedbacks_namespace_collection, formatDahuaDate, getPeriodRangeWithPrevious, guests_namespace_collection, incidentReport, incidentReportLog, incidents_namespace_collection, landscapeDashboardCollection, logCamera, mAndEDashboardCollection, manpowerDesignationsSchema, manpowerEvents, manpowerMonitoringSchema, manpowerRemarksSchema, manpowerSitesSchema, nfcPatrolSettingsSchema, nfcPatrolSettingsSchemaUpdate, occurrence_book_namespace_collection, orgSchema, overnight_parking_requests_namespace_collection, parseDahuaFind, pestDashboardCollection, poolDashboardCollection, promoCodeSchema, remarksSchema, robotSchema, schema, schemaApprovedBy, schemaApprover, schemaBilling, schemaBillingConfiguration, schemaBillingItem, schemaBuilding, schemaBuildingUnit, schemaBuildingUpdateOptions, schemaBulletinBoard, schemaBulletinVideo, schemaCustomerSite, schemaDocumentManagement, schemaEntryPassSettings, schemaEventManagement, schemaFiles, schemaGuestManagement, schemaIncidentReport, schemaNfcPatrolLog, schemaNfcPatrolRoute, schemaNfcPatrolTag, schemaNfcPatrolTagUpdateData, schemaOccurrenceBook, schemaOccurrenceEntry, schemaOccurrenceSubject, schemaOnlineForm, schemaOvernightParkingApprovalHours, schemaOvernightParkingRequest, schemaPatrolLog, schemaPatrolQuestion, schemaPatrolRoute, schemaPerson, schemaPlate, schemaServiceProvider, schemaServiceProviderBilling, schemaSiteCamera, schemaSiteFacility, schemaSiteFacilityBooking, schemaStatementOfAccount, schemaUnitBilling, schemaUpdateBulletinBoard, schemaUpdateBulletinVideo, schemaUpdateDocumentManagement, schemaUpdateEntryPassSettings, schemaUpdateEventManagement, schemaUpdateGuestManagement, schemaUpdateIncidentReport, schemaUpdateOccurrenceBook, schemaUpdateOccurrenceEntry, schemaUpdateOccurrenceSubject, schemaUpdateOnlineForm, schemaUpdateOptions, schemaUpdateOvernightParkingRequest, schemaUpdatePatrolLog, schemaUpdatePatrolQuestion, schemaUpdatePatrolRoute, schemaUpdatePerson, schemaUpdateServiceProviderBilling, schemaUpdateSiteBillingConfiguration, schemaUpdateSiteBillingItem, schemaUpdateSiteCamera, schemaUpdateSiteFacility, schemaUpdateSiteFacilityBooking, schemaUpdateSiteUnitBilling, schemaUpdateStatementOfAccount, schemaUpdateVisTrans, schemaVehicleTransaction, schemaVisitorTransaction, schemeCamera, schemeLogCamera, securityDashboardCollection, shiftSchema, siteSchema, site_people_namespace_collection, tokenSchema, updateRemarksStatusEod, updateRemarksisAcknowledged, updateSiteSchema, useAccessManagementController, useAddressRepo, useAttendanceController, useAttendanceRepository, useAttendanceSettingsController, useAttendanceSettingsRepository, useAttendanceSettingsService, useAuthController, useAuthControllerV2, useAuthService, useAuthServiceV2, useBuildingController, useBuildingRepo, useBuildingService, useBuildingUnitController, useBuildingUnitRepo, useBuildingUnitService, useBulletinBoardController, useBulletinBoardRepo, useBulletinBoardService, useBulletinVideoController, useBulletinVideoRepo, useBulletinVideoService, useChatController, useChatRepo, useCounterModel, useCounterRepo, useCustomerController, useCustomerRepo, useCustomerSiteController, useCustomerSiteRepo, useCustomerSiteService, useDahuaService, useDashboardController, useDashboardRepo, useDocumentManagementController, useDocumentManagementRepo, useDocumentManagementService, useEntryPassSettingsController, useEntryPassSettingsRepo, useEventManagementController, useEventManagementRepo, useEventManagementService, useFeedbackController, useFeedbackRepo, useFeedbackService, useFileController, useFileRepo, useFileService, useGuestManagementController, useGuestManagementRepo, useGuestManagementService, useHrmLabsAttendanceCtrl, useHrmLabsAttendanceSrvc, useIncidentReportController, useIncidentReportRepo, useIncidentReportService, useInvoiceController, useInvoiceModel, useInvoiceRepo, useManpowerDesignationCtrl, useManpowerDesignationRepo, useManpowerMonitoringCtrl, useManpowerMonitoringRepo, useManpowerMonitoringSrvc, useManpowerRemarkCtrl, useManpowerRemarksRepo, useManpowerSitesCtrl, useManpowerSitesRepo, useManpowerSitesSrvc, useMemberController, useMemberRepo, useNewDashboardController, useNewDashboardRepo, useNfcPatrolLogController, useNfcPatrolLogRepo, useNfcPatrolLogService, useNfcPatrolRouteController, useNfcPatrolRouteRepo, useNfcPatrolRouteService, useNfcPatrolSettingsController, useNfcPatrolSettingsRepository, useNfcPatrolSettingsService, useNfcPatrolTagController, useNfcPatrolTagRepo, useNfcPatrolTagService, useOccurrenceBookController, useOccurrenceBookRepo, useOccurrenceBookService, useOccurrenceEntryController, useOccurrenceEntryRepo, useOccurrenceEntryService, useOccurrenceSubjectController, useOccurrenceSubjectRepo, useOccurrenceSubjectService, useOnlineFormController, useOnlineFormRepo, useOrgController, useOrgControllerV2, useOrgRepo, useOvernightParkingController, useOvernightParkingRepo, useOvernightParkingRequestController, useOvernightParkingRequestRepo, useOvernightParkingRequestService, usePatrolLogController, usePatrolLogRepo, usePatrolQuestionController, usePatrolQuestionRepo, usePatrolRouteController, usePatrolRouteRepo, usePersonController, usePersonRepo, usePriceController, usePriceModel, usePriceRepo, usePromoCodeController, usePromoCodeRepo, useRedDotPaymentController, useRedDotPaymentRepo, useRedDotPaymentSvc, useRobotController, useRobotRepo, useRobotService, useRoleController, useRoleControllerV2, useRoleRepo, useRoleRepoV2, useRoleServiceV2, useServiceProviderBillingController, useServiceProviderBillingRepo, useServiceProviderBillingService, useServiceProviderController, useServiceProviderRepo, useSessionRepo, useSiteBillingConfigurationController, useSiteBillingConfigurationRepo, useSiteBillingItemController, useSiteBillingItemRepo, useSiteCameraController, useSiteCameraRepo, useSiteCameraService, useSiteController, useSiteFacilityBookingController, useSiteFacilityBookingRepo, useSiteFacilityBookingService, useSiteFacilityController, useSiteFacilityRepo, useSiteFacilityService, useSiteRepo, useSiteService, useSiteUnitBillingController, useSiteUnitBillingRepo, useSiteUnitBillingService, useStatementOfAccountController, useStatementOfAccountRepo, useSubscriptionController, useSubscriptionRepo, useSubscriptionService, useUserController, useUserControllerV2, useUserRepo, useUserRepoV2, useUserService, useUserServiceV2, useVehicleController, useVehicleRepo, useVehicleService, useVerificationController, useVerificationControllerV2, useVerificationRepo, useVerificationRepoV2, useVerificationService, useVerificationServiceV2, useVisitorTransactionController, useVisitorTransactionRepo, useVisitorTransactionService, useWorkOrderController, useWorkOrderRepo, useWorkOrderService, userSchema, vehicleSchema, vehicles_namespace_collection, visitors_namespace_collection, workOrderSchema, work_orders2_namespace_collection, work_orders_namespace_collection };
|
|
6813
|
+
declare enum PostStatus {
|
|
6814
|
+
PUBLISHED = "published",
|
|
6815
|
+
SOLD = "sold",
|
|
6816
|
+
DELETED = "deleted"
|
|
6817
|
+
}
|
|
6818
|
+
declare enum PostSort {
|
|
6819
|
+
CREATED_AT = "createdAt",
|
|
6820
|
+
TITLE = "title",
|
|
6821
|
+
PRICE = "price",
|
|
6822
|
+
ID = "_id"
|
|
6823
|
+
}
|
|
6824
|
+
declare enum PostOrder {
|
|
6825
|
+
ASC = "asc",
|
|
6826
|
+
DESC = "desc"
|
|
6827
|
+
}
|
|
6828
|
+
type TPost = {
|
|
6829
|
+
_id?: string | ObjectId;
|
|
6830
|
+
title?: string;
|
|
6831
|
+
description?: string;
|
|
6832
|
+
attachments?: Array<string | ObjectId>;
|
|
6833
|
+
category?: Array<string | ObjectId>;
|
|
6834
|
+
currency?: string;
|
|
6835
|
+
price?: number;
|
|
6836
|
+
status?: PostStatus;
|
|
6837
|
+
reserverId?: string | ObjectId;
|
|
6838
|
+
createdBy?: string | ObjectId;
|
|
6839
|
+
site?: string | ObjectId;
|
|
6840
|
+
createdAt?: string | Date;
|
|
6841
|
+
updatedAt?: string | Date;
|
|
6842
|
+
deletedAt?: string | Date;
|
|
6843
|
+
};
|
|
6844
|
+
declare const schemaPost: Joi.ObjectSchema<any>;
|
|
6845
|
+
declare function MPost(value: TPost): {
|
|
6846
|
+
_id: string | ObjectId;
|
|
6847
|
+
title: string;
|
|
6848
|
+
description: string;
|
|
6849
|
+
attachments: (string | ObjectId)[];
|
|
6850
|
+
category: (string | ObjectId)[];
|
|
6851
|
+
currency: string;
|
|
6852
|
+
price: number;
|
|
6853
|
+
status: PostStatus;
|
|
6854
|
+
reserverId: string | ObjectId | null;
|
|
6855
|
+
createdBy: string | ObjectId;
|
|
6856
|
+
site: string | ObjectId;
|
|
6857
|
+
createdAt: string | Date;
|
|
6858
|
+
updatedAt: string | Date | null;
|
|
6859
|
+
deletedAt: string | Date | null;
|
|
6860
|
+
};
|
|
6861
|
+
|
|
6862
|
+
declare function usePostPrelovedRepo(): {
|
|
6863
|
+
add: (value: TPost, session?: any) => Promise<ObjectId>;
|
|
6864
|
+
getById: (_id: string | ObjectId) => Promise<bson.Document>;
|
|
6865
|
+
getAll: ({ search, page, limit, filter, site, status, category, }: {
|
|
6866
|
+
search?: string | undefined;
|
|
6867
|
+
page?: number | undefined;
|
|
6868
|
+
limit?: number | undefined;
|
|
6869
|
+
filter?: string | undefined;
|
|
6870
|
+
site?: string | ObjectId | undefined;
|
|
6871
|
+
status?: string | string[] | undefined;
|
|
6872
|
+
category?: (string | ObjectId)[] | undefined;
|
|
6873
|
+
}, session?: any) => Promise<{
|
|
6874
|
+
items: any[];
|
|
6875
|
+
pages: number;
|
|
6876
|
+
pageRange: string;
|
|
6877
|
+
}>;
|
|
6878
|
+
};
|
|
6879
|
+
|
|
6880
|
+
declare function usePostPrelovedController(): {
|
|
6881
|
+
add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
6882
|
+
getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
6883
|
+
getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
6884
|
+
};
|
|
6885
|
+
|
|
6886
|
+
export { ANPRMode, AccessTypeProps, AppServiceType, AssignCardConfig, BuildingStatus, BulkCardUpdate, BulletinOrder, BulletinRecipient, BulletinSort, BulletinStatus, BulletinVideoOrder, BulletinVideoSort, Camera, CameraType, DEVICE_STATUS, DOBStatus, DayOfWeek, EAccessCardTypes, EAccessCardUserTypes, EmailSender, EntryOrder, EntrySort, EventOrder, EventSort, EventStatus, EventType, FacilitySort, FacilityStatus, GuestSort, GuestStatus, IAccessCard, IAccessCardTransaction, MAccessCard, MAccessCardTransaction, MAddress, MAttendance, MAttendanceSettings, MBillingConfiguration, MBillingItem, MBuilding, MBuildingUnit, MBulletinBoard, MBulletinVideo, MChat, MCustomer, MCustomerSite, MDocumentManagement, MEntryPassSettings, MEventManagement, MFeedback, MFile, MGuestManagement, MIncidentReport, MManpowerDesignations, MManpowerMonitoring, MManpowerRemarks, MManpowerSites, MMember, MNfcPatrolLog, MNfcPatrolRoute, MNfcPatrolSettings, MNfcPatrolSettingsUpdate, MNfcPatrolTag, MOccurrenceBook, MOccurrenceEntry, MOccurrenceSubject, MOnlineForm, MOrg, MOvernightParkingApprovalHours, MOvernightParkingRequest, MPatrolLog, MPatrolQuestion, MPatrolRoute, MPerson, MPost, MPromoCode, MRobot, MRole, MRoleV2, MServiceProvider, MServiceProviderBilling, MSession, MSite, MSiteCamera, MSiteFacility, MSiteFacilityBooking, MStatementOfAccount, MSubscription, MUnitBilling, MUser, MVehicle, MVehicleTransaction, MVerification, MVerificationV2, MVisitorTransaction, MWorkOrder, OrgNature, OvernightParkingRequestSort, OvernightParkingRequestStatus, PERSON_TYPES, PMDashboardCollection, PStatus, Period, PersonStatus, PersonType, PersonTypes, 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, TBilling, TBillingConfiguration, TBillingItem, TBuilding, TBuildingUnit, TBulletinBoard, TBulletinVideo, TCamera, TChat, TCheckPoint$1 as TCheckPoint, TComplaintInfo, TComplaintReceivedTo, TCounter, TCustomer, TCustomerSite, TDayNumber, TDaySchedule, TDefaultAccessCard, TDesignations, TDocs, TDocumentManagement, TEntryPassSettings, TEventManagement, TFeedback, TFeedbackMetadata, TFeedbackUpdate, TFeedbackUpdateCategory, TFeedbackUpdateServiceProvider, TFeedbackUpdateStatus, TFeedbackUpdateToCompleted, TFile, TFiles, TGetAttendancesByUserQuery, TGetAttendancesQuery, TGuestManagement, TIncidentInformation, TIncidentReport, TIncidentTypeAndTime, TInvoice, TKeyRef, TManpowerDesignations, TManpowerDesignationsUpdate, TManpowerMonitoring, TManpowerMonitoringUpdate, TManpowerRemarks, TManpowerRemarksStatusUpdate, TManpowerRemarksUpdate, TManpowerSearchFilter, TManpowerSites, TMember, TMemberUpdateStatus, TMiniRole, TNfcPatrolLog, TNfcPatrolRoute, TNfcPatrolRouteEdit, TNfcPatrolSettings, TNfcPatrolSettingsGetBySite, TNfcPatrolSettingsUpdate, TNfcPatrolTag, TNfcPatrolTagConfigureReset, TNfcPatrolTagEdit, TNfcPatrolTagUpdateData, TOccurrenceBook, TOccurrenceEntry, TOccurrenceSubject, TOnlineForm, TOrg, TOvernightParkingApprovalHours, TOvernightParkingRequest, TPatrolLog, TPatrolQuestion, TPatrolRoute, TPerson, TPlaceOfIncident, TPlates, TPost, TPrice, TPriceType, TPromoCode, TPromoTier, TRecipientOfComplaint, TRemarks, TResident, TRobot, TRobotMetadata, TRole, TRoleV2, TRoute, TSOABillingItem, TSOAStatus, TServiceProvider, TServiceProviderBilling, TSession, TSessionCreate, TShifts, TSite, TSiteCamera, TSiteFacility, TSiteFacilityBooking, TSiteInfo, TSiteInformation, TSiteMetadata, TSiteUpdateBlock, TStatementOfAccount, TSubmissionForm, TSubscription, TUnitBilling, TUnits, TUpdateName, TUser, TUserCreate, TVehicle, TVehicleTransaction, TVehicleUpdate, TVerification, TVerificationMetadata, TVerificationMetadataV2, TVerificationV2, TVisitorTransaction, TWorkOrder, TWorkOrderMetadata, TWorkOrderUpdate, TWorkOrderUpdateStatus, TWorkOrderUpdateToCompleted, TanyoneDamageToProperty, UseAccessManagementRepo, UserStatus, VehicleCategory, VehicleOrder, VehicleSort, VehicleStatus, VehicleType, VerificationLinkType, VerificationStatus, VerificationSubjectType, VerificationType, VisitorSort, VisitorStatus, addressSchema, allowedFieldsSite, allowedNatures, attendanceSchema, attendanceSettingsSchema, building_units_namespace_collection, buildings_namespace_collection, bulletin_boards_namespace_collection, calculatePercentage, chatSchema, createManpowerRemarksDaily, customerSchema, designationsSchema, events_namespace_collection, facility_bookings_namespace_collection, feedbackSchema, feedbacks2_namespace_collection, feedbacks_namespace_collection, formatDahuaDate, getPeriodRangeWithPrevious, guests_namespace_collection, incidentReport, incidentReportLog, incidents_namespace_collection, landscapeDashboardCollection, logCamera, mAndEDashboardCollection, manpowerDesignationsSchema, manpowerEvents, manpowerMonitoringSchema, manpowerRemarksSchema, manpowerSitesSchema, nfcPatrolSettingsSchema, nfcPatrolSettingsSchemaUpdate, occurrence_book_namespace_collection, orgSchema, overnight_parking_requests_namespace_collection, parseDahuaFind, pestDashboardCollection, poolDashboardCollection, promoCodeSchema, remarksSchema, robotSchema, schema, schemaApprovedBy, schemaApprover, schemaBilling, schemaBillingConfiguration, schemaBillingItem, schemaBuilding, schemaBuildingUnit, schemaBuildingUpdateOptions, schemaBulletinBoard, schemaBulletinVideo, schemaCustomerSite, schemaDocumentManagement, schemaEntryPassSettings, schemaEventManagement, schemaFiles, schemaGuestManagement, schemaIncidentReport, schemaNfcPatrolLog, schemaNfcPatrolRoute, schemaNfcPatrolTag, schemaNfcPatrolTagUpdateData, schemaOccurrenceBook, schemaOccurrenceEntry, schemaOccurrenceSubject, schemaOnlineForm, schemaOvernightParkingApprovalHours, schemaOvernightParkingRequest, schemaPatrolLog, schemaPatrolQuestion, schemaPatrolRoute, schemaPerson, schemaPlate, schemaPost, schemaServiceProvider, schemaServiceProviderBilling, schemaSiteCamera, schemaSiteFacility, schemaSiteFacilityBooking, schemaStatementOfAccount, schemaUnitBilling, schemaUpdateBulletinBoard, schemaUpdateBulletinVideo, schemaUpdateDocumentManagement, schemaUpdateEntryPassSettings, schemaUpdateEventManagement, schemaUpdateGuestManagement, schemaUpdateIncidentReport, schemaUpdateOccurrenceBook, schemaUpdateOccurrenceEntry, schemaUpdateOccurrenceSubject, schemaUpdateOnlineForm, schemaUpdateOptions, schemaUpdateOvernightParkingRequest, schemaUpdatePatrolLog, schemaUpdatePatrolQuestion, schemaUpdatePatrolRoute, schemaUpdatePerson, schemaUpdateServiceProviderBilling, schemaUpdateSiteBillingConfiguration, schemaUpdateSiteBillingItem, schemaUpdateSiteCamera, schemaUpdateSiteFacility, schemaUpdateSiteFacilityBooking, schemaUpdateSiteUnitBilling, schemaUpdateStatementOfAccount, schemaUpdateVisTrans, schemaVehicleTransaction, schemaVisitorTransaction, schemeCamera, schemeLogCamera, securityDashboardCollection, shiftSchema, siteSchema, site_people_namespace_collection, tokenSchema, updateRemarksStatusEod, updateRemarksisAcknowledged, updateSiteSchema, useAccessManagementController, useAddressRepo, useAttendanceController, useAttendanceRepository, useAttendanceSettingsController, useAttendanceSettingsRepository, useAttendanceSettingsService, useAuthController, useAuthControllerV2, useAuthService, useAuthServiceV2, useBuildingController, useBuildingRepo, useBuildingService, useBuildingUnitController, useBuildingUnitRepo, useBuildingUnitService, useBulletinBoardController, useBulletinBoardRepo, useBulletinBoardService, useBulletinVideoController, useBulletinVideoRepo, useBulletinVideoService, useChatController, useChatRepo, useCounterModel, useCounterRepo, useCustomerController, useCustomerRepo, useCustomerSiteController, useCustomerSiteRepo, useCustomerSiteService, useDahuaService, useDashboardController, useDashboardRepo, useDocumentManagementController, useDocumentManagementRepo, useDocumentManagementService, useEntryPassSettingsController, useEntryPassSettingsRepo, useEventManagementController, useEventManagementRepo, useEventManagementService, useFeedbackController, useFeedbackRepo, useFeedbackService, useFileController, useFileRepo, useFileService, useGuestManagementController, useGuestManagementRepo, useGuestManagementService, useHrmLabsAttendanceCtrl, useHrmLabsAttendanceSrvc, useIncidentReportController, useIncidentReportRepo, useIncidentReportService, useInvoiceController, useInvoiceModel, useInvoiceRepo, useManpowerDesignationCtrl, useManpowerDesignationRepo, useManpowerMonitoringCtrl, useManpowerMonitoringRepo, useManpowerMonitoringSrvc, useManpowerRemarkCtrl, useManpowerRemarksRepo, useManpowerSitesCtrl, useManpowerSitesRepo, useManpowerSitesSrvc, useMemberController, useMemberRepo, useNewDashboardController, useNewDashboardRepo, useNfcPatrolLogController, useNfcPatrolLogRepo, useNfcPatrolLogService, useNfcPatrolRouteController, useNfcPatrolRouteRepo, useNfcPatrolRouteService, useNfcPatrolSettingsController, useNfcPatrolSettingsRepository, useNfcPatrolSettingsService, useNfcPatrolTagController, useNfcPatrolTagRepo, useNfcPatrolTagService, useOccurrenceBookController, useOccurrenceBookRepo, useOccurrenceBookService, useOccurrenceEntryController, useOccurrenceEntryRepo, useOccurrenceEntryService, useOccurrenceSubjectController, useOccurrenceSubjectRepo, useOccurrenceSubjectService, useOnlineFormController, useOnlineFormRepo, useOrgController, useOrgControllerV2, useOrgRepo, useOvernightParkingController, useOvernightParkingRepo, useOvernightParkingRequestController, useOvernightParkingRequestRepo, useOvernightParkingRequestService, usePatrolLogController, usePatrolLogRepo, usePatrolQuestionController, usePatrolQuestionRepo, usePatrolRouteController, usePatrolRouteRepo, usePersonController, usePersonRepo, 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, 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
|
@@ -99,6 +99,7 @@ __export(src_exports, {
|
|
|
99
99
|
MPatrolQuestion: () => MPatrolQuestion,
|
|
100
100
|
MPatrolRoute: () => MPatrolRoute,
|
|
101
101
|
MPerson: () => MPerson,
|
|
102
|
+
MPost: () => MPost,
|
|
102
103
|
MPromoCode: () => MPromoCode,
|
|
103
104
|
MRobot: () => MRobot,
|
|
104
105
|
MRole: () => MRole,
|
|
@@ -129,6 +130,9 @@ __export(src_exports, {
|
|
|
129
130
|
Period: () => Period,
|
|
130
131
|
PersonStatus: () => PersonStatus,
|
|
131
132
|
PersonTypes: () => PersonTypes,
|
|
133
|
+
PostOrder: () => PostOrder,
|
|
134
|
+
PostSort: () => PostSort,
|
|
135
|
+
PostStatus: () => PostStatus,
|
|
132
136
|
SiteCategories: () => SiteCategories,
|
|
133
137
|
SiteStatus: () => SiteStatus,
|
|
134
138
|
SortFields: () => SortFields,
|
|
@@ -224,6 +228,7 @@ __export(src_exports, {
|
|
|
224
228
|
schemaPatrolRoute: () => schemaPatrolRoute,
|
|
225
229
|
schemaPerson: () => schemaPerson,
|
|
226
230
|
schemaPlate: () => schemaPlate,
|
|
231
|
+
schemaPost: () => schemaPost,
|
|
227
232
|
schemaServiceProvider: () => schemaServiceProvider,
|
|
228
233
|
schemaServiceProviderBilling: () => schemaServiceProviderBilling,
|
|
229
234
|
schemaSiteCamera: () => schemaSiteCamera,
|
|
@@ -382,6 +387,8 @@ __export(src_exports, {
|
|
|
382
387
|
usePatrolRouteRepo: () => usePatrolRouteRepo,
|
|
383
388
|
usePersonController: () => usePersonController,
|
|
384
389
|
usePersonRepo: () => usePersonRepo,
|
|
390
|
+
usePostPrelovedController: () => usePostPrelovedController,
|
|
391
|
+
usePostPrelovedRepo: () => usePostPrelovedRepo,
|
|
385
392
|
usePriceController: () => usePriceController,
|
|
386
393
|
usePriceModel: () => usePriceModel,
|
|
387
394
|
usePriceRepo: () => usePriceRepo,
|
|
@@ -53431,6 +53438,364 @@ function useRoleControllerV2() {
|
|
|
53431
53438
|
createRole
|
|
53432
53439
|
};
|
|
53433
53440
|
}
|
|
53441
|
+
|
|
53442
|
+
// src/models/post-preloved.model.ts
|
|
53443
|
+
var import_joi132 = __toESM(require("joi"));
|
|
53444
|
+
var import_mongodb129 = require("mongodb");
|
|
53445
|
+
var PostStatus = /* @__PURE__ */ ((PostStatus2) => {
|
|
53446
|
+
PostStatus2["PUBLISHED"] = "published";
|
|
53447
|
+
PostStatus2["SOLD"] = "sold";
|
|
53448
|
+
PostStatus2["DELETED"] = "deleted";
|
|
53449
|
+
return PostStatus2;
|
|
53450
|
+
})(PostStatus || {});
|
|
53451
|
+
var PostSort = /* @__PURE__ */ ((PostSort2) => {
|
|
53452
|
+
PostSort2["CREATED_AT"] = "createdAt";
|
|
53453
|
+
PostSort2["TITLE"] = "title";
|
|
53454
|
+
PostSort2["PRICE"] = "price";
|
|
53455
|
+
PostSort2["ID"] = "_id";
|
|
53456
|
+
return PostSort2;
|
|
53457
|
+
})(PostSort || {});
|
|
53458
|
+
var PostOrder = /* @__PURE__ */ ((PostOrder2) => {
|
|
53459
|
+
PostOrder2["ASC"] = "asc";
|
|
53460
|
+
PostOrder2["DESC"] = "desc";
|
|
53461
|
+
return PostOrder2;
|
|
53462
|
+
})(PostOrder || {});
|
|
53463
|
+
var schemaPost = import_joi132.default.object({
|
|
53464
|
+
_id: import_joi132.default.string().hex().optional().allow("", null),
|
|
53465
|
+
title: import_joi132.default.string().required(),
|
|
53466
|
+
description: import_joi132.default.string().optional().allow("", null),
|
|
53467
|
+
attachments: import_joi132.default.array().items(import_joi132.default.string().hex().optional()).optional().allow(null),
|
|
53468
|
+
category: import_joi132.default.array().items(import_joi132.default.string().hex().optional()).optional().allow(null),
|
|
53469
|
+
currency: import_joi132.default.string().optional().allow("", null),
|
|
53470
|
+
price: import_joi132.default.number().required(),
|
|
53471
|
+
status: import_joi132.default.string().valid(...Object.values(PostStatus)).optional().default("published" /* PUBLISHED */),
|
|
53472
|
+
reserverId: import_joi132.default.string().hex().optional().allow("", null),
|
|
53473
|
+
createdBy: import_joi132.default.string().hex().optional().allow("", null),
|
|
53474
|
+
site: import_joi132.default.string().hex().optional().allow("", null),
|
|
53475
|
+
createdAt: import_joi132.default.date().optional().allow(null),
|
|
53476
|
+
updatedAt: import_joi132.default.date().optional().allow(null),
|
|
53477
|
+
deletedAt: import_joi132.default.date().optional().allow(null)
|
|
53478
|
+
});
|
|
53479
|
+
function MPost(value) {
|
|
53480
|
+
const { error } = schemaPost.validate(value);
|
|
53481
|
+
if (error) {
|
|
53482
|
+
throw new Error(error.details[0].message);
|
|
53483
|
+
}
|
|
53484
|
+
if (value._id && typeof value._id === "string") {
|
|
53485
|
+
try {
|
|
53486
|
+
value._id = new import_mongodb129.ObjectId(value._id);
|
|
53487
|
+
} catch {
|
|
53488
|
+
throw new Error("Invalid ID.");
|
|
53489
|
+
}
|
|
53490
|
+
}
|
|
53491
|
+
if (value.site && typeof value.site === "string") {
|
|
53492
|
+
try {
|
|
53493
|
+
value.site = new import_mongodb129.ObjectId(value.site);
|
|
53494
|
+
} catch {
|
|
53495
|
+
throw new Error("Invalid site ID.");
|
|
53496
|
+
}
|
|
53497
|
+
}
|
|
53498
|
+
if (value.createdBy && typeof value.createdBy === "string") {
|
|
53499
|
+
try {
|
|
53500
|
+
value.createdBy = new import_mongodb129.ObjectId(value.createdBy);
|
|
53501
|
+
} catch {
|
|
53502
|
+
throw new Error("Invalid createdBy ID.");
|
|
53503
|
+
}
|
|
53504
|
+
}
|
|
53505
|
+
if (value.reserverId && typeof value.reserverId === "string") {
|
|
53506
|
+
try {
|
|
53507
|
+
value.reserverId = new import_mongodb129.ObjectId(value.reserverId);
|
|
53508
|
+
} catch {
|
|
53509
|
+
throw new Error("Invalid reserver ID.");
|
|
53510
|
+
}
|
|
53511
|
+
}
|
|
53512
|
+
if (value.attachments && Array.isArray(value.attachments)) {
|
|
53513
|
+
value.attachments = value.attachments.map((id) => {
|
|
53514
|
+
if (typeof id === "string") {
|
|
53515
|
+
try {
|
|
53516
|
+
return new import_mongodb129.ObjectId(id);
|
|
53517
|
+
} catch {
|
|
53518
|
+
throw new Error("Invalid attachment ID.");
|
|
53519
|
+
}
|
|
53520
|
+
}
|
|
53521
|
+
return id;
|
|
53522
|
+
});
|
|
53523
|
+
}
|
|
53524
|
+
if (value.category && Array.isArray(value.category)) {
|
|
53525
|
+
value.category = value.category.map((id) => {
|
|
53526
|
+
if (typeof id === "string") {
|
|
53527
|
+
try {
|
|
53528
|
+
return new import_mongodb129.ObjectId(id);
|
|
53529
|
+
} catch {
|
|
53530
|
+
throw new Error("Invalid category ID.");
|
|
53531
|
+
}
|
|
53532
|
+
}
|
|
53533
|
+
return id;
|
|
53534
|
+
});
|
|
53535
|
+
}
|
|
53536
|
+
return {
|
|
53537
|
+
_id: value._id ?? new import_mongodb129.ObjectId(),
|
|
53538
|
+
title: value.title ?? "",
|
|
53539
|
+
description: value.description ?? "",
|
|
53540
|
+
attachments: value.attachments ?? [],
|
|
53541
|
+
category: value.category ?? [],
|
|
53542
|
+
currency: value.currency ?? "",
|
|
53543
|
+
price: value.price ?? 0,
|
|
53544
|
+
status: value.status ?? "published" /* PUBLISHED */,
|
|
53545
|
+
reserverId: value.reserverId ?? null,
|
|
53546
|
+
createdBy: value.createdBy ?? "",
|
|
53547
|
+
site: value.site ?? "",
|
|
53548
|
+
createdAt: value.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
53549
|
+
updatedAt: value.updatedAt ?? null,
|
|
53550
|
+
deletedAt: value.deletedAt ?? null
|
|
53551
|
+
};
|
|
53552
|
+
}
|
|
53553
|
+
|
|
53554
|
+
// src/repositories/post-preloved.repo.ts
|
|
53555
|
+
var import_node_server_utils232 = require("@7365admin1/node-server-utils");
|
|
53556
|
+
var import_mongodb130 = require("mongodb");
|
|
53557
|
+
function usePostPrelovedRepo() {
|
|
53558
|
+
const db = import_node_server_utils232.useAtlas.getDb();
|
|
53559
|
+
if (!db) {
|
|
53560
|
+
throw new import_node_server_utils232.InternalServerError("Unable to connect to server.");
|
|
53561
|
+
}
|
|
53562
|
+
const POST_COLLECTION = "post-preloved";
|
|
53563
|
+
const USER_LOOKUP = {
|
|
53564
|
+
$lookup: {
|
|
53565
|
+
from: "users",
|
|
53566
|
+
localField: "createdBy",
|
|
53567
|
+
foreignField: "_id",
|
|
53568
|
+
pipeline: [
|
|
53569
|
+
{
|
|
53570
|
+
$project: {
|
|
53571
|
+
name: 1,
|
|
53572
|
+
profile: 1
|
|
53573
|
+
}
|
|
53574
|
+
}
|
|
53575
|
+
],
|
|
53576
|
+
as: "createdBy"
|
|
53577
|
+
}
|
|
53578
|
+
};
|
|
53579
|
+
const USER_UNWIND = {
|
|
53580
|
+
$unwind: {
|
|
53581
|
+
path: "$createdBy",
|
|
53582
|
+
preserveNullAndEmptyArrays: true
|
|
53583
|
+
}
|
|
53584
|
+
};
|
|
53585
|
+
const CATEGORY_LOOKUP = {
|
|
53586
|
+
$lookup: {
|
|
53587
|
+
from: "category-preloved",
|
|
53588
|
+
localField: "category",
|
|
53589
|
+
foreignField: "_id",
|
|
53590
|
+
as: "categories"
|
|
53591
|
+
}
|
|
53592
|
+
};
|
|
53593
|
+
const collection = db.collection(POST_COLLECTION);
|
|
53594
|
+
function buildSortObj(filter) {
|
|
53595
|
+
switch (filter) {
|
|
53596
|
+
case "price-low-high":
|
|
53597
|
+
return { price: 1 };
|
|
53598
|
+
case "price-high-low":
|
|
53599
|
+
return { price: -1 };
|
|
53600
|
+
case "recent":
|
|
53601
|
+
default:
|
|
53602
|
+
return { createdAt: -1 };
|
|
53603
|
+
}
|
|
53604
|
+
}
|
|
53605
|
+
async function add(value, session) {
|
|
53606
|
+
try {
|
|
53607
|
+
const doc = MPost(value);
|
|
53608
|
+
const res = await collection.insertOne(doc, { session });
|
|
53609
|
+
return res.insertedId;
|
|
53610
|
+
} catch (error) {
|
|
53611
|
+
const isDuplicated = error.message?.includes("duplicate");
|
|
53612
|
+
if (isDuplicated)
|
|
53613
|
+
throw new import_node_server_utils232.BadRequestError("Post already exists.");
|
|
53614
|
+
throw error;
|
|
53615
|
+
}
|
|
53616
|
+
}
|
|
53617
|
+
async function getById(_id) {
|
|
53618
|
+
try {
|
|
53619
|
+
_id = new import_mongodb130.ObjectId(_id);
|
|
53620
|
+
} catch {
|
|
53621
|
+
throw new import_node_server_utils232.BadRequestError("Invalid post ID format.");
|
|
53622
|
+
}
|
|
53623
|
+
try {
|
|
53624
|
+
const result = await collection.aggregate([
|
|
53625
|
+
{ $match: { _id, status: { $ne: "deleted" /* DELETED */ } } },
|
|
53626
|
+
USER_LOOKUP,
|
|
53627
|
+
USER_UNWIND,
|
|
53628
|
+
CATEGORY_LOOKUP
|
|
53629
|
+
]).toArray();
|
|
53630
|
+
const data = result[0] ?? null;
|
|
53631
|
+
if (!data)
|
|
53632
|
+
throw new import_node_server_utils232.NotFoundError("Post not found.");
|
|
53633
|
+
return data;
|
|
53634
|
+
} catch (error) {
|
|
53635
|
+
throw error;
|
|
53636
|
+
}
|
|
53637
|
+
}
|
|
53638
|
+
async function getAll({
|
|
53639
|
+
search = "",
|
|
53640
|
+
page = 1,
|
|
53641
|
+
limit = 10,
|
|
53642
|
+
filter,
|
|
53643
|
+
site,
|
|
53644
|
+
status,
|
|
53645
|
+
category
|
|
53646
|
+
}, session) {
|
|
53647
|
+
page = page > 0 ? page - 1 : 0;
|
|
53648
|
+
if (site) {
|
|
53649
|
+
try {
|
|
53650
|
+
site = new import_mongodb130.ObjectId(site);
|
|
53651
|
+
} catch {
|
|
53652
|
+
throw new import_node_server_utils232.BadRequestError("Invalid site ID format.");
|
|
53653
|
+
}
|
|
53654
|
+
}
|
|
53655
|
+
const categoryIds = category && Array.isArray(category) && category.length > 0 ? category.map((id) => {
|
|
53656
|
+
try {
|
|
53657
|
+
return new import_mongodb130.ObjectId(id);
|
|
53658
|
+
} catch {
|
|
53659
|
+
throw new import_node_server_utils232.BadRequestError("Invalid category ID format.");
|
|
53660
|
+
}
|
|
53661
|
+
}) : null;
|
|
53662
|
+
const query = {
|
|
53663
|
+
status: { $ne: "deleted" /* DELETED */ },
|
|
53664
|
+
...site && { site },
|
|
53665
|
+
...search && {
|
|
53666
|
+
$or: [
|
|
53667
|
+
{ title: { $regex: search, $options: "i" } },
|
|
53668
|
+
{ description: { $regex: search, $options: "i" } }
|
|
53669
|
+
]
|
|
53670
|
+
},
|
|
53671
|
+
...status && {
|
|
53672
|
+
status: { $in: Array.isArray(status) ? status : [status] }
|
|
53673
|
+
},
|
|
53674
|
+
...categoryIds && { category: { $in: categoryIds } }
|
|
53675
|
+
};
|
|
53676
|
+
const sortObj = buildSortObj(filter);
|
|
53677
|
+
try {
|
|
53678
|
+
const items = await collection.aggregate(
|
|
53679
|
+
[
|
|
53680
|
+
{ $match: query },
|
|
53681
|
+
USER_LOOKUP,
|
|
53682
|
+
USER_UNWIND,
|
|
53683
|
+
CATEGORY_LOOKUP,
|
|
53684
|
+
{ $sort: sortObj },
|
|
53685
|
+
{ $skip: page * limit },
|
|
53686
|
+
{ $limit: limit }
|
|
53687
|
+
],
|
|
53688
|
+
{ session }
|
|
53689
|
+
).toArray();
|
|
53690
|
+
const length = await collection.countDocuments(query, { session });
|
|
53691
|
+
return (0, import_node_server_utils232.paginate)(items, page, limit, length);
|
|
53692
|
+
} catch (error) {
|
|
53693
|
+
throw error;
|
|
53694
|
+
}
|
|
53695
|
+
}
|
|
53696
|
+
return {
|
|
53697
|
+
add,
|
|
53698
|
+
getById,
|
|
53699
|
+
getAll
|
|
53700
|
+
};
|
|
53701
|
+
}
|
|
53702
|
+
|
|
53703
|
+
// src/controllers/post-preloved.controller.ts
|
|
53704
|
+
var import_node_server_utils233 = require("@7365admin1/node-server-utils");
|
|
53705
|
+
var import_joi133 = __toESM(require("joi"));
|
|
53706
|
+
function usePostPrelovedController() {
|
|
53707
|
+
const {
|
|
53708
|
+
add: _add,
|
|
53709
|
+
getById: _getById,
|
|
53710
|
+
getAll: _getAll
|
|
53711
|
+
} = usePostPrelovedRepo();
|
|
53712
|
+
async function add(req, res, next) {
|
|
53713
|
+
const { error, value } = schemaPost.validate(req.body, {
|
|
53714
|
+
abortEarly: false
|
|
53715
|
+
});
|
|
53716
|
+
if (error) {
|
|
53717
|
+
const messages = error.details.map((d) => d.message).join(", ");
|
|
53718
|
+
import_node_server_utils233.logger.log({ level: "error", message: messages });
|
|
53719
|
+
next(new import_node_server_utils233.BadRequestError(messages));
|
|
53720
|
+
return;
|
|
53721
|
+
}
|
|
53722
|
+
try {
|
|
53723
|
+
const data = await _add(value);
|
|
53724
|
+
res.status(201).json(data);
|
|
53725
|
+
return;
|
|
53726
|
+
} catch (error2) {
|
|
53727
|
+
import_node_server_utils233.logger.log({ level: "error", message: error2.message });
|
|
53728
|
+
next(error2);
|
|
53729
|
+
return;
|
|
53730
|
+
}
|
|
53731
|
+
}
|
|
53732
|
+
async function getById(req, res, next) {
|
|
53733
|
+
const schema2 = import_joi133.default.object({
|
|
53734
|
+
_id: import_joi133.default.string().hex().length(24).required()
|
|
53735
|
+
});
|
|
53736
|
+
const { error, value } = schema2.validate({ _id: req.params.id });
|
|
53737
|
+
if (error) {
|
|
53738
|
+
import_node_server_utils233.logger.log({ level: "error", message: error.message });
|
|
53739
|
+
next(new import_node_server_utils233.BadRequestError(error.message));
|
|
53740
|
+
return;
|
|
53741
|
+
}
|
|
53742
|
+
try {
|
|
53743
|
+
const data = await _getById(value._id);
|
|
53744
|
+
res.status(200).json(data);
|
|
53745
|
+
return;
|
|
53746
|
+
} catch (error2) {
|
|
53747
|
+
import_node_server_utils233.logger.log({ level: "error", message: error2.message });
|
|
53748
|
+
next(error2);
|
|
53749
|
+
return;
|
|
53750
|
+
}
|
|
53751
|
+
}
|
|
53752
|
+
async function getAll(req, res, next) {
|
|
53753
|
+
const validation = import_joi133.default.object({
|
|
53754
|
+
page: import_joi133.default.number().integer().min(1).allow("", null).default(1),
|
|
53755
|
+
limit: import_joi133.default.number().integer().min(1).max(100).allow("", null).default(10),
|
|
53756
|
+
search: import_joi133.default.string().optional().allow("", null),
|
|
53757
|
+
filter: import_joi133.default.string().valid("recent", "price-low-high", "price-high-low").optional().allow("", null),
|
|
53758
|
+
site: import_joi133.default.string().hex().length(24).optional().allow("", null),
|
|
53759
|
+
status: import_joi133.default.alternatives().try(
|
|
53760
|
+
import_joi133.default.array().items(import_joi133.default.string().valid(...Object.values(PostStatus))),
|
|
53761
|
+
import_joi133.default.string().valid(...Object.values(PostStatus))
|
|
53762
|
+
).optional().allow(null),
|
|
53763
|
+
category: import_joi133.default.alternatives().try(import_joi133.default.array().items(import_joi133.default.string().hex()), import_joi133.default.string().hex()).optional().allow(null)
|
|
53764
|
+
});
|
|
53765
|
+
const { error, value } = validation.validate(req.query, {
|
|
53766
|
+
abortEarly: false
|
|
53767
|
+
});
|
|
53768
|
+
if (error) {
|
|
53769
|
+
const messages = error.details.map((d) => d.message).join(", ");
|
|
53770
|
+
import_node_server_utils233.logger.log({ level: "error", message: messages });
|
|
53771
|
+
next(new import_node_server_utils233.BadRequestError(messages));
|
|
53772
|
+
return;
|
|
53773
|
+
}
|
|
53774
|
+
const { page, limit, search, filter, site, status, category } = value;
|
|
53775
|
+
try {
|
|
53776
|
+
const data = await _getAll({
|
|
53777
|
+
page,
|
|
53778
|
+
limit,
|
|
53779
|
+
search,
|
|
53780
|
+
filter,
|
|
53781
|
+
site,
|
|
53782
|
+
status: status ? Array.isArray(status) ? status : [status] : void 0,
|
|
53783
|
+
category: category ? Array.isArray(category) ? category : [category] : void 0
|
|
53784
|
+
});
|
|
53785
|
+
res.status(200).json(data);
|
|
53786
|
+
return;
|
|
53787
|
+
} catch (error2) {
|
|
53788
|
+
import_node_server_utils233.logger.log({ level: "error", message: error2.message });
|
|
53789
|
+
next(error2);
|
|
53790
|
+
return;
|
|
53791
|
+
}
|
|
53792
|
+
}
|
|
53793
|
+
return {
|
|
53794
|
+
add,
|
|
53795
|
+
getById,
|
|
53796
|
+
getAll
|
|
53797
|
+
};
|
|
53798
|
+
}
|
|
53434
53799
|
// Annotate the CommonJS export names for ESM import in node:
|
|
53435
53800
|
0 && (module.exports = {
|
|
53436
53801
|
ANPRMode,
|
|
@@ -53502,6 +53867,7 @@ function useRoleControllerV2() {
|
|
|
53502
53867
|
MPatrolQuestion,
|
|
53503
53868
|
MPatrolRoute,
|
|
53504
53869
|
MPerson,
|
|
53870
|
+
MPost,
|
|
53505
53871
|
MPromoCode,
|
|
53506
53872
|
MRobot,
|
|
53507
53873
|
MRole,
|
|
@@ -53532,6 +53898,9 @@ function useRoleControllerV2() {
|
|
|
53532
53898
|
Period,
|
|
53533
53899
|
PersonStatus,
|
|
53534
53900
|
PersonTypes,
|
|
53901
|
+
PostOrder,
|
|
53902
|
+
PostSort,
|
|
53903
|
+
PostStatus,
|
|
53535
53904
|
SiteCategories,
|
|
53536
53905
|
SiteStatus,
|
|
53537
53906
|
SortFields,
|
|
@@ -53627,6 +53996,7 @@ function useRoleControllerV2() {
|
|
|
53627
53996
|
schemaPatrolRoute,
|
|
53628
53997
|
schemaPerson,
|
|
53629
53998
|
schemaPlate,
|
|
53999
|
+
schemaPost,
|
|
53630
54000
|
schemaServiceProvider,
|
|
53631
54001
|
schemaServiceProviderBilling,
|
|
53632
54002
|
schemaSiteCamera,
|
|
@@ -53785,6 +54155,8 @@ function useRoleControllerV2() {
|
|
|
53785
54155
|
usePatrolRouteRepo,
|
|
53786
54156
|
usePersonController,
|
|
53787
54157
|
usePersonRepo,
|
|
54158
|
+
usePostPrelovedController,
|
|
54159
|
+
usePostPrelovedRepo,
|
|
53788
54160
|
usePriceController,
|
|
53789
54161
|
usePriceModel,
|
|
53790
54162
|
usePriceRepo,
|