const Units = Object.freeze({ OZ: 0, GAL: 1, LB: 2, LIT: 3, KG: 4, ACRE: 5, HA: 6, HOUR: 7, GR: 8, CC: 9, PT: 10 }); const ExportType = Object.freeze({ CSV: "csv", IIF: "iif" }); const APTypes = Object.freeze( { ACTIVE: 1, CARRIER: 9 }); const RecTypes = Object.freeze({ UNKNOWN: 0, AGN_BIN_LQD: 1, AGN_BIN_DRY: 2, AGN_AMS: 3, AGN_SHP: 4, AGN_SHP_DRY: 5, SATLOG: 10 }); const UserTypes = Object.freeze({ ADMIN: "0", APP: "1", APP_ADM: "2", CLIENT: "3", OFFICER: "4", PILOT: "5", INSPECTOR: "6", DEVICE: "9" }); const AppStatus = Object.freeze({ ERROR: 0, CREATED: 1, IN_PROGRESS: 2, WAS_CANCELLED: -1, DONE: 3 }); const AppProStatus = Object.freeze({ ERROR: 0, // not fully processed (disrupted while reading or processing files) WITH_DATA: 1, NO_DATA: 2 // 10 + STATUS: If items were updated }); const AssignStatus = Object.freeze({ NEW: 0, DOWNLOADED: 1 }); const Fields = Object.freeze({ MARKED_DELETE: 'markedDelete' }); const DEFAULT_LANG = 'en'; const DEL_APP_IDS = "DEL_APP_IDS"; // The key name of deleted appIds cached list using REDIS const LIMIT_FILE_SIZE_ERR = "LIMIT_FILE_SIZE"; // MulterError code for file too large const DEFAULT_TRIAL_DAYS = [15, 30, 60, 90, 120, 180, 270, 365]; const TrialTypes = Object.freeze({ NONE: null, DAYS: 'days', BY_DATE: 'byDate' }); // Error constant codes mapped to tags const Errors = Object.freeze({ NOT_FOUND: 'not_found', NO_ACCESS: 'not_authorized', ACC_INACTIVE: 'acc_inactive', INVALID_ACCOUNT: 'invalid_account', WRONG_CREDENTIAL: 'wrong_credential', INVALID_TOKEN: 'invalid_token', ACTIVE_ACCOUNT: 'active_account', INVALID_EMAIL: 'invalid_email', EMAIL_ERROR: 'email_error', PARENT_NOT_EXIST: 'parent_not_exist', USER_NOT_FOUND: 'user_not_found', USER_EXIST: 'user_exist', TOKEN_EXPIRED: 'token_expired', PILOT_NOT_EXIST: 'pilot_not_exist', JOB_NOT_FOUND: 'job_not_found', NO_SPRAY_AREA: 'no_spray_area', AREAS_NOT_FOUND: 'areas_not_found', ITEMS_NOT_FOUND: 'items_not_found', NOT_KML_KMZ: 'not_kml_kmz', BLANK_KML_KMZ: 'blank_kml_kmz', JOB_NOT_ASSIGNED: 'job_not_assigned', PRJ_NOT_FOUND: 'prj_not_found', UNSUPPORTED_SHAPE_TYPE: 'unsupported_shape_type', EMPTY_SHP_FILE: 'empty_shp_file', DATA_NO_SPRAYON: 'data_no_sprayon', INVALID_REQUEST: 'invalid_request', INVALID_PARAM: 'invalid_param', INVALID_INPUT: 'invalid_input', INVALID_VAL_SCHEMA: 'invalid_val_schema', INVALID_LONGITUDE: 'invalid_longitude', INVALID_SWATH_WIDTH: 'invalid_swath_width', INVALID_DMS: 'invalid_dms', DUPLICATED_VALUE: 'duplicated_value', CORRUPTED_ZIP: 'corrupted_zip', INVALID_OBSTACLE_FILE_FORMAT: 'invalid_obstacle_file_format', NO_FILE: 'no_file', FILE_TOO_LARGE: 'file_too_large', DUPLICATED_FILE: 'duplicated_file', WRONG_JOB_FILE: 'wrong_job_file', INVALID_AREAS_FILE: 'invalid_areas_file', INVALID_JOB_FILE: 'invalid_job_file', INVALID_PAYMENT_METHOD: 'invalid_payment_method', INVALID_ADDRESS_COUNTRY: 'invalid_address_country', SUBSCRIPTION_NOT_FOUND: 'subscription_not_found', PKG_SUBSCRIPTION_NOT_FOUND: 'pkg_subscription_not_found', TRK_SUBSCRIPTION_NOT_FOUND: 'trk_subscription_not_found', PAID_INVOICES_NOT_FOUND: 'paid_invoices_not_found', REACHED_AREA_LIMIT: 'reached_area_limit', REACHED_VEHICLES_LIMIT: 'reached_vehicles_limit', PAYMENT_EXPIRED: 'payment_expired', CUST_PM_NOT_FOUND: 'cust_pm_not_found', APP_VENDOR_NOT_FOUND: 'app_vendor_not_found', LOCAL_VENDOR_NOT_FOUND: 'local_vendor_not_found', RM_LAST_DEFAULT_PM_NOT_ALLOW: 'rm_last_default_pm_not_allow', RM_ACTIVE_PM_NOT_ALLOW: 'rm_active_pm_not_allow', TRIALS_NOT_ENABLED: 'trials_not_enabled', TRIALS_EXPIRED: "trials_expired", ONLY_ONE_BILL_ADDR_ALLOWED: 'only_one_bill_address_allowed', // New email verification error codes VERIFICATION_CODE_EXPIRED: 'verification_code_expired', INVALID_VERIFICATION_CODE: 'invalid_verification_code', EMAIL_VERIFICATION_REQUIRED: 'email_verification_required', REPORT_SERVER_ERROR: 'report_server_error', HAS_REFERENCE: 'has_reference', TEMPLATE_NOT_FOUND: 'template_not_found', TO_NOT_FOUND: 'to_not_found', UNKNOWN_APP_ERROR: 'unknown_app_error', UNKNOWN_ERROR: 'unknown_error', APPLICATOR_NOT_FOUND: 'applicator_not_found', COSTING_ITEM_NOT_FOUND: 'costing_item_not_found', INVOICE_NOT_FOUND: 'invoice_not_found', INVOICE_SETTING_NOT_FOUND: 'invoice_setting_not_found', CLIENT_NOT_FOUND: 'client_not_found', JOBS_NOT_FOUND: 'jobs_not_found', CLIENTS_NOT_FOUND: 'clients_not_found', CLIENT_OVER_PAID: 'client_over_paid', INVOICE_ALREADY_PAID: 'invoice_already_paid', INVOICE_DRAFT: 'invoice_draft', INVOICE_CANCELLED: 'invoice_cancelled', INVOICE_OVERDUE: 'invoice_overdue', INVOICE_VOID: 'invoice_void', JOB_CANNOT_EDIT: 'cannot_edit_job_have_invoice_opened', STATUS_JOB_INVALID: 'status_job_invalid', COSTING_ITEM_IN_USE: 'costing_item_in_use', PARAMS_NOT_EMPTY: 'params_not_empty', INVALID_PUID: 'invalid_parent_user_id', INVALID_CREATED_BY_USER_ID: 'invalid_CREATED_BY_USER_ID', }); /* Applicator application types */ const ApplicationTypes = Object.freeze({ Agricultural: 'agricultural', Mosquito_Control: 'mosquito_control', Wildfire_Fighting: 'wildfire_fighting', Forestry: 'forestry', Airborne_Geophysics: 'airborne_geophysics', Animal_Control: 'animal_control', Photogrammetry: 'photogrammetry', UAV_Imaging: 'uav_imaging', Other: 'other', }); /* Applicator reference sources */ const RefSources = Object.freeze({ Web_Search: 'web_search', Online_Ads: 'online_ads', Trade_Show: 'trade_show', Magazine: 'magazine', Third_Party: '3rd_party', }); const InvCreateOption = Object.freeze({ Option1: 'option_1', Option2: 'option_2', Option3: 'option_3' }); const InvoiceStatus = Object.freeze({ Draft: 'draft', Open: 'open', Paid: 'paid', Void: 'void', Uncollectible: 'uncollectible' }); const CostingItemType = Object.freeze({ BY_ACRE: 0, BY_HA: 1, BY_AMOUNT: 2 }); const PaymentMethod = Object.freeze({ Cash: 'cash', Transfer: 'transfer', Debit: 'debit', Credit: 'credit' }); const InvoiceStatusAction = Object.freeze({ None: 'none', MARK_UNCOLLECTIBLE: 'mark_uncollectible' }); const jobInvoiceEditRoles = [UserTypes.APP, UserTypes.APP_ADM]; const jobInvoiceViewRoles = [...jobInvoiceEditRoles, UserTypes.CLIENT, UserTypes.OFFICER, UserTypes.INSPECTOR, UserTypes.PILOT]; const emailRegex = RegExp(/^(([^<>\(\)\[\]\\.,;:\s@"]+(\.[^<>\(\)\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i); module.exports = { APTypes, Units, Fields, RecTypes, UserTypes, Errors, AppStatus, AppProStatus, AssignStatus, TrialTypes, DEFAULT_LANG, DEL_APP_IDS, DEFAULT_TRIAL_DAYS, LIMIT_FILE_SIZE_ERR, InvoiceStatus, CostingItemType, InvCreateOption, PaymentMethod, ExportType, jobInvoiceEditRoles, jobInvoiceViewRoles, InvoiceStatusAction, ApplicationTypes, RefSources, emailRegex };