@7365admin1/core 2.17.0 → 2.18.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/dist/index.d.ts CHANGED
@@ -1870,6 +1870,15 @@ declare enum VehicleStatus {
1870
1870
  INACTIVE = "inactive",
1871
1871
  DELETED = "deleted"
1872
1872
  }
1873
+ declare enum VehicleOrder {
1874
+ ASC = "asc",
1875
+ DESC = "desc"
1876
+ }
1877
+ declare enum VehicleSort {
1878
+ CREATED_AT = "createdAt",
1879
+ ID = "_id",
1880
+ NAME = "name"
1881
+ }
1873
1882
  declare enum OrgNature {
1874
1883
  PROPERTY_MANAGEMENT_AGENCY = "property_management_agency",
1875
1884
  SECURITY_AGENCY = "security_agency"
@@ -1954,6 +1963,12 @@ declare function useVehicleRepo(): {
1954
1963
  sort?: Record<string, any> | undefined;
1955
1964
  }) => Promise<{}>;
1956
1965
  deleteExpiredVehicles: (session?: ClientSession) => Promise<number>;
1966
+ getAllVehiclesByUnitId: ({ unitId, page, limit, sort, }: {
1967
+ unitId: string | ObjectId;
1968
+ page?: number | undefined;
1969
+ limit?: number | undefined;
1970
+ sort?: Record<string, 1 | -1> | undefined;
1971
+ }) => Promise<{}>;
1957
1972
  };
1958
1973
 
1959
1974
  declare function useVehicleService(): {
@@ -1975,6 +1990,7 @@ declare function useVehicleController(): {
1975
1990
  approveVehicleById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1976
1991
  getVehiclesByNRIC: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1977
1992
  reactivateVehicleById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1993
+ getAllVehiclesByUnitId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1978
1994
  };
1979
1995
 
1980
1996
  type TCamera = {
@@ -5105,4 +5121,4 @@ declare function useAddressRepo(): {
5105
5121
  getByUserId: (user: string | ObjectId) => Promise<TAddress | null>;
5106
5122
  };
5107
5123
 
5108
- export { ANPRMode, AccessTypeProps, AssignCardConfig, BULLETIN_RECIPIENTS, BuildingStatus, BulkCardUpdate, Camera, DEVICE_STATUS, EAccessCardTypes, EAccessCardUserTypes, IAccessCard, IAccessCardTransaction, MAccessCard, MAccessCardTransaction, MAddress, MAttendance, MAttendanceSettings, MBillingConfiguration, MBillingItem, MBuilding, MBuildingUnit, MBulletinBoard, MBulletinVideo, MChat, MCustomer, MCustomerSite, MDocumentManagement, MEntryPassSettings, MEventManagement, MFeedback, MFile, MGuestManagement, MIncidentReport, MMember, MNfcPatrolLog, MNfcPatrolRoute, MNfcPatrolSettings, MNfcPatrolSettingsUpdate, MNfcPatrolTag, MOccurrenceBook, MOccurrenceEntry, MOccurrenceSubject, MOnlineForm, MOrg, MPatrolLog, MPatrolQuestion, MPatrolRoute, MPerson, MPromoCode, MRobot, MRole, MServiceProvider, MServiceProviderBilling, MSession, MSite, MSiteCamera, MSiteFacility, MSiteFacilityBooking, MStatementOfAccount, MSubscription, MUnitBilling, MUser, MVehicle, MVehicleTransaction, MVerification, MVisitorTransaction, MWorkOrder, OrgNature, PERSON_TYPES, PersonType, QrTagProps, STATUS_VALUES, SiteAddress, SiteCategories, SiteStatus, SiteType, SortFields, SortOrder, TAccessMngmntSettings, TActionStatus, TAddress, TAffectedEntities, TAffectedInjured, 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, TDefaultAccessCard, TDocs, TDocumentManagement, TEntryPassSettings, TEventManagement, TFeedback, TFeedbackMetadata, TFeedbackUpdate, TFeedbackUpdateCategory, TFeedbackUpdateServiceProvider, TFeedbackUpdateStatus, TFeedbackUpdateToCompleted, TFile, TFiles, TGetAttendancesByUserQuery, TGetAttendancesQuery, TGuestManagement, TIncidentInformation, TIncidentReport, TIncidentTypeAndTime, TInvoice, TMember, TMemberUpdateStatus, TMiniRole, TNfcPatrolLog, TNfcPatrolRoute, TNfcPatrolRouteEdit, TNfcPatrolSettings, TNfcPatrolSettingsGetBySite, TNfcPatrolSettingsUpdate, TNfcPatrolTag, TNfcPatrolTagConfigureReset, TNfcPatrolTagEdit, TNfcPatrolTagUpdateData, TOccurrenceBook, TOccurrenceEntry, TOccurrenceSubject, TOnlineForm, TOrg, TPatrolLog, TPatrolQuestion, TPatrolRoute, TPerson, TPlaceOfIncident, TPlates, TPrice, TPriceType, TPromoCode, TPromoTier, TRecipientOfComplaint, TRobot, TRobotMetadata, TRole, TRoute, TSOABillingItem, TSOAStatus, TServiceProvider, TServiceProviderBilling, TSession, TSessionCreate, TSite, TSiteCamera, TSiteFacility, TSiteFacilityBooking, TSiteInfo, TSiteMetadata, TSiteUpdateBlock, TStatementOfAccount, TSubmissionForm, TSubscription, TUnitBilling, TUnits, TUpdateName, TUser, TUserCreate, TVehicle, TVehicleTransaction, TVehicleUpdate, TVerification, TVerificationMetadata, TVisitorTransaction, TWorkOrder, TWorkOrderMetadata, TWorkOrderUpdate, TWorkOrderUpdateStatus, TWorkOrderUpdateToCompleted, TanyoneDamageToProperty, UseAccessManagementRepo, VehicleCategory, VehicleStatus, VehicleType, allowedFieldsSite, allowedNatures, attendanceSchema, attendanceSettingsSchema, chatSchema, customerSchema, feedbackSchema, logCamera, nfcPatrolSettingsSchema, nfcPatrolSettingsSchemaUpdate, orgSchema, promoCodeSchema, robotSchema, schema, schemaBilling, schemaBillingConfiguration, schemaBillingItem, schemaBuilding, schemaBuildingUnit, schemaBuildingUpdateOptions, schemaBulletinBoard, schemaBulletinVideo, schemaCustomerSite, schemaDocumentManagement, schemaEntryPassSettings, schemaEventManagement, schemaFiles, schemaGuestManagement, schemaIncidentReport, schemaNfcPatrolLog, schemaNfcPatrolRoute, schemaNfcPatrolTag, schemaNfcPatrolTagUpdateData, schemaOccurrenceBook, schemaOccurrenceEntry, schemaOccurrenceSubject, schemaOnlineForm, schemaPatrolLog, schemaPatrolQuestion, schemaPatrolRoute, schemaPerson, schemaPlate, schemaServiceProvider, schemaServiceProviderBilling, schemaSiteCamera, schemaSiteFacility, schemaSiteFacilityBooking, schemaStatementOfAccount, schemaUnitBilling, schemaUpdateBulletinBoard, schemaUpdateBulletinVideo, schemaUpdateDocumentManagement, schemaUpdateEntryPassSettings, schemaUpdateEventManagement, schemaUpdateGuestManagement, schemaUpdateIncidentReport, schemaUpdateOccurrenceBook, schemaUpdateOccurrenceEntry, schemaUpdateOccurrenceSubject, schemaUpdateOnlineForm, schemaUpdateOptions, schemaUpdatePatrolLog, schemaUpdatePatrolQuestion, schemaUpdatePatrolRoute, schemaUpdatePerson, schemaUpdateServiceProviderBilling, schemaUpdateSiteBillingConfiguration, schemaUpdateSiteBillingItem, schemaUpdateSiteCamera, schemaUpdateSiteFacility, schemaUpdateSiteUnitBilling, schemaUpdateStatementOfAccount, schemaUpdateVisTrans, schemaVehicleTransaction, schemaVisitorTransaction, schemeCamera, schemeLogCamera, siteSchema, tokenSchema, updateSiteSchema, useAccessManagementController, useAddressRepo, useAttendanceController, useAttendanceRepository, useAttendanceSettingsController, useAttendanceSettingsRepository, useAttendanceSettingsService, useAuthController, useAuthService, 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, useIncidentReportController, useIncidentReportRepo, useIncidentReportService, useInvoiceController, useInvoiceModel, useInvoiceRepo, useMemberController, useMemberRepo, useNfcPatrolLogController, useNfcPatrolLogRepo, useNfcPatrolLogService, useNfcPatrolRouteController, useNfcPatrolRouteRepo, useNfcPatrolRouteService, useNfcPatrolSettingsController, useNfcPatrolSettingsRepository, useNfcPatrolSettingsService, useNfcPatrolTagController, useNfcPatrolTagRepo, useNfcPatrolTagService, useOccurrenceBookController, useOccurrenceBookRepo, useOccurrenceBookService, useOccurrenceEntryController, useOccurrenceEntryRepo, useOccurrenceEntryService, useOccurrenceSubjectController, useOccurrenceSubjectRepo, useOccurrenceSubjectService, useOnlineFormController, useOnlineFormRepo, useOrgController, useOrgRepo, usePatrolLogController, usePatrolLogRepo, usePatrolQuestionController, usePatrolQuestionRepo, usePatrolRouteController, usePatrolRouteRepo, usePersonController, usePersonRepo, usePriceController, usePriceModel, usePriceRepo, usePromoCodeController, usePromoCodeRepo, useRobotController, useRobotRepo, useRobotService, useRoleController, useRoleRepo, 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, useUserRepo, useUserService, useVehicleController, useVehicleRepo, useVehicleService, useVerificationController, useVerificationRepo, useVerificationService, useVisitorTransactionController, useVisitorTransactionRepo, useVisitorTransactionService, useWorkOrderController, useWorkOrderRepo, useWorkOrderService, userSchema, vehicleSchema, workOrderSchema };
5124
+ export { ANPRMode, AccessTypeProps, AssignCardConfig, BULLETIN_RECIPIENTS, BuildingStatus, BulkCardUpdate, Camera, DEVICE_STATUS, EAccessCardTypes, EAccessCardUserTypes, IAccessCard, IAccessCardTransaction, MAccessCard, MAccessCardTransaction, MAddress, MAttendance, MAttendanceSettings, MBillingConfiguration, MBillingItem, MBuilding, MBuildingUnit, MBulletinBoard, MBulletinVideo, MChat, MCustomer, MCustomerSite, MDocumentManagement, MEntryPassSettings, MEventManagement, MFeedback, MFile, MGuestManagement, MIncidentReport, MMember, MNfcPatrolLog, MNfcPatrolRoute, MNfcPatrolSettings, MNfcPatrolSettingsUpdate, MNfcPatrolTag, MOccurrenceBook, MOccurrenceEntry, MOccurrenceSubject, MOnlineForm, MOrg, MPatrolLog, MPatrolQuestion, MPatrolRoute, MPerson, MPromoCode, MRobot, MRole, MServiceProvider, MServiceProviderBilling, MSession, MSite, MSiteCamera, MSiteFacility, MSiteFacilityBooking, MStatementOfAccount, MSubscription, MUnitBilling, MUser, MVehicle, MVehicleTransaction, MVerification, MVisitorTransaction, MWorkOrder, OrgNature, PERSON_TYPES, PersonType, QrTagProps, STATUS_VALUES, SiteAddress, SiteCategories, SiteStatus, SiteType, SortFields, SortOrder, TAccessMngmntSettings, TActionStatus, TAddress, TAffectedEntities, TAffectedInjured, 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, TDefaultAccessCard, TDocs, TDocumentManagement, TEntryPassSettings, TEventManagement, TFeedback, TFeedbackMetadata, TFeedbackUpdate, TFeedbackUpdateCategory, TFeedbackUpdateServiceProvider, TFeedbackUpdateStatus, TFeedbackUpdateToCompleted, TFile, TFiles, TGetAttendancesByUserQuery, TGetAttendancesQuery, TGuestManagement, TIncidentInformation, TIncidentReport, TIncidentTypeAndTime, TInvoice, TMember, TMemberUpdateStatus, TMiniRole, TNfcPatrolLog, TNfcPatrolRoute, TNfcPatrolRouteEdit, TNfcPatrolSettings, TNfcPatrolSettingsGetBySite, TNfcPatrolSettingsUpdate, TNfcPatrolTag, TNfcPatrolTagConfigureReset, TNfcPatrolTagEdit, TNfcPatrolTagUpdateData, TOccurrenceBook, TOccurrenceEntry, TOccurrenceSubject, TOnlineForm, TOrg, TPatrolLog, TPatrolQuestion, TPatrolRoute, TPerson, TPlaceOfIncident, TPlates, TPrice, TPriceType, TPromoCode, TPromoTier, TRecipientOfComplaint, TRobot, TRobotMetadata, TRole, TRoute, TSOABillingItem, TSOAStatus, TServiceProvider, TServiceProviderBilling, TSession, TSessionCreate, TSite, TSiteCamera, TSiteFacility, TSiteFacilityBooking, TSiteInfo, TSiteMetadata, TSiteUpdateBlock, TStatementOfAccount, TSubmissionForm, TSubscription, TUnitBilling, TUnits, TUpdateName, TUser, TUserCreate, TVehicle, TVehicleTransaction, TVehicleUpdate, TVerification, TVerificationMetadata, TVisitorTransaction, TWorkOrder, TWorkOrderMetadata, TWorkOrderUpdate, TWorkOrderUpdateStatus, TWorkOrderUpdateToCompleted, TanyoneDamageToProperty, UseAccessManagementRepo, VehicleCategory, VehicleOrder, VehicleSort, VehicleStatus, VehicleType, allowedFieldsSite, allowedNatures, attendanceSchema, attendanceSettingsSchema, chatSchema, customerSchema, feedbackSchema, logCamera, nfcPatrolSettingsSchema, nfcPatrolSettingsSchemaUpdate, orgSchema, promoCodeSchema, robotSchema, schema, schemaBilling, schemaBillingConfiguration, schemaBillingItem, schemaBuilding, schemaBuildingUnit, schemaBuildingUpdateOptions, schemaBulletinBoard, schemaBulletinVideo, schemaCustomerSite, schemaDocumentManagement, schemaEntryPassSettings, schemaEventManagement, schemaFiles, schemaGuestManagement, schemaIncidentReport, schemaNfcPatrolLog, schemaNfcPatrolRoute, schemaNfcPatrolTag, schemaNfcPatrolTagUpdateData, schemaOccurrenceBook, schemaOccurrenceEntry, schemaOccurrenceSubject, schemaOnlineForm, schemaPatrolLog, schemaPatrolQuestion, schemaPatrolRoute, schemaPerson, schemaPlate, schemaServiceProvider, schemaServiceProviderBilling, schemaSiteCamera, schemaSiteFacility, schemaSiteFacilityBooking, schemaStatementOfAccount, schemaUnitBilling, schemaUpdateBulletinBoard, schemaUpdateBulletinVideo, schemaUpdateDocumentManagement, schemaUpdateEntryPassSettings, schemaUpdateEventManagement, schemaUpdateGuestManagement, schemaUpdateIncidentReport, schemaUpdateOccurrenceBook, schemaUpdateOccurrenceEntry, schemaUpdateOccurrenceSubject, schemaUpdateOnlineForm, schemaUpdateOptions, schemaUpdatePatrolLog, schemaUpdatePatrolQuestion, schemaUpdatePatrolRoute, schemaUpdatePerson, schemaUpdateServiceProviderBilling, schemaUpdateSiteBillingConfiguration, schemaUpdateSiteBillingItem, schemaUpdateSiteCamera, schemaUpdateSiteFacility, schemaUpdateSiteUnitBilling, schemaUpdateStatementOfAccount, schemaUpdateVisTrans, schemaVehicleTransaction, schemaVisitorTransaction, schemeCamera, schemeLogCamera, siteSchema, tokenSchema, updateSiteSchema, useAccessManagementController, useAddressRepo, useAttendanceController, useAttendanceRepository, useAttendanceSettingsController, useAttendanceSettingsRepository, useAttendanceSettingsService, useAuthController, useAuthService, 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, useIncidentReportController, useIncidentReportRepo, useIncidentReportService, useInvoiceController, useInvoiceModel, useInvoiceRepo, useMemberController, useMemberRepo, useNfcPatrolLogController, useNfcPatrolLogRepo, useNfcPatrolLogService, useNfcPatrolRouteController, useNfcPatrolRouteRepo, useNfcPatrolRouteService, useNfcPatrolSettingsController, useNfcPatrolSettingsRepository, useNfcPatrolSettingsService, useNfcPatrolTagController, useNfcPatrolTagRepo, useNfcPatrolTagService, useOccurrenceBookController, useOccurrenceBookRepo, useOccurrenceBookService, useOccurrenceEntryController, useOccurrenceEntryRepo, useOccurrenceEntryService, useOccurrenceSubjectController, useOccurrenceSubjectRepo, useOccurrenceSubjectService, useOnlineFormController, useOnlineFormRepo, useOrgController, useOrgRepo, usePatrolLogController, usePatrolLogRepo, usePatrolQuestionController, usePatrolQuestionRepo, usePatrolRouteController, usePatrolRouteRepo, usePersonController, usePersonRepo, usePriceController, usePriceModel, usePriceRepo, usePromoCodeController, usePromoCodeRepo, useRobotController, useRobotRepo, useRobotService, useRoleController, useRoleRepo, 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, useUserRepo, useUserService, useVehicleController, useVehicleRepo, useVehicleService, useVerificationController, useVerificationRepo, useVerificationService, useVisitorTransactionController, useVisitorTransactionRepo, useVisitorTransactionService, useWorkOrderController, useWorkOrderRepo, useWorkOrderService, userSchema, vehicleSchema, workOrderSchema };
package/dist/index.js CHANGED
@@ -101,6 +101,8 @@ __export(src_exports, {
101
101
  SortOrder: () => SortOrder,
102
102
  UseAccessManagementRepo: () => UseAccessManagementRepo,
103
103
  VehicleCategory: () => VehicleCategory,
104
+ VehicleOrder: () => VehicleOrder,
105
+ VehicleSort: () => VehicleSort,
104
106
  VehicleStatus: () => VehicleStatus,
105
107
  VehicleType: () => VehicleType,
106
108
  allowedFieldsSite: () => allowedFieldsSite,
@@ -15849,6 +15851,17 @@ var VehicleStatus = /* @__PURE__ */ ((VehicleStatus2) => {
15849
15851
  VehicleStatus2["DELETED"] = "deleted";
15850
15852
  return VehicleStatus2;
15851
15853
  })(VehicleStatus || {});
15854
+ var VehicleOrder = /* @__PURE__ */ ((VehicleOrder2) => {
15855
+ VehicleOrder2["ASC"] = "asc";
15856
+ VehicleOrder2["DESC"] = "desc";
15857
+ return VehicleOrder2;
15858
+ })(VehicleOrder || {});
15859
+ var VehicleSort = /* @__PURE__ */ ((VehicleSort2) => {
15860
+ VehicleSort2["CREATED_AT"] = "createdAt";
15861
+ VehicleSort2["ID"] = "_id";
15862
+ VehicleSort2["NAME"] = "name";
15863
+ return VehicleSort2;
15864
+ })(VehicleSort || {});
15852
15865
  var OrgNature = /* @__PURE__ */ ((OrgNature2) => {
15853
15866
  OrgNature2["PROPERTY_MANAGEMENT_AGENCY"] = "property_management_agency";
15854
15867
  OrgNature2["SECURITY_AGENCY"] = "security_agency";
@@ -16688,6 +16701,48 @@ function useVehicleRepo() {
16688
16701
  throw error;
16689
16702
  }
16690
16703
  }
16704
+ async function getAllVehiclesByUnitId({
16705
+ unitId,
16706
+ page = 1,
16707
+ limit = 10,
16708
+ sort = { _id: -1 }
16709
+ }) {
16710
+ try {
16711
+ const unit = (0, import_node_server_utils82.toObjectId)(unitId);
16712
+ const cacheOptions = {
16713
+ unit: unitId,
16714
+ page,
16715
+ limit,
16716
+ sort: JSON.stringify(sort)
16717
+ };
16718
+ const cacheKey = (0, import_node_server_utils82.makeCacheKey)(namespace_collection, cacheOptions);
16719
+ const cachedData = await getCache(cacheKey);
16720
+ if (cachedData) {
16721
+ import_node_server_utils82.logger.info(`Cache hit for key: ${cacheKey}`);
16722
+ return cachedData;
16723
+ }
16724
+ const skip = (page - 1) * limit;
16725
+ const data = await collection.find(
16726
+ { unit },
16727
+ {
16728
+ projection: {
16729
+ createdAt: 0,
16730
+ updatedAt: 0,
16731
+ deletedAt: 0
16732
+ },
16733
+ sort,
16734
+ skip,
16735
+ limit
16736
+ }
16737
+ ).toArray();
16738
+ setCache(cacheKey, data, 15 * 60).then(() => import_node_server_utils82.logger.info(`Cache set for key: ${cacheKey}`)).catch(
16739
+ (err) => import_node_server_utils82.logger.error(`Failed to set cache for key: ${cacheKey}`, err)
16740
+ );
16741
+ return data;
16742
+ } catch (error) {
16743
+ throw error;
16744
+ }
16745
+ }
16691
16746
  return {
16692
16747
  createIndex,
16693
16748
  createTextIndex,
@@ -16700,7 +16755,8 @@ function useVehicleRepo() {
16700
16755
  getByPlaceNumber,
16701
16756
  getVehicleByPlateNumber,
16702
16757
  getVehiclesByNRIC,
16703
- deleteExpiredVehicles
16758
+ deleteExpiredVehicles,
16759
+ getAllVehiclesByUnitId
16704
16760
  };
16705
16761
  }
16706
16762
 
@@ -17733,7 +17789,8 @@ function useVehicleController() {
17733
17789
  getSeasonPassTypes: _getSeasonPassTypes,
17734
17790
  getVehicles: _getVehicles,
17735
17791
  getVehicleById: _getVehicleById,
17736
- getVehiclesByNRIC: _getVehiclesByNRIC
17792
+ getVehiclesByNRIC: _getVehiclesByNRIC,
17793
+ getAllVehiclesByUnitId: _getAllVehiclesByUnitId
17737
17794
  } = useVehicleRepo();
17738
17795
  async function add(req, res, next) {
17739
17796
  const payload = req.body;
@@ -18005,6 +18062,45 @@ function useVehicleController() {
18005
18062
  return;
18006
18063
  }
18007
18064
  }
18065
+ async function getAllVehiclesByUnitId(req, res, next) {
18066
+ const validation = import_joi46.default.object({
18067
+ page: import_joi46.default.number().min(1).optional().default(1),
18068
+ limit: import_joi46.default.number().min(1).optional().default(10),
18069
+ sort: import_joi46.default.string().valid(...Object.values(VehicleSort)).default("_id"),
18070
+ order: import_joi46.default.string().valid(...Object.values(SortOrder)).default("desc" /* DESC */),
18071
+ unit: import_joi46.default.string().hex().length(24).required()
18072
+ });
18073
+ const { error, value } = validation.validate(
18074
+ { unit: req.params.unitId, ...req.query },
18075
+ {
18076
+ abortEarly: false
18077
+ }
18078
+ );
18079
+ if (error) {
18080
+ const messages = error.details.map((d) => d.message);
18081
+ import_node_server_utils85.logger.log({ level: "error", message: messages.join(", ") });
18082
+ next(new import_node_server_utils85.BadRequestError(messages.join(", ")));
18083
+ return;
18084
+ }
18085
+ const { page, limit, unit, sort, order } = value;
18086
+ const sortObj = {
18087
+ [sort]: order === "asc" /* ASC */ ? 1 : -1
18088
+ };
18089
+ try {
18090
+ const data = await _getAllVehiclesByUnitId({
18091
+ unitId: unit,
18092
+ page,
18093
+ limit,
18094
+ sort: sortObj
18095
+ });
18096
+ res.json({ items: data });
18097
+ return;
18098
+ } catch (error2) {
18099
+ import_node_server_utils85.logger.log({ level: "error", message: error2.message });
18100
+ next(error2);
18101
+ return;
18102
+ }
18103
+ }
18008
18104
  return {
18009
18105
  add,
18010
18106
  getVehicles,
@@ -18014,7 +18110,8 @@ function useVehicleController() {
18014
18110
  deleteVehicle,
18015
18111
  approveVehicleById,
18016
18112
  getVehiclesByNRIC,
18017
- reactivateVehicleById
18113
+ reactivateVehicleById,
18114
+ getAllVehiclesByUnitId
18018
18115
  };
18019
18116
  }
18020
18117
 
@@ -24734,8 +24831,7 @@ function useSiteFacilityBookingController() {
24734
24831
  deleteSiteFacilityBookingById: _deleteSiteFacilityBookingById
24735
24832
  } = useSiteFacilityBookingRepo();
24736
24833
  async function add(req, res, next) {
24737
- const payload = { ...req.body };
24738
- const { error } = schemaSiteFacilityBooking.validate(payload, {
24834
+ const { error, value } = schemaSiteFacilityBooking.validate(req.body, {
24739
24835
  abortEarly: false
24740
24836
  });
24741
24837
  if (error) {
@@ -24745,7 +24841,7 @@ function useSiteFacilityBookingController() {
24745
24841
  return;
24746
24842
  }
24747
24843
  try {
24748
- const data = await _add(payload);
24844
+ const data = await _add(value);
24749
24845
  res.status(201).json(data);
24750
24846
  return;
24751
24847
  } catch (error2) {
@@ -38068,6 +38164,8 @@ function useNfcPatrolLogController() {
38068
38164
  SortOrder,
38069
38165
  UseAccessManagementRepo,
38070
38166
  VehicleCategory,
38167
+ VehicleOrder,
38168
+ VehicleSort,
38071
38169
  VehicleStatus,
38072
38170
  VehicleType,
38073
38171
  allowedFieldsSite,