autopilot-core-sandbox 0.0.1
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/README.md +53 -0
- package/dist/Provider.d.ts +21 -0
- package/dist/Provider.d.ts.map +1 -0
- package/dist/Provider.js +61 -0
- package/dist/Provider.js.map +1 -0
- package/dist/dist/Provider.d.ts +21 -0
- package/dist/dist/Provider.d.ts.map +1 -0
- package/dist/dist/Provider.js +61 -0
- package/dist/dist/Provider.js.map +1 -0
- package/dist/dist/index.d.ts +45 -0
- package/dist/dist/index.d.ts.map +1 -0
- package/dist/dist/index.js +61 -0
- package/dist/dist/index.js.map +1 -0
- package/dist/dist/interfaces/index.d.ts +1238 -0
- package/dist/dist/interfaces/index.d.ts.map +1 -0
- package/dist/dist/interfaces/index.js +3 -0
- package/dist/dist/interfaces/index.js.map +1 -0
- package/dist/dist/migrations/20260608222757_remote_schema.sql +5666 -0
- package/dist/dist/migrations/20260611174826_add_job_item_recurring_id_to_job_item.sql +7 -0
- package/dist/dist/migrations/20260625224612_add_dashboard_guided_tour_dismissed_to_settings_user.sql +5 -0
- package/dist/dist/migrations/20260627031433_support_chat_tables.sql +115 -0
- package/dist/dist/migrations/20260627031434_support_chat_rls.sql +37 -0
- package/dist/dist/migrations/20260704170209_add_estimate_scheduling.sql +121 -0
- package/dist/dist/migrations/20260704170210_add_estimate_scheduling_rls.sql +42 -0
- package/dist/dist/migrations/20260704235034_add_estimate_reminder_settings.sql +11 -0
- package/dist/dist/migrations/20260707003825_blocked_number_table.sql +32 -0
- package/dist/dist/migrations/20260707003826_blocked_number_rls.sql +22 -0
- package/dist/dist/migrations/20260709191055_sms_opt_out_table.sql +38 -0
- package/dist/dist/migrations/20260709191056_sms_opt_out_rls.sql +21 -0
- package/dist/dist/migrations/20260709214507_job_time_entry_table.sql +70 -0
- package/dist/dist/migrations/20260709214508_job_time_entry_rls.sql +21 -0
- package/dist/dist/migrations/20260711185956_phone_call_table.sql +99 -0
- package/dist/dist/migrations/20260711185957_phone_call_rls.sql +25 -0
- package/dist/dist/migrations/20260712014705_ai_voice_assistant_settings.sql +71 -0
- package/dist/dist/migrations/20260712014706_ai_voice_assistant_settings_rls.sql +14 -0
- package/dist/dist/migrations/20260712014707_ai_prompt_templates.sql +28 -0
- package/dist/dist/migrations/20260712014708_ai_prompt_templates_rls.sql +5 -0
- package/dist/dist/migrations/20260712014709_ai_prompt_templates_seed.sql +77 -0
- package/dist/dist/migrations/20260715011550_reminder_dispatch_table.sql +47 -0
- package/dist/dist/migrations/20260715011551_reminder_dispatch_rls.sql +22 -0
- package/dist/dist/migrations/20260715192923_dedup_sequence_contact_add_unique_constraint.sql +27 -0
- package/dist/dist/migrations/20260716194420_add_employee_location_tracking.sql +146 -0
- package/dist/dist/migrations/20260716194421_add_employee_location_tracking_rls.sql +154 -0
- package/dist/dist/migrations/20260716194422_get_client_map_last_completed_jobs.sql +28 -0
- package/dist/dist/migrations/20260717144535_add_blast_email_invalid_skipped_count.sql +2 -0
- package/dist/dist/migrations/20260717162900_create_blast_email_chunk.sql +36 -0
- package/dist/dist/migrations/20260717162901_add_blast_email_chunk_rls.sql +5 -0
- package/dist/dist/migrations/20260717162902_add_blast_email_chunk_progress_columns.sql +3 -0
- package/dist/dist/migrations/20260717162903_add_blast_email_bounce_tracking_columns.sql +4 -0
- package/dist/dist/migrations/20260717162904_create_email_hard_bounced.sql +23 -0
- package/dist/dist/migrations/20260717162905_add_email_hard_bounced_rls.sql +5 -0
- package/dist/dist/migrations/20260717164837_add_sequence_contact_sent_at.sql +19 -0
- package/dist/dist/migrations/20260717170920_add_sequence_contact_claim_index.sql +12 -0
- package/dist/dist/migrations/20260719215139_create_outbound_event.sql +59 -0
- package/dist/dist/migrations/20260719215140_create_outbound_event_rls.sql +16 -0
- package/dist/dist/migrations/20260719215141_create_webhook_delivery.sql +99 -0
- package/dist/dist/migrations/20260719215142_create_webhook_delivery_rls.sql +11 -0
- package/dist/dist/migrations/20260719215143_outbound_event_triggers.sql +219 -0
- package/dist/dist/migrations/20260719215144_create_api_key.sql +34 -0
- package/dist/dist/migrations/20260719215146_create_api_key_rls.sql +12 -0
- package/dist/dist/migrations/20260719215147_webhook_subscription_add_secret_active.sql +28 -0
- package/dist/dist/migrations/20260719215148_api_aggregate_create_functions.sql +479 -0
- package/dist/dist/migrations/20260721174837_webhook_subscription_generic_endpoints.sql +41 -0
- package/dist/dist/migrations/20260721185631_webhook_outbox_retention.sql +87 -0
- package/dist/dist/migrations/20260721190304_create_qb_sync_task.sql +120 -0
- package/dist/dist/migrations/20260721190306_qb_sync_task_rls.sql +8 -0
- package/dist/dist/migrations/20260721190307_qb_mapping_orphan_fks.sql +29 -0
- package/dist/dist/migrations/20260721190308_qb_task_retention.sql +90 -0
- package/dist/dist/migrations/20260721234401_create_permission_role.sql +83 -0
- package/dist/dist/migrations/20260721234402_permission_role_rls.sql +22 -0
- package/dist/dist/migrations/20260721234403_user_role_add_permission_role_id.sql +12 -0
- package/dist/dist/migrations/20260721234404_seed_permission_roles.sql +100 -0
- package/dist/dist/migrations/20260721234405_backfill_user_role_permission_role_id.sql +20 -0
- package/dist/dist/migrations/20260722193800_permission_role_add_manage_employees.sql +56 -0
- package/dist/dist/migrations/20260723025606_staging_new_employee_company_read_rls.sql +10 -0
- package/dist/dist/migrations/20260723134328_create_google_lsa_integration.sql +1016 -0
- package/dist/dist/migrations/20260723134329_google_lsa_integration_rls.sql +205 -0
- package/dist/dist/migrations/20260723150640_google_lsa_hardening.sql +169 -0
- package/dist/dist/migrations/20260723150641_google_lsa_hardening_rls.sql +12 -0
- package/dist/dist/migrations/20260724230721_google_lsa_facebook_exclusivity_attach.sql +104 -0
- package/dist/dist/migrations/20260724230722_google_lsa_facebook_exclusivity_attach_rls.sql +20 -0
- package/dist/dist/migrations/20260725172630_add_message_pagination_and_search.sql +265 -0
- package/dist/dist/migrations/20260725172631_add_message_pagination_and_search_rls.sql +72 -0
- package/dist/dist/migrations/20260725172632_optimize_message_thread_pagination_search.sql +245 -0
- package/dist/dist/migrations/20260725172633_harden_message_search_and_photo_pagination.sql +256 -0
- package/dist/dist/migrations/20260725172634_fix_message_thread_line_filter.sql +250 -0
- package/dist/dist/migrations/20260725174948_google_lsa_attach_bing_exclusivity_guard.sql +23 -0
- package/dist/dist/migrations/20260725200430_client_portal_settings.sql +41 -0
- package/dist/dist/migrations/20260725200431_client_portal_settings_rls.sql +21 -0
- package/dist/dist/migrations/20260725200433_client_portal_auth_tables.sql +81 -0
- package/dist/dist/migrations/20260725200434_client_portal_auth_rls.sql +18 -0
- package/dist/dist/migrations/20260725200435_portal_claim_login_attempt.sql +36 -0
- package/dist/dist/migrations/20260725200436_portal_appointment_request.sql +39 -0
- package/dist/dist/migrations/20260725200437_portal_appointment_request_rls.sql +10 -0
- package/dist/dist/migrations/20260725210000_google_reserve_integration.sql +85 -0
- package/dist/dist/migrations/20260725210001_google_reserve_integration_rls.sql +10 -0
- package/dist/dist/migrations/20260725220000_add_analytics_query_indexes.sql +47 -0
- package/dist/dist/migrations/20260725230000_onboarding_preload_data.sql +1074 -0
- package/dist/dist/migrations/20260725230001_onboarding_preload_data_rls.sql +40 -0
- package/dist/dist/migrations/20260725230002_add_pricebook_query_indexes.sql +13 -0
- package/dist/dist/migrations/20260726000000_facebook_ads_integration.sql +1538 -0
- package/dist/dist/migrations/20260726000001_facebook_ads_integration_rls.sql +356 -0
- package/dist/dist/migrations/20260726000002_facebook_ads_attach_lsa_exclusivity_guard.sql +25 -0
- package/dist/dist/migrations/20260726000003_facebook_ads_attach_bing_exclusivity_guard.sql +22 -0
- package/dist/dist/migrations/20260726010000_create_bing_ads_integration.sql +1112 -0
- package/dist/dist/migrations/20260726010001_bing_ads_integration_rls.sql +227 -0
- package/dist/dist/migrations/20260726220000_add_document_theme_settings.sql +11 -0
- package/dist/dist/migrations/20260726220001_update_document_theme_comments.sql +7 -0
- package/dist/dist/migrations/20260727210319_evolve_tier_for_pricing.sql +68 -0
- package/dist/dist/migrations/20260727210320_create_billing_addon.sql +85 -0
- package/dist/dist/migrations/20260727210321_create_billing_addon_rls.sql +21 -0
- package/dist/dist/migrations/20260728213930_create_usage_metering.sql +189 -0
- package/dist/dist/migrations/20260728213931_create_usage_metering_rls.sql +32 -0
- package/dist/dist/migrations/20260729004305_marketing_charge_txn_functions.sql +242 -0
- package/dist/dist/migrations/20260729004306_marketing_charge_txn_functions_rls.sql +37 -0
- package/dist/dist/migrations/20260729005524_update_deduct_from_balance_errcode.sql +42 -0
- package/dist/dist/migrations/20260730193601_fix_deduct_from_balance_lost_update.sql +46 -0
- package/dist/dist/migrations/20260730193602_add_blast_sms_chunk_reaper_columns.sql +27 -0
- package/dist/dist/migrations/20260731011415_create_google_calendar_connection.sql +84 -0
- package/dist/dist/migrations/20260731011416_google_calendar_connection_rls.sql +23 -0
- package/dist/dist/migrations/20260731011417_create_google_calendar_sync.sql +157 -0
- package/dist/dist/migrations/20260731011418_google_calendar_sync_rls.sql +26 -0
- package/dist/dist/migrations/20260731011419_event_outbound_triggers.sql +28 -0
- package/dist/dist/migrations/20260731011420_add_google_calendar_addon_key.sql +24 -0
- package/dist/dist/migrations/20260731011421_gcal_task_retention.sql +109 -0
- package/dist/dist/migrations/20260731234245_create_estimate_proposal.sql +157 -0
- package/dist/dist/migrations/20260731234247_estimate_proposal_rls.sql +46 -0
- package/dist/dist/migrations/20260731234248_add_proposal_estimate_settings.sql +17 -0
- package/dist/dist/migrations/20260731234249_add_estimate_proposals_addon_key.sql +25 -0
- package/dist/dist/migrations/20260731234250_approve_estimate_proposal_function.sql +133 -0
- package/dist/dist/migrations/20260801010609_save_estimate_proposal_function.sql +154 -0
- package/dist/dist/migrations/20260801173554_add_hide_autopilot_branding_setting.sql +6 -0
- package/dist/dist/migrations/20260806230917_add_client_billing_address_columns.sql +9 -0
- package/dist/dist/migrations/20260806230944_api_create_client_billing_address.sql +93 -0
- package/dist/dist/migrations/20260807014702_create_parent_id_company_id_keys.sql +20 -0
- package/dist/dist/migrations/20260807014703_create_contract_template.sql +30 -0
- package/dist/dist/migrations/20260807014704_create_contract.sql +233 -0
- package/dist/dist/migrations/20260807014705_create_contract_signature.sql +39 -0
- package/dist/dist/migrations/20260807014706_create_item_contract_requirement.sql +38 -0
- package/dist/dist/migrations/20260807014707_create_settings_contract.sql +23 -0
- package/dist/dist/migrations/20260807014708_contract_rls.sql +74 -0
- package/dist/dist/migrations/20260807014709_sign_contract_function.sql +92 -0
- package/dist/dist/migrations/20260807014710_create_settings_rental.sql +34 -0
- package/dist/dist/migrations/20260807014711_create_saved_location.sql +56 -0
- package/dist/dist/migrations/20260807014712_create_rental_task_option.sql +52 -0
- package/dist/dist/migrations/20260807014713_create_asset.sql +90 -0
- package/dist/dist/migrations/20260807014714_add_job_schedule_asset_fkeys.sql +39 -0
- package/dist/dist/migrations/20260807014715_rental_rls.sql +48 -0
- package/dist/dist/migrations/20260807014716_add_job_schedule_any_time.sql +7 -0
- package/dist/dist/migrations/20260807014717_add_job_schedule_target_location.sql +48 -0
- package/dist/dist/migrations/20260807014718_job_schedule_completion_guard.sql +53 -0
- package/dist/dist/migrations/20260807014719_add_job_schedule_list_sort_key.sql +7 -0
- package/dist/dist/migrations/20260807014720_add_item_duration.sql +11 -0
- package/dist/dist/migrations/20260807014721_add_settings_booking_enforce_rental_availability.sql +9 -0
- package/dist/dist/migrations/20260807014722_add_job_unsigned_rental_agreement.sql +10 -0
- package/dist/dist/migrations/20260807014723_add_item_size.sql +12 -0
- package/dist/dist/migrations/20260809193533_add_booking_path_button_labels.sql +11 -0
- package/dist/dist/migrations/20260809231721_add_route_distance_cache.sql +37 -0
- package/dist/dist/migrations/20260809231722_route_distance_cache_rls.sql +15 -0
- package/dist/dist/migrations/20260809231723_apply_rental_route_plan_function.sql +275 -0
- package/dist/dist/migrations/20260810171550_add_settings_job_default_job_types.sql +9 -0
- package/dist/dist/migrations/20260810212430_backfill_rental_task_option_sort_order.sql +61 -0
- package/dist/dist/migrations/20260811224317_add_settings_user_dnd_hint_dismissed.sql +9 -0
- package/dist/dist/migrations/20260813174503_repair_user_role_email_drift.sql +59 -0
- package/dist/dist/migrations/20260813174504_sync_user_role_email_trigger.sql +30 -0
- package/dist/dist/migrations/20260813175210_add_event_list_sort_key.sql +5 -0
- package/dist/dist/migrations/20260814172222_add_client_auto_bill_on_completion.sql +6 -0
- package/dist/dist/migrations/20260816160252_create_automation_rule.sql +99 -0
- package/dist/dist/migrations/20260816160253_automation_rule_rls.sql +19 -0
- package/dist/dist/migrations/20260816160254_create_settings_automation.sql +36 -0
- package/dist/dist/migrations/20260816160255_settings_automation_rls.sql +18 -0
- package/dist/dist/migrations/20260816160256_create_automation_event.sql +71 -0
- package/dist/dist/migrations/20260816160257_automation_event_rls.sql +12 -0
- package/dist/dist/migrations/20260816160258_create_automation_run.sql +129 -0
- package/dist/dist/migrations/20260816160259_automation_run_rls.sql +19 -0
- package/dist/dist/migrations/20260816160300_add_client_created_via.sql +25 -0
- package/dist/dist/migrations/20260816160301_add_estimate_sent_at.sql +39 -0
- package/dist/dist/migrations/20260816160302_add_message_automation_ref.sql +10 -0
- package/dist/dist/migrations/20260816160303_automation_event_triggers.sql +236 -0
- package/dist/dist/migrations/20260816160304_automation_retention.sql +142 -0
- package/dist/dist/migrations/20260816202404_add_automation_center_addon_key.sql +26 -0
- package/dist/dist/migrations/20260816225501_widen_automation_rule_trigger_action_checks.sql +25 -0
- package/dist/dist/migrations/20260816225502_widen_automation_event_type_check.sql +18 -0
- package/dist/dist/migrations/20260816225503_add_invoice_id_to_automation_tables.sql +18 -0
- package/dist/dist/migrations/20260816225504_add_job_rescheduled_capture_trigger.sql +51 -0
- package/dist/dist/migrations/20260816225505_add_lead_converted_capture_trigger.sql +26 -0
- package/dist/dist/migrations/20260816225506_fix_booking_request_import_guard.sql +27 -0
- package/dist/dist/migrations/20260816225507_widen_outbound_event_for_automation.sql +38 -0
- package/dist/dist/migrations/20260817002626_add_user_last_login_platform_columns.sql +14 -0
- package/dist/dist/migrations/20260817221703_create_deletion.sql +34 -0
- package/dist/dist/migrations/20260817221707_deletion_rls.sql +21 -0
- package/dist/dist/migrations/20260817221708_add_soft_delete_columns.sql +82 -0
- package/dist/dist/migrations/20260817221709_trash_functions.sql +434 -0
- package/dist/dist/migrations/20260817221710_outbound_event_soft_delete.sql +55 -0
- package/dist/dist/migrations/20260817221711_automation_soft_delete_events.sql +77 -0
- package/dist/dist/migrations/20260817221712_fix_estimate_address_cascade.sql +14 -0
- package/dist/dist/migrations/20260817232630_trash_batch_function.sql +67 -0
- package/dist/dist/migrations/20260819170204_create_email_spam_complaint.sql +23 -0
- package/dist/dist/migrations/20260819170205_add_email_spam_complaint_rls.sql +5 -0
- package/dist/dist/migrations/20260819170206_email_unsubscribed_upsert_constraints.sql +14 -0
- package/dist/dist/migrations/20260819180151_get_suppressed_emails_function.sql +23 -0
- package/dist/dist/migrations/20260819191143_is_deleted_backfill_guard.sql +29 -0
- package/dist/dist/migrations/20260819191144_trash_functions_no_dual_write.sql +319 -0
- package/dist/dist/migrations/20260819191145_client_map_jobs_deleted_at.sql +33 -0
- package/dist/dist/migrations/20260819191147_booking_declined_deleted_at.sql +28 -0
- package/dist/dist/migrations/20260819191148_onboarding_preload_no_address_is_deleted.sql +1019 -0
- package/dist/dist/migrations/20260820222756_add_settings_job_hide_task_timer.sql +2 -0
- package/dist/dist/migrations/20260824234151_add_blast_chunk_recipients.sql +13 -0
- package/dist/dist/migrations/20260824234152_add_blast_pause_cancel_columns.sql +10 -0
- package/dist/dist/migrations/20260825014725_get_job_ids_in_range.sql +42 -0
- package/dist/dist/migrations/20260825194452_add_failed_job_status.sql +15 -0
- package/dist/dist/migrations/20260825194457_remove_take_to_rental_task_options.sql +24 -0
- package/dist/dist/migrations/20260825194458_remove_take_to_job_schedules.sql +12 -0
- package/dist/dist/migrations/20260825194459_rework_apply_rental_route_plan_no_take_to.sql +168 -0
- package/dist/dist/migrations/20260825194500_drop_job_schedule_target_location.sql +24 -0
- package/dist/dist/migrations/20260825194501_add_job_schedule_size.sql +17 -0
- package/dist/dist/migrations/20260825233001_add_job_schedule_id_company_id_key.sql +11 -0
- package/dist/dist/migrations/20260825233002_create_route_plan.sql +52 -0
- package/dist/dist/migrations/20260825233003_create_route_plan_stop.sql +159 -0
- package/dist/dist/migrations/20260825233004_route_plan_rls.sql +32 -0
- package/dist/dist/migrations/20260825233005_apply_rental_route_plan_v2.sql +351 -0
- package/dist/dist/migrations/20260826150934_facebook_ads_lead_ingestion.sql +1711 -0
- package/dist/dist/migrations/20260826151141_facebook_ads_lead_ingestion_rls_v2.sql +43 -0
- package/dist/dist/migrations/20260826234722_facebook_messenger_ingestion.sql +703 -0
- package/dist/dist/migrations/20260826234723_facebook_messenger_ingestion_rls.sql +80 -0
- package/dist/dist/migrations/20260826234724_widen_automations_messenger.sql +46 -0
- package/dist/dist/migrations/20260827100001_add_route_plan_minutes.sql +10 -0
- package/dist/dist/migrations/20260827100002_add_route_plan_stop_leg_minutes.sql +9 -0
- package/dist/dist/migrations/20260827100003_apply_rental_route_plan_v3.sql +341 -0
- package/dist/dist/migrations/20260827230346_apply_rental_route_plan_v4.sql +366 -0
- package/dist/dist/migrations/20260829090911_create_fleet_schema.sql +3698 -0
- package/dist/dist/migrations/20260829090912_fleet_rls.sql +1011 -0
- package/dist/dist/migrations/20260831102212_add_online_booking_address_display.sql +8 -0
- package/dist/dist/providers/AddressProvider.d.ts +9 -0
- package/dist/dist/providers/AddressProvider.d.ts.map +1 -0
- package/dist/dist/providers/AddressProvider.js +207 -0
- package/dist/dist/providers/AddressProvider.js.map +1 -0
- package/dist/dist/providers/AutomationsProvider.d.ts +11 -0
- package/dist/dist/providers/AutomationsProvider.d.ts.map +1 -0
- package/dist/dist/providers/AutomationsProvider.js +170 -0
- package/dist/dist/providers/AutomationsProvider.js.map +1 -0
- package/dist/dist/providers/BlockedNumbersProvider.d.ts +13 -0
- package/dist/dist/providers/BlockedNumbersProvider.d.ts.map +1 -0
- package/dist/dist/providers/BlockedNumbersProvider.js +71 -0
- package/dist/dist/providers/BlockedNumbersProvider.js.map +1 -0
- package/dist/dist/providers/CategoryProvider.d.ts +8 -0
- package/dist/dist/providers/CategoryProvider.d.ts.map +1 -0
- package/dist/dist/providers/CategoryProvider.js +95 -0
- package/dist/dist/providers/CategoryProvider.js.map +1 -0
- package/dist/dist/providers/ClientProvider.d.ts +39 -0
- package/dist/dist/providers/ClientProvider.d.ts.map +1 -0
- package/dist/dist/providers/ClientProvider.js +253 -0
- package/dist/dist/providers/ClientProvider.js.map +1 -0
- package/dist/dist/providers/CompanyProvider.d.ts +7 -0
- package/dist/dist/providers/CompanyProvider.d.ts.map +1 -0
- package/dist/dist/providers/CompanyProvider.js +114 -0
- package/dist/dist/providers/CompanyProvider.js.map +1 -0
- package/dist/dist/providers/DashboardProvider.d.ts +78 -0
- package/dist/dist/providers/DashboardProvider.d.ts.map +1 -0
- package/dist/dist/providers/DashboardProvider.js +568 -0
- package/dist/dist/providers/DashboardProvider.js.map +1 -0
- package/dist/dist/providers/DiscountProvider.d.ts +8 -0
- package/dist/dist/providers/DiscountProvider.d.ts.map +1 -0
- package/dist/dist/providers/DiscountProvider.js +92 -0
- package/dist/dist/providers/DiscountProvider.js.map +1 -0
- package/dist/dist/providers/EmployeesProvider.d.ts +6 -0
- package/dist/dist/providers/EmployeesProvider.d.ts.map +1 -0
- package/dist/dist/providers/EmployeesProvider.js +185 -0
- package/dist/dist/providers/EmployeesProvider.js.map +1 -0
- package/dist/dist/providers/EstimatesProvider.d.ts +16 -0
- package/dist/dist/providers/EstimatesProvider.d.ts.map +1 -0
- package/dist/dist/providers/EstimatesProvider.js +251 -0
- package/dist/dist/providers/EstimatesProvider.js.map +1 -0
- package/dist/dist/providers/EventsProvider.d.ts +4 -0
- package/dist/dist/providers/EventsProvider.d.ts.map +1 -0
- package/dist/dist/providers/EventsProvider.js +24 -0
- package/dist/dist/providers/EventsProvider.js.map +1 -0
- package/dist/dist/providers/FilesProvider.d.ts +17 -0
- package/dist/dist/providers/FilesProvider.d.ts.map +1 -0
- package/dist/dist/providers/FilesProvider.js +201 -0
- package/dist/dist/providers/FilesProvider.js.map +1 -0
- package/dist/dist/providers/InvoicesProvider.d.ts +13 -0
- package/dist/dist/providers/InvoicesProvider.d.ts.map +1 -0
- package/dist/dist/providers/InvoicesProvider.js +207 -0
- package/dist/dist/providers/InvoicesProvider.js.map +1 -0
- package/dist/dist/providers/ItemProvider.d.ts +9 -0
- package/dist/dist/providers/ItemProvider.d.ts.map +1 -0
- package/dist/dist/providers/ItemProvider.js +201 -0
- package/dist/dist/providers/ItemProvider.js.map +1 -0
- package/dist/dist/providers/JobSourceProvider.d.ts +8 -0
- package/dist/dist/providers/JobSourceProvider.d.ts.map +1 -0
- package/dist/dist/providers/JobSourceProvider.js +75 -0
- package/dist/dist/providers/JobSourceProvider.js.map +1 -0
- package/dist/dist/providers/JobTypeProvider.d.ts +8 -0
- package/dist/dist/providers/JobTypeProvider.d.ts.map +1 -0
- package/dist/dist/providers/JobTypeProvider.js +75 -0
- package/dist/dist/providers/JobTypeProvider.js.map +1 -0
- package/dist/dist/providers/JobsProvider.d.ts +35 -0
- package/dist/dist/providers/JobsProvider.d.ts.map +1 -0
- package/dist/dist/providers/JobsProvider.js +863 -0
- package/dist/dist/providers/JobsProvider.js.map +1 -0
- package/dist/dist/providers/MessagesProvider.d.ts +33 -0
- package/dist/dist/providers/MessagesProvider.d.ts.map +1 -0
- package/dist/dist/providers/MessagesProvider.js +415 -0
- package/dist/dist/providers/MessagesProvider.js.map +1 -0
- package/dist/dist/providers/PaymentProvider.d.ts +9 -0
- package/dist/dist/providers/PaymentProvider.d.ts.map +1 -0
- package/dist/dist/providers/PaymentProvider.js +48 -0
- package/dist/dist/providers/PaymentProvider.js.map +1 -0
- package/dist/dist/providers/PermissionRolesProvider.d.ts +5 -0
- package/dist/dist/providers/PermissionRolesProvider.d.ts.map +1 -0
- package/dist/dist/providers/PermissionRolesProvider.js +30 -0
- package/dist/dist/providers/PermissionRolesProvider.js.map +1 -0
- package/dist/dist/providers/PhoneNumberProvider.d.ts +12 -0
- package/dist/dist/providers/PhoneNumberProvider.d.ts.map +1 -0
- package/dist/dist/providers/PhoneNumberProvider.js +184 -0
- package/dist/dist/providers/PhoneNumberProvider.js.map +1 -0
- package/dist/dist/providers/ProfileProvider.d.ts +6 -0
- package/dist/dist/providers/ProfileProvider.d.ts.map +1 -0
- package/dist/dist/providers/ProfileProvider.js +71 -0
- package/dist/dist/providers/ProfileProvider.js.map +1 -0
- package/dist/dist/providers/RentalsProvider.d.ts +28 -0
- package/dist/dist/providers/RentalsProvider.d.ts.map +1 -0
- package/dist/dist/providers/RentalsProvider.js +438 -0
- package/dist/dist/providers/RentalsProvider.js.map +1 -0
- package/dist/dist/providers/SettingsBookingProvider.d.ts +9 -0
- package/dist/dist/providers/SettingsBookingProvider.d.ts.map +1 -0
- package/dist/dist/providers/SettingsBookingProvider.js +163 -0
- package/dist/dist/providers/SettingsBookingProvider.js.map +1 -0
- package/dist/dist/providers/SettingsProvider.d.ts +8 -0
- package/dist/dist/providers/SettingsProvider.d.ts.map +1 -0
- package/dist/dist/providers/SettingsProvider.js +86 -0
- package/dist/dist/providers/SettingsProvider.js.map +1 -0
- package/dist/dist/providers/TagsProvider.d.ts +12 -0
- package/dist/dist/providers/TagsProvider.d.ts.map +1 -0
- package/dist/dist/providers/TagsProvider.js +210 -0
- package/dist/dist/providers/TagsProvider.js.map +1 -0
- package/dist/dist/providers/TimeCardProvider.d.ts +8 -0
- package/dist/dist/providers/TimeCardProvider.d.ts.map +1 -0
- package/dist/dist/providers/TimeCardProvider.js +93 -0
- package/dist/dist/providers/TimeCardProvider.js.map +1 -0
- package/dist/dist/providers/TrashProvider.d.ts +13 -0
- package/dist/dist/providers/TrashProvider.d.ts.map +1 -0
- package/dist/dist/providers/TrashProvider.js +98 -0
- package/dist/dist/providers/TrashProvider.js.map +1 -0
- package/dist/dist/providers/dashboardAnalytics.d.ts +9 -0
- package/dist/dist/providers/dashboardAnalytics.d.ts.map +1 -0
- package/dist/dist/providers/dashboardAnalytics.js +41 -0
- package/dist/dist/providers/dashboardAnalytics.js.map +1 -0
- package/dist/dist/providers/dashboardAnalytics.test.d.ts +2 -0
- package/dist/dist/providers/dashboardAnalytics.test.d.ts.map +1 -0
- package/dist/dist/providers/dashboardAnalytics.test.js +111 -0
- package/dist/dist/providers/dashboardAnalytics.test.js.map +1 -0
- package/dist/dist/server-safe/BlockedNumberFunctions.d.ts +11 -0
- package/dist/dist/server-safe/BlockedNumberFunctions.d.ts.map +1 -0
- package/dist/dist/server-safe/BlockedNumberFunctions.js +16 -0
- package/dist/dist/server-safe/BlockedNumberFunctions.js.map +1 -0
- package/dist/dist/server-safe/EmployeeFunctions.d.ts +14 -0
- package/dist/dist/server-safe/EmployeeFunctions.d.ts.map +1 -0
- package/dist/dist/server-safe/EmployeeFunctions.js +70 -0
- package/dist/dist/server-safe/EmployeeFunctions.js.map +1 -0
- package/dist/dist/server-safe/EmployeeLocationFunctions.d.ts +7 -0
- package/dist/dist/server-safe/EmployeeLocationFunctions.d.ts.map +1 -0
- package/dist/dist/server-safe/EmployeeLocationFunctions.js +47 -0
- package/dist/dist/server-safe/EmployeeLocationFunctions.js.map +1 -0
- package/dist/dist/server-safe/EstimateFunctions.d.ts +15 -0
- package/dist/dist/server-safe/EstimateFunctions.d.ts.map +1 -0
- package/dist/dist/server-safe/EstimateFunctions.js +34 -0
- package/dist/dist/server-safe/EstimateFunctions.js.map +1 -0
- package/dist/dist/server-safe/InvoiceFunctions.d.ts +21 -0
- package/dist/dist/server-safe/InvoiceFunctions.d.ts.map +1 -0
- package/dist/dist/server-safe/InvoiceFunctions.js +124 -0
- package/dist/dist/server-safe/InvoiceFunctions.js.map +1 -0
- package/dist/dist/server-safe/JobFunctions.d.ts +15 -0
- package/dist/dist/server-safe/JobFunctions.d.ts.map +1 -0
- package/dist/dist/server-safe/JobFunctions.js +56 -0
- package/dist/dist/server-safe/JobFunctions.js.map +1 -0
- package/dist/dist/server-safe/PaymentFunctions.d.ts +16 -0
- package/dist/dist/server-safe/PaymentFunctions.d.ts.map +1 -0
- package/dist/dist/server-safe/PaymentFunctions.js +80 -0
- package/dist/dist/server-safe/PaymentFunctions.js.map +1 -0
- package/dist/dist/server-safe/PermissionFunctions.d.ts +7 -0
- package/dist/dist/server-safe/PermissionFunctions.d.ts.map +1 -0
- package/dist/dist/server-safe/PermissionFunctions.js +39 -0
- package/dist/dist/server-safe/PermissionFunctions.js.map +1 -0
- package/dist/dist/server-safe/TagFunctions.d.ts +18 -0
- package/dist/dist/server-safe/TagFunctions.d.ts.map +1 -0
- package/dist/dist/server-safe/TagFunctions.js +52 -0
- package/dist/dist/server-safe/TagFunctions.js.map +1 -0
- package/dist/dist/server-safe/autoJobType.d.ts +16 -0
- package/dist/dist/server-safe/autoJobType.d.ts.map +1 -0
- package/dist/dist/server-safe/autoJobType.js +39 -0
- package/dist/dist/server-safe/autoJobType.js.map +1 -0
- package/dist/dist/server-safe/autoJobType.test.d.ts +2 -0
- package/dist/dist/server-safe/autoJobType.test.d.ts.map +1 -0
- package/dist/dist/server-safe/autoJobType.test.js +83 -0
- package/dist/dist/server-safe/autoJobType.test.js.map +1 -0
- package/dist/dist/server-safe/automations.d.ts +197 -0
- package/dist/dist/server-safe/automations.d.ts.map +1 -0
- package/dist/dist/server-safe/automations.js +757 -0
- package/dist/dist/server-safe/automations.js.map +1 -0
- package/dist/dist/server-safe/automations.test.d.ts +2 -0
- package/dist/dist/server-safe/automations.test.d.ts.map +1 -0
- package/dist/dist/server-safe/automations.test.js +441 -0
- package/dist/dist/server-safe/automations.test.js.map +1 -0
- package/dist/dist/server-safe/constants.d.ts +156 -0
- package/dist/dist/server-safe/constants.d.ts.map +1 -0
- package/dist/dist/server-safe/constants.js +186 -0
- package/dist/dist/server-safe/constants.js.map +1 -0
- package/dist/dist/server-safe/contracts.d.ts +3 -0
- package/dist/dist/server-safe/contracts.d.ts.map +1 -0
- package/dist/dist/server-safe/contracts.js +15 -0
- package/dist/dist/server-safe/contracts.js.map +1 -0
- package/dist/dist/server-safe/database.types.d.ts +9510 -0
- package/dist/dist/server-safe/database.types.d.ts.map +1 -0
- package/dist/dist/server-safe/database.types.js +40 -0
- package/dist/dist/server-safe/database.types.js.map +1 -0
- package/dist/dist/server-safe/entitlements.d.ts +99 -0
- package/dist/dist/server-safe/entitlements.d.ts.map +1 -0
- package/dist/dist/server-safe/entitlements.js +487 -0
- package/dist/dist/server-safe/entitlements.js.map +1 -0
- package/dist/dist/server-safe/facebookAdsLeads.d.ts +225 -0
- package/dist/dist/server-safe/facebookAdsLeads.d.ts.map +1 -0
- package/dist/dist/server-safe/facebookAdsLeads.js +376 -0
- package/dist/dist/server-safe/facebookAdsLeads.js.map +1 -0
- package/dist/dist/server-safe/facebookAdsLeads.test.d.ts +2 -0
- package/dist/dist/server-safe/facebookAdsLeads.test.d.ts.map +1 -0
- package/dist/dist/server-safe/facebookAdsLeads.test.js +189 -0
- package/dist/dist/server-safe/facebookAdsLeads.test.js.map +1 -0
- package/dist/dist/server-safe/facebookAdsLeadsSql.test.d.ts +2 -0
- package/dist/dist/server-safe/facebookAdsLeadsSql.test.d.ts.map +1 -0
- package/dist/dist/server-safe/facebookAdsLeadsSql.test.js +32 -0
- package/dist/dist/server-safe/facebookAdsLeadsSql.test.js.map +1 -0
- package/dist/dist/server-safe/facebookMessenger.d.ts +20 -0
- package/dist/dist/server-safe/facebookMessenger.d.ts.map +1 -0
- package/dist/dist/server-safe/facebookMessenger.js +63 -0
- package/dist/dist/server-safe/facebookMessenger.js.map +1 -0
- package/dist/dist/server-safe/facebookMessenger.test.d.ts +2 -0
- package/dist/dist/server-safe/facebookMessenger.test.d.ts.map +1 -0
- package/dist/dist/server-safe/facebookMessenger.test.js +51 -0
- package/dist/dist/server-safe/facebookMessenger.test.js.map +1 -0
- package/dist/dist/server-safe/helpers.d.ts +78 -0
- package/dist/dist/server-safe/helpers.d.ts.map +1 -0
- package/dist/dist/server-safe/helpers.js +569 -0
- package/dist/dist/server-safe/helpers.js.map +1 -0
- package/dist/dist/server-safe/index.d.ts +30 -0
- package/dist/dist/server-safe/index.d.ts.map +1 -0
- package/dist/dist/server-safe/index.js +46 -0
- package/dist/dist/server-safe/index.js.map +1 -0
- package/dist/dist/server-safe/permissions.d.ts +29 -0
- package/dist/dist/server-safe/permissions.d.ts.map +1 -0
- package/dist/dist/server-safe/permissions.js +180 -0
- package/dist/dist/server-safe/permissions.js.map +1 -0
- package/dist/dist/server-safe/proposals.d.ts +6 -0
- package/dist/dist/server-safe/proposals.d.ts.map +1 -0
- package/dist/dist/server-safe/proposals.js +58 -0
- package/dist/dist/server-safe/proposals.js.map +1 -0
- package/dist/dist/server-safe/rentalAvailability.d.ts +56 -0
- package/dist/dist/server-safe/rentalAvailability.d.ts.map +1 -0
- package/dist/dist/server-safe/rentalAvailability.js +124 -0
- package/dist/dist/server-safe/rentalAvailability.js.map +1 -0
- package/dist/dist/server-safe/rentalAvailability.test.d.ts +2 -0
- package/dist/dist/server-safe/rentalAvailability.test.d.ts.map +1 -0
- package/dist/dist/server-safe/rentalAvailability.test.js +290 -0
- package/dist/dist/server-safe/rentalAvailability.test.js.map +1 -0
- package/dist/dist/server-safe/rentals.d.ts +95 -0
- package/dist/dist/server-safe/rentals.d.ts.map +1 -0
- package/dist/dist/server-safe/rentals.js +432 -0
- package/dist/dist/server-safe/rentals.js.map +1 -0
- package/dist/dist/server-safe/rentals.test.d.ts +2 -0
- package/dist/dist/server-safe/rentals.test.d.ts.map +1 -0
- package/dist/dist/server-safe/rentals.test.js +1034 -0
- package/dist/dist/server-safe/rentals.test.js.map +1 -0
- package/dist/dist/server-safe/routeOptimization.d.ts +155 -0
- package/dist/dist/server-safe/routeOptimization.d.ts.map +1 -0
- package/dist/dist/server-safe/routeOptimization.js +120 -0
- package/dist/dist/server-safe/routeOptimization.js.map +1 -0
- package/dist/dist/server-safe/routeOptimization.test.d.ts +2 -0
- package/dist/dist/server-safe/routeOptimization.test.d.ts.map +1 -0
- package/dist/dist/server-safe/routeOptimization.test.js +234 -0
- package/dist/dist/server-safe/routeOptimization.test.js.map +1 -0
- package/dist/dist/server-safe/routePlanFingerprint.d.ts +13 -0
- package/dist/dist/server-safe/routePlanFingerprint.d.ts.map +1 -0
- package/dist/dist/server-safe/routePlanFingerprint.js +49 -0
- package/dist/dist/server-safe/routePlanFingerprint.js.map +1 -0
- package/dist/dist/server-safe/routePlanFingerprint.test.d.ts +2 -0
- package/dist/dist/server-safe/routePlanFingerprint.test.d.ts.map +1 -0
- package/dist/dist/server-safe/routePlanFingerprint.test.js +68 -0
- package/dist/dist/server-safe/routePlanFingerprint.test.js.map +1 -0
- package/dist/dist/server-safe/scheduleListOrder.d.ts +18 -0
- package/dist/dist/server-safe/scheduleListOrder.d.ts.map +1 -0
- package/dist/dist/server-safe/scheduleListOrder.js +92 -0
- package/dist/dist/server-safe/scheduleListOrder.js.map +1 -0
- package/dist/dist/server-safe/scheduleListOrder.test.d.ts +2 -0
- package/dist/dist/server-safe/scheduleListOrder.test.d.ts.map +1 -0
- package/dist/dist/server-safe/scheduleListOrder.test.js +260 -0
- package/dist/dist/server-safe/scheduleListOrder.test.js.map +1 -0
- package/dist/dist/server-safe/serviceMinutes.d.ts +13 -0
- package/dist/dist/server-safe/serviceMinutes.d.ts.map +1 -0
- package/dist/dist/server-safe/serviceMinutes.js +38 -0
- package/dist/dist/server-safe/serviceMinutes.js.map +1 -0
- package/dist/dist/server-safe/serviceMinutes.test.d.ts +2 -0
- package/dist/dist/server-safe/serviceMinutes.test.d.ts.map +1 -0
- package/dist/dist/server-safe/serviceMinutes.test.js +86 -0
- package/dist/dist/server-safe/serviceMinutes.test.js.map +1 -0
- package/dist/dist/server-safe/settingsSearch.d.ts +24 -0
- package/dist/dist/server-safe/settingsSearch.d.ts.map +1 -0
- package/dist/dist/server-safe/settingsSearch.js +8 -0
- package/dist/dist/server-safe/settingsSearch.js.map +1 -0
- package/dist/dist/server-safe/supportChat.d.ts +59 -0
- package/dist/dist/server-safe/supportChat.d.ts.map +1 -0
- package/dist/dist/server-safe/supportChat.js +56 -0
- package/dist/dist/server-safe/supportChat.js.map +1 -0
- package/dist/dist/server-safe/templates.d.ts +15 -0
- package/dist/dist/server-safe/templates.d.ts.map +1 -0
- package/dist/dist/server-safe/templates.js +91 -0
- package/dist/dist/server-safe/templates.js.map +1 -0
- package/dist/dist/server-safe/templates.test.d.ts +2 -0
- package/dist/dist/server-safe/templates.test.d.ts.map +1 -0
- package/dist/dist/server-safe/templates.test.js +62 -0
- package/dist/dist/server-safe/templates.test.js.map +1 -0
- package/dist/dist/server-safe/trash.d.ts +50 -0
- package/dist/dist/server-safe/trash.d.ts.map +1 -0
- package/dist/dist/server-safe/trash.js +100 -0
- package/dist/dist/server-safe/trash.js.map +1 -0
- package/dist/dist/utils/LogHandler.d.ts +3 -0
- package/dist/dist/utils/LogHandler.d.ts.map +1 -0
- package/dist/dist/utils/LogHandler.js +16 -0
- package/dist/dist/utils/LogHandler.js.map +1 -0
- package/dist/dist/utils/convertSupabaseImagesToAssets.d.ts +28 -0
- package/dist/dist/utils/convertSupabaseImagesToAssets.d.ts.map +1 -0
- package/dist/dist/utils/convertSupabaseImagesToAssets.js +14 -0
- package/dist/dist/utils/convertSupabaseImagesToAssets.js.map +1 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +61 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/index.d.ts +1238 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +3 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/providers/AddressProvider.d.ts +9 -0
- package/dist/providers/AddressProvider.d.ts.map +1 -0
- package/dist/providers/AddressProvider.js +207 -0
- package/dist/providers/AddressProvider.js.map +1 -0
- package/dist/providers/AutomationsProvider.d.ts +11 -0
- package/dist/providers/AutomationsProvider.d.ts.map +1 -0
- package/dist/providers/AutomationsProvider.js +170 -0
- package/dist/providers/AutomationsProvider.js.map +1 -0
- package/dist/providers/BlockedNumbersProvider.d.ts +7 -0
- package/dist/providers/BlockedNumbersProvider.d.ts.map +1 -0
- package/dist/providers/BlockedNumbersProvider.js +71 -0
- package/dist/providers/BlockedNumbersProvider.js.map +1 -0
- package/dist/providers/CategoryProvider.d.ts +8 -0
- package/dist/providers/CategoryProvider.d.ts.map +1 -0
- package/dist/providers/CategoryProvider.js +95 -0
- package/dist/providers/CategoryProvider.js.map +1 -0
- package/dist/providers/ClientProvider.d.ts +39 -0
- package/dist/providers/ClientProvider.d.ts.map +1 -0
- package/dist/providers/ClientProvider.js +253 -0
- package/dist/providers/ClientProvider.js.map +1 -0
- package/dist/providers/CompanyProvider.d.ts +7 -0
- package/dist/providers/CompanyProvider.d.ts.map +1 -0
- package/dist/providers/CompanyProvider.js +114 -0
- package/dist/providers/CompanyProvider.js.map +1 -0
- package/dist/providers/DashboardProvider.d.ts +78 -0
- package/dist/providers/DashboardProvider.d.ts.map +1 -0
- package/dist/providers/DashboardProvider.js +568 -0
- package/dist/providers/DashboardProvider.js.map +1 -0
- package/dist/providers/DiscountProvider.d.ts +8 -0
- package/dist/providers/DiscountProvider.d.ts.map +1 -0
- package/dist/providers/DiscountProvider.js +92 -0
- package/dist/providers/DiscountProvider.js.map +1 -0
- package/dist/providers/EmployeesProvider.d.ts +6 -0
- package/dist/providers/EmployeesProvider.d.ts.map +1 -0
- package/dist/providers/EmployeesProvider.js +185 -0
- package/dist/providers/EmployeesProvider.js.map +1 -0
- package/dist/providers/EstimatesProvider.d.ts +16 -0
- package/dist/providers/EstimatesProvider.d.ts.map +1 -0
- package/dist/providers/EstimatesProvider.js +251 -0
- package/dist/providers/EstimatesProvider.js.map +1 -0
- package/dist/providers/EventsProvider.d.ts +4 -0
- package/dist/providers/EventsProvider.d.ts.map +1 -0
- package/dist/providers/EventsProvider.js +24 -0
- package/dist/providers/EventsProvider.js.map +1 -0
- package/dist/providers/FilesProvider.d.ts +17 -0
- package/dist/providers/FilesProvider.d.ts.map +1 -0
- package/dist/providers/FilesProvider.js +201 -0
- package/dist/providers/FilesProvider.js.map +1 -0
- package/dist/providers/InvoicesProvider.d.ts +13 -0
- package/dist/providers/InvoicesProvider.d.ts.map +1 -0
- package/dist/providers/InvoicesProvider.js +207 -0
- package/dist/providers/InvoicesProvider.js.map +1 -0
- package/dist/providers/ItemProvider.d.ts +9 -0
- package/dist/providers/ItemProvider.d.ts.map +1 -0
- package/dist/providers/ItemProvider.js +201 -0
- package/dist/providers/ItemProvider.js.map +1 -0
- package/dist/providers/JobSourceProvider.d.ts +8 -0
- package/dist/providers/JobSourceProvider.d.ts.map +1 -0
- package/dist/providers/JobSourceProvider.js +75 -0
- package/dist/providers/JobSourceProvider.js.map +1 -0
- package/dist/providers/JobTypeProvider.d.ts +8 -0
- package/dist/providers/JobTypeProvider.d.ts.map +1 -0
- package/dist/providers/JobTypeProvider.js +75 -0
- package/dist/providers/JobTypeProvider.js.map +1 -0
- package/dist/providers/JobsProvider.d.ts +20 -0
- package/dist/providers/JobsProvider.d.ts.map +1 -0
- package/dist/providers/JobsProvider.js +863 -0
- package/dist/providers/JobsProvider.js.map +1 -0
- package/dist/providers/MessagesProvider.d.ts +14 -0
- package/dist/providers/MessagesProvider.d.ts.map +1 -0
- package/dist/providers/MessagesProvider.js +415 -0
- package/dist/providers/MessagesProvider.js.map +1 -0
- package/dist/providers/PaymentProvider.d.ts +9 -0
- package/dist/providers/PaymentProvider.d.ts.map +1 -0
- package/dist/providers/PaymentProvider.js +48 -0
- package/dist/providers/PaymentProvider.js.map +1 -0
- package/dist/providers/PermissionRolesProvider.d.ts +5 -0
- package/dist/providers/PermissionRolesProvider.d.ts.map +1 -0
- package/dist/providers/PermissionRolesProvider.js +30 -0
- package/dist/providers/PermissionRolesProvider.js.map +1 -0
- package/dist/providers/PhoneNumberProvider.d.ts +12 -0
- package/dist/providers/PhoneNumberProvider.d.ts.map +1 -0
- package/dist/providers/PhoneNumberProvider.js +184 -0
- package/dist/providers/PhoneNumberProvider.js.map +1 -0
- package/dist/providers/ProfileProvider.d.ts +6 -0
- package/dist/providers/ProfileProvider.d.ts.map +1 -0
- package/dist/providers/ProfileProvider.js +71 -0
- package/dist/providers/ProfileProvider.js.map +1 -0
- package/dist/providers/RentalsProvider.d.ts +28 -0
- package/dist/providers/RentalsProvider.d.ts.map +1 -0
- package/dist/providers/RentalsProvider.js +438 -0
- package/dist/providers/RentalsProvider.js.map +1 -0
- package/dist/providers/SettingsBookingProvider.d.ts +9 -0
- package/dist/providers/SettingsBookingProvider.d.ts.map +1 -0
- package/dist/providers/SettingsBookingProvider.js +163 -0
- package/dist/providers/SettingsBookingProvider.js.map +1 -0
- package/dist/providers/SettingsProvider.d.ts +8 -0
- package/dist/providers/SettingsProvider.d.ts.map +1 -0
- package/dist/providers/SettingsProvider.js +86 -0
- package/dist/providers/SettingsProvider.js.map +1 -0
- package/dist/providers/TagsProvider.d.ts +12 -0
- package/dist/providers/TagsProvider.d.ts.map +1 -0
- package/dist/providers/TagsProvider.js +210 -0
- package/dist/providers/TagsProvider.js.map +1 -0
- package/dist/providers/TimeCardProvider.d.ts +8 -0
- package/dist/providers/TimeCardProvider.d.ts.map +1 -0
- package/dist/providers/TimeCardProvider.js +93 -0
- package/dist/providers/TimeCardProvider.js.map +1 -0
- package/dist/providers/TrashProvider.d.ts +13 -0
- package/dist/providers/TrashProvider.d.ts.map +1 -0
- package/dist/providers/TrashProvider.js +98 -0
- package/dist/providers/TrashProvider.js.map +1 -0
- package/dist/providers/dashboardAnalytics.d.ts +9 -0
- package/dist/providers/dashboardAnalytics.d.ts.map +1 -0
- package/dist/providers/dashboardAnalytics.js +41 -0
- package/dist/providers/dashboardAnalytics.js.map +1 -0
- package/dist/providers/dashboardAnalytics.test.d.ts +2 -0
- package/dist/providers/dashboardAnalytics.test.d.ts.map +1 -0
- package/dist/providers/dashboardAnalytics.test.js +111 -0
- package/dist/providers/dashboardAnalytics.test.js.map +1 -0
- package/dist/server-safe/BlockedNumberFunctions.d.ts +11 -0
- package/dist/server-safe/BlockedNumberFunctions.d.ts.map +1 -0
- package/dist/server-safe/BlockedNumberFunctions.js +16 -0
- package/dist/server-safe/BlockedNumberFunctions.js.map +1 -0
- package/dist/server-safe/EmployeeFunctions.d.ts +14 -0
- package/dist/server-safe/EmployeeFunctions.d.ts.map +1 -0
- package/dist/server-safe/EmployeeFunctions.js +70 -0
- package/dist/server-safe/EmployeeFunctions.js.map +1 -0
- package/dist/server-safe/EmployeeLocationFunctions.d.ts +7 -0
- package/dist/server-safe/EmployeeLocationFunctions.d.ts.map +1 -0
- package/dist/server-safe/EmployeeLocationFunctions.js +47 -0
- package/dist/server-safe/EmployeeLocationFunctions.js.map +1 -0
- package/dist/server-safe/EstimateFunctions.d.ts +15 -0
- package/dist/server-safe/EstimateFunctions.d.ts.map +1 -0
- package/dist/server-safe/EstimateFunctions.js +34 -0
- package/dist/server-safe/EstimateFunctions.js.map +1 -0
- package/dist/server-safe/InvoiceFunctions.d.ts +21 -0
- package/dist/server-safe/InvoiceFunctions.d.ts.map +1 -0
- package/dist/server-safe/InvoiceFunctions.js +124 -0
- package/dist/server-safe/InvoiceFunctions.js.map +1 -0
- package/dist/server-safe/JobFunctions.d.ts +15 -0
- package/dist/server-safe/JobFunctions.d.ts.map +1 -0
- package/dist/server-safe/JobFunctions.js +56 -0
- package/dist/server-safe/JobFunctions.js.map +1 -0
- package/dist/server-safe/PaymentFunctions.d.ts +16 -0
- package/dist/server-safe/PaymentFunctions.d.ts.map +1 -0
- package/dist/server-safe/PaymentFunctions.js +80 -0
- package/dist/server-safe/PaymentFunctions.js.map +1 -0
- package/dist/server-safe/PermissionFunctions.d.ts +7 -0
- package/dist/server-safe/PermissionFunctions.d.ts.map +1 -0
- package/dist/server-safe/PermissionFunctions.js +39 -0
- package/dist/server-safe/PermissionFunctions.js.map +1 -0
- package/dist/server-safe/TagFunctions.d.ts +18 -0
- package/dist/server-safe/TagFunctions.d.ts.map +1 -0
- package/dist/server-safe/TagFunctions.js +52 -0
- package/dist/server-safe/TagFunctions.js.map +1 -0
- package/dist/server-safe/autoJobType.d.ts +16 -0
- package/dist/server-safe/autoJobType.d.ts.map +1 -0
- package/dist/server-safe/autoJobType.js +39 -0
- package/dist/server-safe/autoJobType.js.map +1 -0
- package/dist/server-safe/autoJobType.test.d.ts +2 -0
- package/dist/server-safe/autoJobType.test.d.ts.map +1 -0
- package/dist/server-safe/autoJobType.test.js +83 -0
- package/dist/server-safe/autoJobType.test.js.map +1 -0
- package/dist/server-safe/automations.d.ts +197 -0
- package/dist/server-safe/automations.d.ts.map +1 -0
- package/dist/server-safe/automations.js +757 -0
- package/dist/server-safe/automations.js.map +1 -0
- package/dist/server-safe/automations.test.d.ts +2 -0
- package/dist/server-safe/automations.test.d.ts.map +1 -0
- package/dist/server-safe/automations.test.js +441 -0
- package/dist/server-safe/automations.test.js.map +1 -0
- package/dist/server-safe/constants.d.ts +156 -0
- package/dist/server-safe/constants.d.ts.map +1 -0
- package/dist/server-safe/constants.js +186 -0
- package/dist/server-safe/constants.js.map +1 -0
- package/dist/server-safe/contracts.d.ts +3 -0
- package/dist/server-safe/contracts.d.ts.map +1 -0
- package/dist/server-safe/contracts.js +15 -0
- package/dist/server-safe/contracts.js.map +1 -0
- package/dist/server-safe/database.types.d.ts +9510 -0
- package/dist/server-safe/database.types.d.ts.map +1 -0
- package/dist/server-safe/database.types.js +40 -0
- package/dist/server-safe/database.types.js.map +1 -0
- package/dist/server-safe/entitlements.d.ts +99 -0
- package/dist/server-safe/entitlements.d.ts.map +1 -0
- package/dist/server-safe/entitlements.js +487 -0
- package/dist/server-safe/entitlements.js.map +1 -0
- package/dist/server-safe/helpers.d.ts +78 -0
- package/dist/server-safe/helpers.d.ts.map +1 -0
- package/dist/server-safe/helpers.js +569 -0
- package/dist/server-safe/helpers.js.map +1 -0
- package/dist/server-safe/index.d.ts +30 -0
- package/dist/server-safe/index.d.ts.map +1 -0
- package/dist/server-safe/index.js +46 -0
- package/dist/server-safe/index.js.map +1 -0
- package/dist/server-safe/permissions.d.ts +29 -0
- package/dist/server-safe/permissions.d.ts.map +1 -0
- package/dist/server-safe/permissions.js +180 -0
- package/dist/server-safe/permissions.js.map +1 -0
- package/dist/server-safe/proposals.d.ts +6 -0
- package/dist/server-safe/proposals.d.ts.map +1 -0
- package/dist/server-safe/proposals.js +58 -0
- package/dist/server-safe/proposals.js.map +1 -0
- package/dist/server-safe/rentalAvailability.d.ts +56 -0
- package/dist/server-safe/rentalAvailability.d.ts.map +1 -0
- package/dist/server-safe/rentalAvailability.js +124 -0
- package/dist/server-safe/rentalAvailability.js.map +1 -0
- package/dist/server-safe/rentalAvailability.test.d.ts +2 -0
- package/dist/server-safe/rentalAvailability.test.d.ts.map +1 -0
- package/dist/server-safe/rentalAvailability.test.js +290 -0
- package/dist/server-safe/rentalAvailability.test.js.map +1 -0
- package/dist/server-safe/rentals.d.ts +95 -0
- package/dist/server-safe/rentals.d.ts.map +1 -0
- package/dist/server-safe/rentals.js +432 -0
- package/dist/server-safe/rentals.js.map +1 -0
- package/dist/server-safe/rentals.test.d.ts +2 -0
- package/dist/server-safe/rentals.test.d.ts.map +1 -0
- package/dist/server-safe/rentals.test.js +1034 -0
- package/dist/server-safe/rentals.test.js.map +1 -0
- package/dist/server-safe/routeOptimization.d.ts +155 -0
- package/dist/server-safe/routeOptimization.d.ts.map +1 -0
- package/dist/server-safe/routeOptimization.js +120 -0
- package/dist/server-safe/routeOptimization.js.map +1 -0
- package/dist/server-safe/routeOptimization.test.d.ts +2 -0
- package/dist/server-safe/routeOptimization.test.d.ts.map +1 -0
- package/dist/server-safe/routeOptimization.test.js +234 -0
- package/dist/server-safe/routeOptimization.test.js.map +1 -0
- package/dist/server-safe/routePlanFingerprint.d.ts +13 -0
- package/dist/server-safe/routePlanFingerprint.d.ts.map +1 -0
- package/dist/server-safe/routePlanFingerprint.js +49 -0
- package/dist/server-safe/routePlanFingerprint.js.map +1 -0
- package/dist/server-safe/routePlanFingerprint.test.d.ts +2 -0
- package/dist/server-safe/routePlanFingerprint.test.d.ts.map +1 -0
- package/dist/server-safe/routePlanFingerprint.test.js +68 -0
- package/dist/server-safe/routePlanFingerprint.test.js.map +1 -0
- package/dist/server-safe/scheduleListOrder.d.ts +18 -0
- package/dist/server-safe/scheduleListOrder.d.ts.map +1 -0
- package/dist/server-safe/scheduleListOrder.js +92 -0
- package/dist/server-safe/scheduleListOrder.js.map +1 -0
- package/dist/server-safe/scheduleListOrder.test.d.ts +2 -0
- package/dist/server-safe/scheduleListOrder.test.d.ts.map +1 -0
- package/dist/server-safe/scheduleListOrder.test.js +260 -0
- package/dist/server-safe/scheduleListOrder.test.js.map +1 -0
- package/dist/server-safe/serviceMinutes.d.ts +13 -0
- package/dist/server-safe/serviceMinutes.d.ts.map +1 -0
- package/dist/server-safe/serviceMinutes.js +38 -0
- package/dist/server-safe/serviceMinutes.js.map +1 -0
- package/dist/server-safe/serviceMinutes.test.d.ts +2 -0
- package/dist/server-safe/serviceMinutes.test.d.ts.map +1 -0
- package/dist/server-safe/serviceMinutes.test.js +86 -0
- package/dist/server-safe/serviceMinutes.test.js.map +1 -0
- package/dist/server-safe/settingsSearch.d.ts +24 -0
- package/dist/server-safe/settingsSearch.d.ts.map +1 -0
- package/dist/server-safe/settingsSearch.js +8 -0
- package/dist/server-safe/settingsSearch.js.map +1 -0
- package/dist/server-safe/supportChat.d.ts +59 -0
- package/dist/server-safe/supportChat.d.ts.map +1 -0
- package/dist/server-safe/supportChat.js +56 -0
- package/dist/server-safe/supportChat.js.map +1 -0
- package/dist/server-safe/templates.d.ts +15 -0
- package/dist/server-safe/templates.d.ts.map +1 -0
- package/dist/server-safe/templates.js +91 -0
- package/dist/server-safe/templates.js.map +1 -0
- package/dist/server-safe/templates.test.d.ts +2 -0
- package/dist/server-safe/templates.test.d.ts.map +1 -0
- package/dist/server-safe/templates.test.js +62 -0
- package/dist/server-safe/templates.test.js.map +1 -0
- package/dist/server-safe/trash.d.ts +50 -0
- package/dist/server-safe/trash.d.ts.map +1 -0
- package/dist/server-safe/trash.js +100 -0
- package/dist/server-safe/trash.js.map +1 -0
- package/dist/utils/LogHandler.d.ts +3 -0
- package/dist/utils/LogHandler.d.ts.map +1 -0
- package/dist/utils/LogHandler.js +16 -0
- package/dist/utils/LogHandler.js.map +1 -0
- package/dist/utils/convertSupabaseImagesToAssets.d.ts +28 -0
- package/dist/utils/convertSupabaseImagesToAssets.d.ts.map +1 -0
- package/dist/utils/convertSupabaseImagesToAssets.js +14 -0
- package/dist/utils/convertSupabaseImagesToAssets.js.map +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
alter table public.job_item
|
|
2
|
+
add column job_item_recurring_id uuid
|
|
3
|
+
references public.job_item_recurring(id) on delete set null;
|
|
4
|
+
|
|
5
|
+
create index job_item_job_item_recurring_id_idx
|
|
6
|
+
on public.job_item(job_item_recurring_id)
|
|
7
|
+
where job_item_recurring_id is not null;
|
package/dist/dist/migrations/20260625224612_add_dashboard_guided_tour_dismissed_to_settings_user.sql
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
alter table "public"."settings_user"
|
|
2
|
+
add column "dashboard_guided_tour_dismissed" boolean not null default false;
|
|
3
|
+
|
|
4
|
+
comment on column "public"."settings_user"."dashboard_guided_tour_dismissed"
|
|
5
|
+
is 'Tracks whether this user has dismissed the dashboard onboarding guided tour.';
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
create table if not exists "public"."support_chat_conversation" (
|
|
2
|
+
"id" "uuid" default "gen_random_uuid"() not null,
|
|
3
|
+
"created_at" timestamp with time zone default "now"() not null,
|
|
4
|
+
"updated_at" timestamp with time zone default "now"() not null,
|
|
5
|
+
"last_message_at" timestamp with time zone default "now"() not null,
|
|
6
|
+
"company_id" "uuid" not null,
|
|
7
|
+
"user_id" "uuid" not null,
|
|
8
|
+
"assistant_name" "text" not null default 'Wally'::"text",
|
|
9
|
+
"status" "text" not null default 'open'::"text",
|
|
10
|
+
"handoff_summary" "text",
|
|
11
|
+
"metadata" "jsonb" not null default '{}'::"jsonb",
|
|
12
|
+
constraint "support_chat_conversation_pkey" primary key ("id"),
|
|
13
|
+
constraint "support_chat_conversation_status_check" check (
|
|
14
|
+
"status" in ('open', 'handed_off', 'closed')
|
|
15
|
+
)
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
alter table "public"."support_chat_conversation" owner to "postgres";
|
|
19
|
+
|
|
20
|
+
alter table only "public"."support_chat_conversation"
|
|
21
|
+
add constraint "support_chat_conversation_company_id_fkey"
|
|
22
|
+
foreign key ("company_id") references "public"."company"("id") on delete cascade;
|
|
23
|
+
|
|
24
|
+
alter table only "public"."support_chat_conversation"
|
|
25
|
+
add constraint "support_chat_conversation_user_id_fkey"
|
|
26
|
+
foreign key ("user_id") references "public"."user"("id") on delete cascade;
|
|
27
|
+
|
|
28
|
+
create index if not exists "support_chat_conversation_company_id_idx"
|
|
29
|
+
on "public"."support_chat_conversation" using "btree" ("company_id");
|
|
30
|
+
|
|
31
|
+
create index if not exists "support_chat_conversation_user_id_idx"
|
|
32
|
+
on "public"."support_chat_conversation" using "btree" ("user_id");
|
|
33
|
+
|
|
34
|
+
create index if not exists "support_chat_conversation_last_message_at_idx"
|
|
35
|
+
on "public"."support_chat_conversation" using "btree" ("last_message_at" desc);
|
|
36
|
+
|
|
37
|
+
create or replace function "public"."set_support_chat_conversation_updated_at"()
|
|
38
|
+
returns "trigger"
|
|
39
|
+
language "plpgsql"
|
|
40
|
+
as $$
|
|
41
|
+
begin
|
|
42
|
+
new."updated_at" = "now"();
|
|
43
|
+
return new;
|
|
44
|
+
end;
|
|
45
|
+
$$;
|
|
46
|
+
|
|
47
|
+
alter function "public"."set_support_chat_conversation_updated_at"() owner to "postgres";
|
|
48
|
+
|
|
49
|
+
create or replace trigger "set_support_chat_conversation_updated_at_trigger"
|
|
50
|
+
before update on "public"."support_chat_conversation"
|
|
51
|
+
for each row
|
|
52
|
+
execute function "public"."set_support_chat_conversation_updated_at"();
|
|
53
|
+
|
|
54
|
+
create table if not exists "public"."support_chat_message" (
|
|
55
|
+
"id" "uuid" default "gen_random_uuid"() not null,
|
|
56
|
+
"created_at" timestamp with time zone default "now"() not null,
|
|
57
|
+
"conversation_id" "uuid" not null,
|
|
58
|
+
"company_id" "uuid" not null,
|
|
59
|
+
"user_id" "uuid" not null,
|
|
60
|
+
"role" "text" not null,
|
|
61
|
+
"content" "text" not null,
|
|
62
|
+
"model" "text",
|
|
63
|
+
"openai_response_id" "text",
|
|
64
|
+
"sources" "jsonb" not null default '[]'::"jsonb",
|
|
65
|
+
"metadata" "jsonb" not null default '{}'::"jsonb",
|
|
66
|
+
constraint "support_chat_message_pkey" primary key ("id"),
|
|
67
|
+
constraint "support_chat_message_role_check" check (
|
|
68
|
+
"role" in ('user', 'assistant', 'system')
|
|
69
|
+
)
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
alter table "public"."support_chat_message" owner to "postgres";
|
|
73
|
+
|
|
74
|
+
alter table only "public"."support_chat_message"
|
|
75
|
+
add constraint "support_chat_message_conversation_id_fkey"
|
|
76
|
+
foreign key ("conversation_id")
|
|
77
|
+
references "public"."support_chat_conversation"("id")
|
|
78
|
+
on delete cascade;
|
|
79
|
+
|
|
80
|
+
alter table only "public"."support_chat_message"
|
|
81
|
+
add constraint "support_chat_message_company_id_fkey"
|
|
82
|
+
foreign key ("company_id") references "public"."company"("id") on delete cascade;
|
|
83
|
+
|
|
84
|
+
alter table only "public"."support_chat_message"
|
|
85
|
+
add constraint "support_chat_message_user_id_fkey"
|
|
86
|
+
foreign key ("user_id") references "public"."user"("id") on delete cascade;
|
|
87
|
+
|
|
88
|
+
create index if not exists "support_chat_message_conversation_id_created_at_idx"
|
|
89
|
+
on "public"."support_chat_message" using "btree" ("conversation_id", "created_at");
|
|
90
|
+
|
|
91
|
+
create index if not exists "support_chat_message_company_id_idx"
|
|
92
|
+
on "public"."support_chat_message" using "btree" ("company_id");
|
|
93
|
+
|
|
94
|
+
create index if not exists "support_chat_message_user_id_idx"
|
|
95
|
+
on "public"."support_chat_message" using "btree" ("user_id");
|
|
96
|
+
|
|
97
|
+
create or replace function "public"."touch_support_chat_conversation_last_message_at"()
|
|
98
|
+
returns "trigger"
|
|
99
|
+
language "plpgsql"
|
|
100
|
+
as $$
|
|
101
|
+
begin
|
|
102
|
+
update "public"."support_chat_conversation"
|
|
103
|
+
set "last_message_at" = greatest("support_chat_conversation"."last_message_at", new."created_at")
|
|
104
|
+
where "id" = new."conversation_id";
|
|
105
|
+
|
|
106
|
+
return new;
|
|
107
|
+
end;
|
|
108
|
+
$$;
|
|
109
|
+
|
|
110
|
+
alter function "public"."touch_support_chat_conversation_last_message_at"() owner to "postgres";
|
|
111
|
+
|
|
112
|
+
create or replace trigger "touch_support_chat_conversation_last_message_at_trigger"
|
|
113
|
+
after insert on "public"."support_chat_message"
|
|
114
|
+
for each row
|
|
115
|
+
execute function "public"."touch_support_chat_conversation_last_message_at"();
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
-- Support chat rows are written exclusively by the server through service_role
|
|
2
|
+
-- (API routes in autopilot-web). Authenticated clients get read-only access to
|
|
3
|
+
-- their own conversations and messages; status and handoff_summary on
|
|
4
|
+
-- support_chat_conversation are server-managed.
|
|
5
|
+
|
|
6
|
+
alter table "public"."support_chat_conversation" enable row level security;
|
|
7
|
+
alter table "public"."support_chat_message" enable row level security;
|
|
8
|
+
|
|
9
|
+
grant select on table "public"."support_chat_conversation" to "authenticated";
|
|
10
|
+
grant all on table "public"."support_chat_conversation" to "service_role";
|
|
11
|
+
|
|
12
|
+
grant select on table "public"."support_chat_message" to "authenticated";
|
|
13
|
+
grant all on table "public"."support_chat_message" to "service_role";
|
|
14
|
+
|
|
15
|
+
create policy "Users can view their own support chat conversations"
|
|
16
|
+
on "public"."support_chat_conversation"
|
|
17
|
+
for select
|
|
18
|
+
to "authenticated"
|
|
19
|
+
using (
|
|
20
|
+
((nullif(trim(both '"'::"text" from ("public"."get_my_claim"('autopilot_company_id'::"text"))::"text"), ''::"text"))::"uuid" = "company_id")
|
|
21
|
+
and ("auth"."uid"() = "user_id")
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
create policy "Users can view messages in their own support chat conversations"
|
|
25
|
+
on "public"."support_chat_message"
|
|
26
|
+
for select
|
|
27
|
+
to "authenticated"
|
|
28
|
+
using (
|
|
29
|
+
exists (
|
|
30
|
+
select 1
|
|
31
|
+
from "public"."support_chat_conversation" "conversation"
|
|
32
|
+
where "conversation"."id" = "support_chat_message"."conversation_id"
|
|
33
|
+
and "conversation"."company_id" = "support_chat_message"."company_id"
|
|
34
|
+
and "conversation"."user_id" = "auth"."uid"()
|
|
35
|
+
and ((nullif(trim(both '"'::"text" from ("public"."get_my_claim"('autopilot_company_id'::"text"))::"text"), ''::"text"))::"uuid" = "support_chat_message"."company_id")
|
|
36
|
+
)
|
|
37
|
+
);
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
-- Estimates can optionally appear on the schedule and map like jobs.
|
|
2
|
+
-- Adds schedule columns to estimate (single day only - no recurring/multiday,
|
|
3
|
+
-- so no separate schedule table), an estimate_user join table for technician
|
|
4
|
+
-- assignment (mirrors job_user minus the schedule id), a settings_estimate
|
|
5
|
+
-- table for the company-level default of the "show on schedule" toggle, and
|
|
6
|
+
-- estimate notification template/enable columns on settings_notification
|
|
7
|
+
-- (mirroring the customer/contractor/employee job columns).
|
|
8
|
+
|
|
9
|
+
-- 1) estimate schedule columns.
|
|
10
|
+
-- schedule_status reuses job_status_enum; UI dropdowns offer only the five
|
|
11
|
+
-- manually-selectable statuses, but any enum value (e.g. Pending Confirmation
|
|
12
|
+
-- from a future estimate booking flow) is valid at the database level.
|
|
13
|
+
alter table "public"."estimate"
|
|
14
|
+
add column if not exists "show_on_schedule" boolean default false not null,
|
|
15
|
+
add column if not exists "schedule_start" timestamp with time zone,
|
|
16
|
+
add column if not exists "schedule_end" timestamp with time zone,
|
|
17
|
+
add column if not exists "schedule_status" "public"."job_status_enum";
|
|
18
|
+
|
|
19
|
+
create index if not exists "estimate_schedule_start_idx"
|
|
20
|
+
on "public"."estimate" using "btree" ("company_id", "schedule_start")
|
|
21
|
+
where "show_on_schedule" = true;
|
|
22
|
+
|
|
23
|
+
-- 2) estimate_user: technician assignment (one row per estimate/user pair).
|
|
24
|
+
create table if not exists "public"."estimate_user" (
|
|
25
|
+
"id" "uuid" default "gen_random_uuid"() not null,
|
|
26
|
+
"created_at" timestamp with time zone default "now"() not null,
|
|
27
|
+
"estimate_id" "uuid" not null,
|
|
28
|
+
"user_id" "uuid" not null,
|
|
29
|
+
"company_id" "uuid" not null,
|
|
30
|
+
constraint "estimate_user_pkey" primary key ("id"),
|
|
31
|
+
constraint "estimate_user_estimate_id_user_id_key" unique ("estimate_id", "user_id")
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
alter table "public"."estimate_user" owner to "postgres";
|
|
35
|
+
|
|
36
|
+
alter table only "public"."estimate_user"
|
|
37
|
+
add constraint "estimate_user_estimate_id_fkey"
|
|
38
|
+
foreign key ("estimate_id") references "public"."estimate"("id") on delete cascade;
|
|
39
|
+
|
|
40
|
+
alter table only "public"."estimate_user"
|
|
41
|
+
add constraint "estimate_user_user_id_fkey"
|
|
42
|
+
foreign key ("user_id") references "public"."user"("id") on delete cascade;
|
|
43
|
+
|
|
44
|
+
alter table only "public"."estimate_user"
|
|
45
|
+
add constraint "estimate_user_company_id_fkey"
|
|
46
|
+
foreign key ("company_id") references "public"."company"("id") on delete cascade;
|
|
47
|
+
|
|
48
|
+
create index if not exists "estimate_user_estimate_id_idx"
|
|
49
|
+
on "public"."estimate_user" using "btree" ("estimate_id");
|
|
50
|
+
|
|
51
|
+
create index if not exists "estimate_user_user_id_idx"
|
|
52
|
+
on "public"."estimate_user" using "btree" ("user_id");
|
|
53
|
+
|
|
54
|
+
create index if not exists "estimate_user_company_id_idx"
|
|
55
|
+
on "public"."estimate_user" using "btree" ("company_id");
|
|
56
|
+
|
|
57
|
+
grant all on table "public"."estimate_user" to "anon";
|
|
58
|
+
grant all on table "public"."estimate_user" to "authenticated";
|
|
59
|
+
grant all on table "public"."estimate_user" to "service_role";
|
|
60
|
+
|
|
61
|
+
-- 3) settings_estimate: company-level defaults for estimates.
|
|
62
|
+
create table if not exists "public"."settings_estimate" (
|
|
63
|
+
"id" "uuid" default "gen_random_uuid"() not null,
|
|
64
|
+
"created_at" timestamp with time zone default "now"() not null,
|
|
65
|
+
"company_id" "uuid" not null,
|
|
66
|
+
"default_show_on_schedule" boolean default false not null,
|
|
67
|
+
constraint "settings_estimate_pkey" primary key ("id"),
|
|
68
|
+
constraint "settings_estimate_company_id_key" unique ("company_id")
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
alter table "public"."settings_estimate" owner to "postgres";
|
|
72
|
+
|
|
73
|
+
alter table only "public"."settings_estimate"
|
|
74
|
+
add constraint "settings_estimate_company_id_fkey"
|
|
75
|
+
foreign key ("company_id") references "public"."company"("id") on delete cascade;
|
|
76
|
+
|
|
77
|
+
grant all on table "public"."settings_estimate" to "anon";
|
|
78
|
+
grant all on table "public"."settings_estimate" to "authenticated";
|
|
79
|
+
grant all on table "public"."settings_estimate" to "service_role";
|
|
80
|
+
|
|
81
|
+
-- 4) settings_notification: estimate SMS templates + enable toggles.
|
|
82
|
+
-- Defaults mirror the job columns: customer/contractor enabled, employee
|
|
83
|
+
-- disabled. Default texts stay in sync with the ESTIMATE_* constants in
|
|
84
|
+
-- src/server-safe/constants.ts.
|
|
85
|
+
alter table "public"."settings_notification"
|
|
86
|
+
add column if not exists "customer_estimate_open" "text" default 'This is a message from {{companyName}}. Your estimate appointment is scheduled for {{estimateDate}} at {{estimateTime}}. If you would like to opt out of future notifications like this, text STOP in reply to this message.'::"text" not null,
|
|
87
|
+
add column if not exists "customer_estimate_on_my_way" "text" default 'A team member is on their way for your estimate!'::"text" not null,
|
|
88
|
+
add column if not exists "customer_estimate_in_progress" "text" default 'We have begun your estimate.'::"text" not null,
|
|
89
|
+
add column if not exists "customer_estimate_canceled" "text" default 'Your estimate appointment has been canceled.'::"text" not null,
|
|
90
|
+
add column if not exists "customer_estimate_completed" "text" default 'Your estimate has been completed. Thank you!'::"text" not null,
|
|
91
|
+
add column if not exists "customer_estimate_updated" "text" default 'Your estimate appointment has been updated. We will arrive on {{estimateDate}} at {{estimateTime}}.'::"text" not null,
|
|
92
|
+
add column if not exists "customer_estimate_open_enabled" boolean default true not null,
|
|
93
|
+
add column if not exists "customer_estimate_on_my_way_enabled" boolean default true not null,
|
|
94
|
+
add column if not exists "customer_estimate_in_progress_enabled" boolean default true not null,
|
|
95
|
+
add column if not exists "customer_estimate_canceled_enabled" boolean default true not null,
|
|
96
|
+
add column if not exists "customer_estimate_completed_enabled" boolean default true not null,
|
|
97
|
+
add column if not exists "customer_estimate_updated_enabled" boolean default true not null,
|
|
98
|
+
add column if not exists "contractor_estimate_open" "text" default 'Hey {{subcontractorFirstName}}, {{companyName}} has scheduled an estimate for you (estimate ID #{{estimateId}}): {{estimateDate}} at {{estimateTime}} {{customerName}} {{customerAddress}} {{customerPhone}} Notes: {{estimateNotes}}'::"text" not null,
|
|
99
|
+
add column if not exists "contractor_estimate_on_my_way" "text" default 'We''ve notified the customer that you''re on your way.'::"text" not null,
|
|
100
|
+
add column if not exists "contractor_estimate_in_progress" "text" default 'An estimate you''re assigned to is now in progress.'::"text" not null,
|
|
101
|
+
add column if not exists "contractor_estimate_canceled" "text" default 'Hey {{subcontractorFirstName}}, estimate ID #{{estimateId}} has been canceled.'::"text" not null,
|
|
102
|
+
add column if not exists "contractor_estimate_completed" "text" default 'Hey {{subcontractorFirstName}}, estimate ID #{{estimateId}} has been completed.'::"text" not null,
|
|
103
|
+
add column if not exists "contractor_estimate_updated" "text" default 'Hey {{subcontractorFirstName}}, estimate ID #{{estimateId}} has been updated: {{estimateDate}} at {{estimateTime}} {{customerName}} {{customerAddress}} {{customerPhone}} Notes: {{estimateNotes}}'::"text" not null,
|
|
104
|
+
add column if not exists "contractor_estimate_open_enabled" boolean default true not null,
|
|
105
|
+
add column if not exists "contractor_estimate_on_my_way_enabled" boolean default true not null,
|
|
106
|
+
add column if not exists "contractor_estimate_in_progress_enabled" boolean default true not null,
|
|
107
|
+
add column if not exists "contractor_estimate_canceled_enabled" boolean default true not null,
|
|
108
|
+
add column if not exists "contractor_estimate_completed_enabled" boolean default true not null,
|
|
109
|
+
add column if not exists "contractor_estimate_updated_enabled" boolean default true not null,
|
|
110
|
+
add column if not exists "employee_estimate_open" "text" default 'Hey {{employeeFirstName}}, {{companyName}} has scheduled an estimate for you (estimate ID #{{estimateId}}): {{estimateDate}} at {{estimateTime}} {{customerName}} {{customerAddress}} {{customerPhone}} Notes: {{estimateNotes}}'::"text" not null,
|
|
111
|
+
add column if not exists "employee_estimate_on_my_way" "text" default 'We''ve notified the customer that you''re on your way.'::"text" not null,
|
|
112
|
+
add column if not exists "employee_estimate_in_progress" "text" default 'An estimate you''re assigned to is now in progress.'::"text" not null,
|
|
113
|
+
add column if not exists "employee_estimate_canceled" "text" default 'Hey {{employeeFirstName}}, estimate ID #{{estimateId}} has been canceled.'::"text" not null,
|
|
114
|
+
add column if not exists "employee_estimate_completed" "text" default 'Hey {{employeeFirstName}}, estimate ID #{{estimateId}} has been completed.'::"text" not null,
|
|
115
|
+
add column if not exists "employee_estimate_updated" "text" default 'Hey {{employeeFirstName}}, estimate ID #{{estimateId}} has been updated: {{estimateDate}} at {{estimateTime}} {{customerName}} {{customerAddress}} {{customerPhone}} Notes: {{estimateNotes}}'::"text" not null,
|
|
116
|
+
add column if not exists "employee_estimate_open_enabled" boolean default false not null,
|
|
117
|
+
add column if not exists "employee_estimate_on_my_way_enabled" boolean default false not null,
|
|
118
|
+
add column if not exists "employee_estimate_in_progress_enabled" boolean default false not null,
|
|
119
|
+
add column if not exists "employee_estimate_canceled_enabled" boolean default false not null,
|
|
120
|
+
add column if not exists "employee_estimate_completed_enabled" boolean default false not null,
|
|
121
|
+
add column if not exists "employee_estimate_updated_enabled" boolean default false not null;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
-- RLS for the estimate scheduling tables.
|
|
2
|
+
-- estimate_user gets the standard company-scoped CRUD policy (same as
|
|
3
|
+
-- job_user). settings_estimate gets the settings-table pair (same as
|
|
4
|
+
-- settings_job): owner/admin CRUD plus company-wide read-only SELECT so
|
|
5
|
+
-- field techs can read the default toggle.
|
|
6
|
+
-- The existing estimate and settings_notification policies already cover the
|
|
7
|
+
-- columns added in the companion migration.
|
|
8
|
+
|
|
9
|
+
alter table "public"."estimate_user" enable row level security;
|
|
10
|
+
alter table "public"."settings_estimate" enable row level security;
|
|
11
|
+
|
|
12
|
+
create policy "Anyone with matching company_id can CRUD"
|
|
13
|
+
on "public"."estimate_user"
|
|
14
|
+
to "authenticated"
|
|
15
|
+
using (
|
|
16
|
+
((nullif(trim(both '"'::"text" from ("public"."get_my_claim"('autopilot_company_id'::"text"))::"text"), ''::"text"))::"uuid" = "company_id")
|
|
17
|
+
)
|
|
18
|
+
with check (
|
|
19
|
+
((nullif(trim(both '"'::"text" from ("public"."get_my_claim"('autopilot_company_id'::"text"))::"text"), ''::"text"))::"uuid" = "company_id")
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
create policy "Enable CRUD for owner and admin with matching company_id"
|
|
23
|
+
on "public"."settings_estimate"
|
|
24
|
+
to "authenticated"
|
|
25
|
+
using (
|
|
26
|
+
((coalesce(("public"."get_my_claim"('autopilot_role'::"text"))::"text", ''::"text") = '"owner"'::"text")
|
|
27
|
+
or (coalesce(("public"."get_my_claim"('autopilot_role'::"text"))::"text", ''::"text") = '"admin"'::"text"))
|
|
28
|
+
and ((nullif(trim(both '"'::"text" from ("public"."get_my_claim"('autopilot_company_id'::"text"))::"text"), ''::"text"))::"uuid" = "company_id")
|
|
29
|
+
)
|
|
30
|
+
with check (
|
|
31
|
+
((coalesce(("public"."get_my_claim"('autopilot_role'::"text"))::"text", ''::"text") = '"owner"'::"text")
|
|
32
|
+
or (coalesce(("public"."get_my_claim"('autopilot_role'::"text"))::"text", ''::"text") = '"admin"'::"text"))
|
|
33
|
+
and ((nullif(trim(both '"'::"text" from ("public"."get_my_claim"('autopilot_company_id'::"text"))::"text"), ''::"text"))::"uuid" = "company_id")
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
create policy "Read-only for matching companyId"
|
|
37
|
+
on "public"."settings_estimate"
|
|
38
|
+
for select
|
|
39
|
+
to "authenticated"
|
|
40
|
+
using (
|
|
41
|
+
((nullif(trim(both '"'::"text" from ("public"."get_my_claim"('autopilot_company_id'::"text"))::"text"), ''::"text"))::"uuid" = "company_id")
|
|
42
|
+
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
-- Estimate reminder SMS settings, mirroring the customer_job_reminder /
|
|
2
|
+
-- _enabled / _time trio. Sent by a cron in autopilot-web the day before an
|
|
3
|
+
-- estimate's schedule_start when show_on_schedule is true.
|
|
4
|
+
-- Default text must stay in sync with
|
|
5
|
+
-- DEFAULT_CUSTOMER_ESTIMATE_STATUS_SMS.estimate_reminder in
|
|
6
|
+
-- src/server-safe/constants.ts.
|
|
7
|
+
|
|
8
|
+
alter table "public"."settings_notification"
|
|
9
|
+
add column if not exists "customer_estimate_reminder" "text" default 'Hi {{firstName}}, this is a reminder from {{companyName}} about your estimate appointment tomorrow at {{estimateStartTime}}! We will arrive between {{estimateArrivalWindow}}. Thank you!'::"text" not null,
|
|
10
|
+
add column if not exists "customer_estimate_reminder_enabled" boolean default false not null,
|
|
11
|
+
add column if not exists "customer_estimate_reminder_time" "text" default '19:00'::"text" not null;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
-- Blocked numbers: numbers a company has elected to block (never auto-detected).
|
|
2
|
+
-- Blocks are company-wide. phone_number is the normalized 10-digit form, the
|
|
3
|
+
-- same form used by message.client_number. Enforcement happens in
|
|
4
|
+
-- autopilot-web's Twilio webhooks (inbound SMS stored read=true with
|
|
5
|
+
-- notifications suppressed; incoming calls sent straight to voicemail).
|
|
6
|
+
|
|
7
|
+
create table if not exists "public"."blocked_number" (
|
|
8
|
+
"id" "uuid" default "gen_random_uuid"() not null,
|
|
9
|
+
"created_at" timestamp with time zone default "now"() not null,
|
|
10
|
+
"company_id" "uuid" not null,
|
|
11
|
+
"phone_number" "text" not null,
|
|
12
|
+
"blocked_by_user_id" "uuid",
|
|
13
|
+
constraint "blocked_number_pkey" primary key ("id"),
|
|
14
|
+
constraint "blocked_number_company_id_phone_number_key" unique ("company_id", "phone_number"),
|
|
15
|
+
constraint "blocked_number_phone_number_check" check (
|
|
16
|
+
"phone_number" ~ '^[0-9]{10}$'
|
|
17
|
+
)
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
alter table "public"."blocked_number" owner to "postgres";
|
|
21
|
+
|
|
22
|
+
alter table only "public"."blocked_number"
|
|
23
|
+
add constraint "blocked_number_company_id_fkey"
|
|
24
|
+
foreign key ("company_id") references "public"."company"("id") on delete cascade;
|
|
25
|
+
|
|
26
|
+
alter table only "public"."blocked_number"
|
|
27
|
+
add constraint "blocked_number_blocked_by_user_id_fkey"
|
|
28
|
+
foreign key ("blocked_by_user_id") references "public"."user"("id") on delete set null;
|
|
29
|
+
|
|
30
|
+
-- the unique constraint on (company_id, phone_number) doubles as the lookup
|
|
31
|
+
-- index for the webhook blocked checks, and its leading company_id column
|
|
32
|
+
-- also covers company-wide fetches; no separate index needed
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
-- RLS for blocked_number.
|
|
2
|
+
-- Standard company-scoped CRUD policy: any authenticated user in the company
|
|
3
|
+
-- can block/unblock (matches the gating on deleting a chat). service_role
|
|
4
|
+
-- gets full access so autopilot-web's Twilio webhooks (supabaseAdmin) can
|
|
5
|
+
-- check blocks when routing inbound SMS and calls.
|
|
6
|
+
|
|
7
|
+
alter table "public"."blocked_number" enable row level security;
|
|
8
|
+
|
|
9
|
+
-- no anon grant: this table has no anonymous use case, so unauthenticated
|
|
10
|
+
-- callers are stopped at the grant layer as well as by RLS default-deny
|
|
11
|
+
grant all on table "public"."blocked_number" to "authenticated";
|
|
12
|
+
grant all on table "public"."blocked_number" to "service_role";
|
|
13
|
+
|
|
14
|
+
create policy "Anyone with matching company_id can CRUD"
|
|
15
|
+
on "public"."blocked_number"
|
|
16
|
+
to "authenticated"
|
|
17
|
+
using (
|
|
18
|
+
((nullif(trim(both '"'::"text" from ("public"."get_my_claim"('autopilot_company_id'::"text"))::"text"), ''::"text"))::"uuid" = "company_id")
|
|
19
|
+
)
|
|
20
|
+
with check (
|
|
21
|
+
((nullif(trim(both '"'::"text" from ("public"."get_my_claim"('autopilot_company_id'::"text"))::"text"), ''::"text"))::"uuid" = "company_id")
|
|
22
|
+
);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
-- SMS opt-outs: numbers that have revoked SMS consent, either by replying with
|
|
2
|
+
-- an opt-out keyword (STOP etc., recorded by autopilot-web's inbound SMS
|
|
3
|
+
-- webhook) or discovered when Twilio rejects a send with error 21610
|
|
4
|
+
-- (unsubscribed recipient). Opt-outs are company-wide and consumer-elected.
|
|
5
|
+
-- phone_number is the normalized 10-digit form, the same form used by
|
|
6
|
+
-- message.client_number. Enforcement happens in autopilot-web's shared send
|
|
7
|
+
-- helper (pre-send check + 21610 persistence). Rows are cleared only when the
|
|
8
|
+
-- consumer texts an opt-in keyword (START/UNSTOP/YES).
|
|
9
|
+
|
|
10
|
+
create table if not exists "public"."sms_opt_out" (
|
|
11
|
+
"id" "uuid" default "gen_random_uuid"() not null,
|
|
12
|
+
"created_at" timestamp with time zone default "now"() not null,
|
|
13
|
+
"company_id" "uuid" not null,
|
|
14
|
+
"phone_number" "text" not null,
|
|
15
|
+
"source" "text" default 'stop_reply' not null,
|
|
16
|
+
constraint "sms_opt_out_pkey" primary key ("id"),
|
|
17
|
+
constraint "sms_opt_out_company_id_phone_number_key" unique ("company_id", "phone_number"),
|
|
18
|
+
constraint "sms_opt_out_phone_number_check" check (
|
|
19
|
+
"phone_number" ~ '^[0-9]{10}$'
|
|
20
|
+
),
|
|
21
|
+
constraint "sms_opt_out_source_check" check (
|
|
22
|
+
"source" in ('stop_reply', 'twilio_21610')
|
|
23
|
+
)
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
alter table "public"."sms_opt_out" owner to "postgres";
|
|
27
|
+
|
|
28
|
+
alter table only "public"."sms_opt_out"
|
|
29
|
+
add constraint "sms_opt_out_company_id_fkey"
|
|
30
|
+
foreign key ("company_id") references "public"."company"("id") on delete cascade;
|
|
31
|
+
|
|
32
|
+
-- source is an audit column distinguishing a customer-initiated STOP reply
|
|
33
|
+
-- from an opt-out discovered via a Twilio 21610 rejection; useful when
|
|
34
|
+
-- debugging why a message was not sent
|
|
35
|
+
|
|
36
|
+
-- the unique constraint on (company_id, phone_number) doubles as the lookup
|
|
37
|
+
-- index for the pre-send opt-out checks, and its leading company_id column
|
|
38
|
+
-- also covers company-wide fetches; no separate index needed
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- RLS for sms_opt_out.
|
|
2
|
+
-- Deliberately stricter than blocked_number: opt-outs are consumer-elected,
|
|
3
|
+
-- so a business must never be able to insert or delete rows and override a
|
|
4
|
+
-- consumer's consent. authenticated users get read-only, company-scoped
|
|
5
|
+
-- access (for any future UI surfacing); only service_role (autopilot-web's
|
|
6
|
+
-- inbound webhook and send paths via supabaseAdmin) may write.
|
|
7
|
+
|
|
8
|
+
alter table "public"."sms_opt_out" enable row level security;
|
|
9
|
+
|
|
10
|
+
-- no anon grant: this table has no anonymous use case, so unauthenticated
|
|
11
|
+
-- callers are stopped at the grant layer as well as by RLS default-deny
|
|
12
|
+
grant select on table "public"."sms_opt_out" to "authenticated";
|
|
13
|
+
grant all on table "public"."sms_opt_out" to "service_role";
|
|
14
|
+
|
|
15
|
+
create policy "Anyone with matching company_id can read"
|
|
16
|
+
on "public"."sms_opt_out"
|
|
17
|
+
for select
|
|
18
|
+
to "authenticated"
|
|
19
|
+
using (
|
|
20
|
+
((nullif(trim(both '"'::"text" from ("public"."get_my_claim"('autopilot_company_id'::"text"))::"text"), ''::"text"))::"uuid" = "company_id")
|
|
21
|
+
);
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
-- Task time tracking: start/stop timer entries per job_schedule (the "task"/day
|
|
2
|
+
-- on a schedule card). One shared timer per task — anyone can start/stop it —
|
|
3
|
+
-- with multiple start/stop cycles accumulating; total tracked time is the sum
|
|
4
|
+
-- of an entry set. A running timer is a row with end_time null (same
|
|
5
|
+
-- open-row model as time_card.clock_out). Separate from the employee
|
|
6
|
+
-- clock in/out feature (time_card), which tracks shifts, not tasks.
|
|
7
|
+
|
|
8
|
+
create table if not exists "public"."job_time_entry" (
|
|
9
|
+
"id" "uuid" default "gen_random_uuid"() not null,
|
|
10
|
+
"created_at" timestamp with time zone default "now"() not null,
|
|
11
|
+
"company_id" "uuid" not null,
|
|
12
|
+
"job_id" "uuid" not null,
|
|
13
|
+
"job_schedule_id" "uuid" not null,
|
|
14
|
+
"start_time" timestamp with time zone not null,
|
|
15
|
+
"end_time" timestamp with time zone,
|
|
16
|
+
"started_by_user_id" "uuid",
|
|
17
|
+
"stopped_by_user_id" "uuid",
|
|
18
|
+
constraint "job_time_entry_pkey" primary key ("id"),
|
|
19
|
+
constraint "job_time_entry_end_after_start_check" check (
|
|
20
|
+
"end_time" is null or "end_time" > "start_time"
|
|
21
|
+
)
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
alter table "public"."job_time_entry" owner to "postgres";
|
|
25
|
+
|
|
26
|
+
-- job_id is denormalized alongside job_schedule_id (mirroring job_user) so
|
|
27
|
+
-- per-job totals and the time report can query without joining job_schedule
|
|
28
|
+
alter table only "public"."job_time_entry"
|
|
29
|
+
add constraint "job_time_entry_company_id_fkey"
|
|
30
|
+
foreign key ("company_id") references "public"."company"("id") on delete cascade;
|
|
31
|
+
|
|
32
|
+
alter table only "public"."job_time_entry"
|
|
33
|
+
add constraint "job_time_entry_job_id_fkey"
|
|
34
|
+
foreign key ("job_id") references "public"."job"("id") on delete cascade;
|
|
35
|
+
|
|
36
|
+
alter table only "public"."job_time_entry"
|
|
37
|
+
add constraint "job_time_entry_job_schedule_id_fkey"
|
|
38
|
+
foreign key ("job_schedule_id") references "public"."job_schedule"("id") on delete cascade;
|
|
39
|
+
|
|
40
|
+
-- attribution is audit metadata only (who pressed start/stop); the timer
|
|
41
|
+
-- itself is task-level, not per-user
|
|
42
|
+
alter table only "public"."job_time_entry"
|
|
43
|
+
add constraint "job_time_entry_started_by_user_id_fkey"
|
|
44
|
+
foreign key ("started_by_user_id") references "public"."user"("id") on delete set null;
|
|
45
|
+
|
|
46
|
+
alter table only "public"."job_time_entry"
|
|
47
|
+
add constraint "job_time_entry_stopped_by_user_id_fkey"
|
|
48
|
+
foreign key ("stopped_by_user_id") references "public"."user"("id") on delete set null;
|
|
49
|
+
|
|
50
|
+
-- at most one running timer per task: a second concurrent "start" insert
|
|
51
|
+
-- fails with unique_violation (23505), which clients treat as "timer already
|
|
52
|
+
-- running" and refetch. Scoped by company_id so a crafted row referencing
|
|
53
|
+
-- another company's schedule can't block that company's timer (the FK alone
|
|
54
|
+
-- doesn't guarantee the schedule belongs to the row's company); legitimate
|
|
55
|
+
-- rows for a task all share a company_id, so the per-task guarantee holds.
|
|
56
|
+
create unique index "job_time_entry_one_running_per_schedule"
|
|
57
|
+
on "public"."job_time_entry" ("company_id", "job_schedule_id")
|
|
58
|
+
where "end_time" is null;
|
|
59
|
+
|
|
60
|
+
-- entries list for a task, ordered by start
|
|
61
|
+
create index "job_time_entry_job_schedule_id_start_time_idx"
|
|
62
|
+
on "public"."job_time_entry" ("job_schedule_id", "start_time");
|
|
63
|
+
|
|
64
|
+
-- date-range scan for the task time report
|
|
65
|
+
create index "job_time_entry_company_id_start_time_idx"
|
|
66
|
+
on "public"."job_time_entry" ("company_id", "start_time");
|
|
67
|
+
|
|
68
|
+
-- per-job totals (billing)
|
|
69
|
+
create index "job_time_entry_job_id_idx"
|
|
70
|
+
on "public"."job_time_entry" ("job_id");
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- RLS for job_time_entry.
|
|
2
|
+
-- Standard company-scoped CRUD policy: any authenticated user in the company
|
|
3
|
+
-- can start/stop timers and manage entries — field techs need start/stop from
|
|
4
|
+
-- mobile, office staff need manual add/edit on web. No role gating in v1.
|
|
5
|
+
|
|
6
|
+
alter table "public"."job_time_entry" enable row level security;
|
|
7
|
+
|
|
8
|
+
-- no anon grant: no anonymous use case, so unauthenticated callers are
|
|
9
|
+
-- stopped at the grant layer as well as by RLS default-deny
|
|
10
|
+
grant all on table "public"."job_time_entry" to "authenticated";
|
|
11
|
+
grant all on table "public"."job_time_entry" to "service_role";
|
|
12
|
+
|
|
13
|
+
create policy "Anyone with matching company_id can CRUD"
|
|
14
|
+
on "public"."job_time_entry"
|
|
15
|
+
to "authenticated"
|
|
16
|
+
using (
|
|
17
|
+
((nullif(trim(both '"'::"text" from ("public"."get_my_claim"('autopilot_company_id'::"text"))::"text"), ''::"text"))::"uuid" = "company_id")
|
|
18
|
+
)
|
|
19
|
+
with check (
|
|
20
|
+
((nullif(trim(both '"'::"text" from ("public"."get_my_claim"('autopilot_company_id'::"text"))::"text"), ''::"text"))::"uuid" = "company_id")
|
|
21
|
+
);
|