Functions
Generated by pnpm docs:reference from the local database (BE-M0-31). Never edit this page by hand (D27).
RPCs in the public schema
Section titled “RPCs in the public schema”The API exposes the public schema only; apps/web calls these with rpc().
| Function | Arguments | Returns | Runs as | Note |
|---|---|---|---|---|
public.accept_invitation |
TABLE(invitation_id uuid, organization_id uuid, pool_id uuid, status invitation_status, void_reason text, membership_id uuid) |
owner | Accepts or voids the pending invitation to the signed-in login's email (D101, D104, R-ACC-268 to R-ACC-270, R-ACC-276 to R-ACC-278). A void comes back as void_reason, an error key, without raising. | |
public.acknowledge_notification |
notification_id uuid |
void |
owner | Acknowledges an open notification the caller sees, once, for everyone who sees it (R-NTF-16 to R-NTF-19). |
public.activate_gps_device |
device_id uuid |
void |
owner | Makes a device its car's active one and puts the other on standby, in one call (R-GPS-22). |
public.add_body_panel |
organization_id uuid, code text, name text, area panel_area, name_en text DEFAULT NULL::text, vehicle_class vehicle_class DEFAULT 'car'::vehicle_class, sort_order integer DEFAULT 100 |
uuid |
owner | Adds a body panel; its code never changes (R-MD-54, R-MD-66). |
public.add_charge_type |
organization_id uuid, code text, name text, name_en text DEFAULT NULL::text, default_amount bigint DEFAULT NULL::bigint, needs_rental boolean DEFAULT false |
uuid |
owner | Adds a charge type; its default due days start at 3 (R-MD-24, R-MD-16). |
public.add_company_bank_account |
organization_id uuid, legal_entity_id uuid, label text, bank text, account_number text, account_name text |
uuid |
owner | Adds a bank account under a legal entity (R-MD-41). |
public.add_contract_template |
organization_id uuid, legal_entity_id uuid, platform ride_platform, name text, body text |
uuid |
owner | Adds the active template of a legal entity and platform, after its last version (R-MD-47). |
public.add_garage |
organization_id uuid, code text, name text, kind garage_kind DEFAULT 'general'::garage_kind, address text DEFAULT NULL::text, phone text DEFAULT NULL::text |
uuid |
owner | Adds a garage; its code is typed once and never changes (R-MD-54, R-MD-66). |
public.add_inspection_item_type |
organization_id uuid, code text, name text, section item_section, answer item_answer, name_en text DEFAULT NULL::text, applies_to item_applies_to DEFAULT 'all'::item_applies_to, vehicle_class vehicle_class DEFAULT NULL::vehicle_class, sort_order integer DEFAULT 100 |
uuid |
owner | Adds a checklist item; its code and answer kind never change (R-MD-54, R-MD-66, R-MD-70). |
public.add_insurer |
organization_id uuid, name text, phone text DEFAULT NULL::text, website text DEFAULT NULL::text |
uuid |
owner | Adds an insurer (R-MD-54). |
public.add_insurer_garage |
insurer_id uuid, garage_id uuid, partner_since date DEFAULT NULL::date |
uuid |
owner | Makes a garage an insurer's partner (R-MD-54, R-MD-60, R-MD-61). |
public.add_lead_source |
organization_id uuid, code text, name text, channel lead_channel, name_en text DEFAULT NULL::text, needs_note boolean DEFAULT false |
uuid |
owner | Adds a lead source (R-MD-24). |
public.add_legal_entity |
organization_id uuid, code text, legal_name text, address text DEFAULT NULL::text |
uuid |
owner | Adds a legal entity (R-TEN-12). |
public.add_policy |
vehicle_id uuid, insurer_id uuid, policy_number text, starts_on date, ends_on date, coverage text DEFAULT NULL::text, premium bigint DEFAULT NULL::bigint |
uuid |
owner | Saves an insurance policy for a car and returns its id; coverage and premium are optional (R-ASR-16 to R-ASR-22). Needs insurance:write at the car's home pool. |
public.add_pool |
organization_id uuid, code text, name text, city text, address text DEFAULT NULL::text, capacity integer DEFAULT NULL::integer, opened_on date DEFAULT NULL::date, timezone text DEFAULT NULL::text |
uuid |
owner | Adds a pool; without a time zone it takes Asia/Jakarta (R-TEN-12, R-TEN-16, R-TEN-21). |
public.add_pricing_group |
organization_id uuid, name text, driver_daily_rate bigint, admin_fee bigint |
uuid |
owner | Adds a pricing group (R-MD-24). |
public.add_rental_company |
organization_id uuid, name text, legal_name text DEFAULT NULL::text, contact_phone text DEFAULT NULL::text, bank_account_ref text DEFAULT NULL::text |
uuid |
owner | Adds a rental company (R-MD-55, R-MD-56). |
public.add_vehicle_brand |
organization_id uuid, name text, country text DEFAULT NULL::text |
uuid |
owner | Adds a brand (R-MD-24). |
public.add_vehicle_document |
vehicle_id uuid, doc_type vehicle_doc_type, expires_on date DEFAULT NULL::date, tax_due_on date DEFAULT NULL::date |
uuid |
owner | Adds a document to a car, with no file yet, and returns its id (R-VEH-48). |
public.add_vehicle_model |
brand_id uuid, name text, pricing_group_id uuid DEFAULT NULL::uuid, vehicle_class vehicle_class DEFAULT 'car'::vehicle_class, body_type text DEFAULT NULL::text, powertrain powertrain DEFAULT 'ice'::powertrain, tyre_size text DEFAULT NULL::text, transmission transmission DEFAULT NULL::transmission, default_service_type service_type DEFAULT NULL::service_type |
uuid |
owner | Adds a model under a brand, in the brand's organization (R-MD-24). |
public.add_vehicle_photo |
vehicle_id uuid, side vehicle_photo_side |
uuid |
owner | Adds a photo of one side of a car, with no file yet, and returns its id (R-VEH-54). |
public.assert_first_password |
void |
owner | Refuses a first password to a login that already has one, other than the random password Auth gave its invite (R-ACC-245). | |
public.caller_all_rental_companies |
organization_id uuid |
boolean |
owner | Whether the caller holds the all-companies flag in the organization, for a holder of master_data:read, payment:read or payment:approve there (R-MD-56, R-MD-76). |
public.caller_company_scoped |
pool_id uuid |
boolean |
owner | Whether the caller lacks the flag in the pool's organization, so is held to their own rental companies (R-ACC-151). |
public.can_set_company_scope |
pool_id uuid |
boolean |
owner | Whether the caller holds user:write at every active pool of the pool's organization (R-ACC-136, R-ACC-147). |
public.change_body_panel |
body_panel_id uuid, name text, name_en text, area panel_area, vehicle_class vehicle_class, sort_order integer |
void |
owner | Changes a body panel's names, area, vehicle class and sort order (R-MD-54). |
public.change_charge_type |
charge_type_id uuid, name text, name_en text, default_amount bigint, needs_rental boolean |
void |
owner | Changes a charge type's names, default amount and whether it needs a rental (R-MD-24, R-MD-32). |
public.change_company_bank_account |
account_id uuid, legal_entity_id uuid, label text, bank text, account_number text, account_name text |
void |
owner | Changes a bank account; it moves only to an active legal entity (R-MD-41, R-MD-45). |
public.change_contract_template |
template_id uuid, name text, body text |
uuid |
owner | Changes the active template by adding its next version; returns the new version's id (R-MD-46). |
public.change_garage |
garage_id uuid, name text, kind garage_kind, address text, phone text |
void |
owner | Changes a garage's name, kind, address and phone; its code stays (R-MD-54, R-MD-66). |
public.change_inspection_item_type |
item_type_id uuid, name text, name_en text, section item_section, applies_to item_applies_to, vehicle_class vehicle_class, sort_order integer |
void |
owner | Changes a checklist item's names, section, applies_to, vehicle class and sort order (R-MD-54, R-MD-70). |
public.change_insurer |
insurer_id uuid, name text, phone text, website text |
void |
owner | Changes an insurer's name, phone and website (R-MD-54). |
public.change_insurer_garage |
insurer_garage_id uuid, partner_since date |
void |
owner | Changes a partner garage's partner_since; its insurer and garage stay (R-MD-62). |
public.change_lead_source |
lead_source_id uuid, name text, name_en text, channel lead_channel, needs_note boolean |
void |
owner | Changes a lead source's names, channel and whether it needs a note (R-MD-24, R-MD-32). |
public.change_legal_entity |
legal_entity_id uuid, legal_name text, address text |
void |
owner | Changes a legal entity's legal name and address; its code stays (R-TEN-19). |
public.change_plate |
vehicle_id uuid, plate_number text |
void |
owner | Changes a car's plate, saved in upper case without spaces; the old plate goes into its plate history (R-VEH-85 to R-VEH-93). Needs vehicle:write at the car's home pool. |
public.change_policy |
policy_id uuid, insurer_id uuid, policy_number text, starts_on date, ends_on date, coverage text DEFAULT NULL::text, premium bigint DEFAULT NULL::bigint |
void |
owner | Replaces a policy's insurer, number, coverage, dates and premium, never its car (R-ASR-23). Needs insurance:write at the car's home pool. |
public.change_pool |
pool_id uuid, name text, city text, address text, capacity integer, opened_on date |
void |
owner | Changes a pool's name, city, address, capacity and opening date; its code and time zone stay (R-TEN-21). |
public.change_pricing_group |
pricing_group_id uuid, name text, driver_daily_rate bigint, admin_fee bigint |
void |
owner | Changes a pricing group's name, driver daily rate and admin fee (R-MD-24). |
public.change_rental_company |
rental_company_id uuid, name text, legal_name text, contact_phone text, bank_account_ref text |
void |
owner | Changes a rental company's name, legal name, contact phone and bank account reference (R-MD-55, R-MD-56). |
public.change_vehicle_brand |
brand_id uuid, name text, country text |
void |
owner | Changes a brand's name and country (R-MD-24). |
public.change_vehicle_model |
model_id uuid, brand_id uuid, name text, pricing_group_id uuid, vehicle_class vehicle_class, body_type text, powertrain powertrain, tyre_size text, transmission transmission, default_service_type service_type |
void |
owner | Changes every field of a model (R-MD-24, R-MD-19, R-MD-20). |
public.charge_margins |
charge_ids uuid[] |
TABLE(charge_id uuid, company_amount bigint, margin bigint) |
owner | company_amount and margin of readable charges, empty without payment:margin at the driver's pool (R-MON-39, D31). |
public.clear_override |
membership_id uuid, pool_id uuid, permission_code text |
void |
owner | Removes a member's override of one permission at one pool (R-ACC-128). Ends the member's sessions (R-ACC-08). |
public.create_vehicle |
home_pool_id uuid, model_id uuid, unit_code text, plate_number text, year integer DEFAULT NULL::integer, color text DEFAULT NULL::text, vin text DEFAULT NULL::text, odometer_km integer DEFAULT 0, rental_company_id uuid DEFAULT NULL::uuid |
uuid |
owner | Adds a car as not_ready and returns its id (R-VEH-47). |
public.delegable_permissions |
pool_id uuid |
TABLE(permission_code text, pool_today date, timezone text) |
owner | The delegable permissions the caller holds at a pool through a role, with the pool's today and time zone (R-ACC-252). |
public.delegate_permission |
membership_id uuid, pool_id uuid, permission_code text, reason text, last_day date DEFAULT NULL::date |
member_permission_overrides |
owner | Gives a member holding a role at a pool a delegated grant of a delegable permission the caller holds there through a role, until the end of last_day in the pool's time zone, or with no end (R-ACC-234, R-ACC-258). Ends the member's sessions (R-ACC-240). |
public.delegation_candidates |
pool_id uuid |
TABLE(membership_id uuid, name text) |
owner | The active members holding a role at a pool, other than the caller and within a scoped caller's set, for a caller who may delegate there (R-ACC-253, R-ACC-264). |
public.driver_names |
driver_ids uuid[] DEFAULT NULL::uuid[] |
TABLE(id uuid, full_name text) |
owner | Names of the drivers the caller may name (R-DRV-15, R-ACC-46). A partner account reads drivers only through this. |
public.find_vehicles |
q text |
TABLE(id uuid, unit_code text, plate_number text, pool_id uuid, pool_code text, status vehicle_status, supply_status supply_status, match_kind text, rental_company_name text) |
caller | Finds cars by unit code (trimmed, exact) or plate (whitespace removed, upper-cased), current or former, one row per car with its best match_kind: unit_code, plate or former_plate (R-VEH-32 to R-VEH-35). Not inactive cars first. Reads under the caller, so another pool's car is zero rows (R-VEH-36), a former plate needs vehicle:read (R-VEH-34), and a blank input returns no rows (R-VEH-37). The last column, rental_company_name, is the car's rental company under the caller, so it is null without master_data:read, payment:read or vehicle:write (R-VEH-46, R-VEH-74). |
public.grant_role |
membership_id uuid, pool_id uuid, role_id uuid |
member_roles |
owner | Gives an active member one role at one pool (R-ACC-108). Ends the member's sessions (R-ACC-08). |
public.invitable_roles |
TABLE(pool_id uuid, pool_code text, pool_name text, role_id uuid, role_code text, role_name text, company_scoped boolean, rental_companies jsonb) |
owner | The pools and roles the caller may invite to: user:write at the pool and every permission of the role there (R-ACC-90, R-ACC-91), with the caller's own active rental companies there (R-ACC-163). | |
public.invite_member |
email text, pool_id uuid, role_id uuid, rental_company_ids uuid[] DEFAULT '{}'::uuid[] |
sent_invitation |
owner | Records an invitation to join with one role at one pool (D98, R-ACC-57), limited to the rental companies given (R-ACC-154), for a login with no membership anywhere (R-ACC-92, D104). Returns it with its delivery, sign_in or invite (R-ACC-287), which apps/web sends through Auth. |
public.link_gps_device |
vehicle_id uuid, provider text, external_id text, slot gps_slot |
uuid |
owner | Links a device to a car in a slot and returns its id; registers a device it has not seen or re-links the unlinked row (R-GPS-23 to R-GPS-25, R-GPS-39, R-GPS-40). Needs vehicle:write at the car's home pool. |
public.member_detail |
membership_id uuid |
TABLE(membership_id uuid, profile_id uuid, full_name text, email text, status membership_status, joined_at timestamp with time zone, all_rental_companies boolean, rental_companies jsonb, roles jsonb) |
owner | One member of an organization where the caller holds user:read, with their status, the date they joined, their rental companies or flag, and their roles at the pools the caller may read (R-ACC-201). |
public.member_names |
profile_ids uuid[] DEFAULT NULL::uuid[] |
TABLE(id uuid, full_name text, avatar_path text) |
owner | Full name and avatar of the members of the caller's organizations (R-ACC-39). Pass ids to look up a few. |
public.move_vehicle_status |
vehicle_id uuid, to_status vehicle_status, note text DEFAULT NULL::text |
void |
owner | Retires, reactivates or pulls a car by hand, with an optional note on its status history row (R-VEH-94 to R-VEH-99). Every other move is refused with vehicle.status_move_forbidden. |
public.my_delegations |
TABLE(override_id uuid, pool_id uuid, pool_code text, pool_name text, permission_code text, granted_by_name text, reason text, ends_at timestamp with time zone, ends_on date, is_live boolean, given_at timestamp with time zone, timezone text) |
owner | The delegations given to the signed-in member at every pool, live and ended, with the giver's name, the end and its last day in the pool's time zone, and whether it is live (R-ACC-281). | |
public.my_permissions |
TABLE(organization_id uuid, pool_id uuid, pool_code text, permission_code text, pool_is_active boolean) |
caller | ||
public.overridable_permissions |
pool_id uuid |
TABLE(permission_code text) |
owner | The permission codes the caller may set an override of at the pool (R-ACC-145). |
public.pool_delegations |
pool_id uuid |
TABLE(override_id uuid, membership_id uuid, member_name text, permission_code text, granted_by uuid, granted_by_name text, reason text, ends_at timestamp with time zone, ends_on date, is_live boolean, can_revoke boolean, given_at timestamp with time zone, timezone text) |
owner | The delegations at a pool the caller may list, with the member's and the giver's names, the end and its last day in the pool's time zone, whether it is live and whether the caller may revoke it (R-ACC-242, R-ACC-251). |
public.pool_invitations |
pool_id uuid |
TABLE(invitation_id uuid, email text, role_id uuid, role_name text, invited_by uuid, invited_by_name text, last_sent_at timestamp with time zone, expires_at timestamp with time zone, status invitation_status, void_reason invitation_void_reason, all_rental_companies boolean, rental_companies jsonb, can_resend boolean, can_revoke boolean, can_restore boolean) |
owner | A pool's pending and voided invitations, last sent first, with what the caller may do to each, for user:read there (R-ACC-204, R-ACC-216). |
public.pool_members |
pool_id uuid |
TABLE(membership_id uuid, profile_id uuid, full_name text, email text, status membership_status, roles jsonb, overrides jsonb, rental_companies jsonb, all_rental_companies boolean, can_set_scope boolean, outside_scope boolean, can_grant boolean, joined_at timestamp with time zone, can_suspend boolean, can_reinstate boolean, can_remove boolean) |
owner | Every member of the pool's organization, with email, the date they joined, the roles and overrides held at the pool, delegated or not and with any end, their rental companies or flag, what the caller may change and whether the member is outside the caller's rental companies, for user:read there (R-ACC-118, R-ACC-122, R-ACC-144, R-ACC-147, R-ACC-153, R-ACC-167, R-ACC-168, R-ACC-198, R-ACC-199). |
public.reinstate_member |
membership_id uuid |
void |
owner | Sets a suspended member back to active; ends no sessions (R-ACC-188). |
public.remove_member |
membership_id uuid |
void |
owner | Removes a member's membership with their roles, overrides and rental companies; the profile stays (R-ACC-189). |
public.rental_company_names |
organization_id uuid DEFAULT NULL::uuid |
TABLE(id uuid, name text, is_active boolean) |
owner | Rental companies' ids, names and whether each is active, for a vehicle:write holder at any pool of the organization, held to the caller's list of companies (R-VEH-74). Null means every organization of the caller. |
public.resend_invitation |
invitation_id uuid |
sent_invitation |
owner | Moves a pending invitation's expiry to 24 hours from now and makes the caller its inviter (R-ACC-95), keeping its flag or rental companies (R-ACC-161, R-ACC-182). Returns it with its delivery judged now (R-ACC-287); apps/web then sends it again through Auth. |
public.restore_invitation |
invitation_id uuid |
sent_invitation |
owner | Restores a voided invitation, rechecked as a send (R-ACC-286): it is pending again for 24 hours with the caller as inviter, and comes back with its delivery judged now (R-ACC-287); apps/web sends a sign-in link or Auth's invite (R-ACC-220), and acceptance makes the membership (R-ACC-277). |
public.restore_master_data |
kind master_data_kind, row_id uuid |
void |
owner | Makes a retired brand, model, pricing group, charge type, lead source, legal entity, pool, bank account, contract template, garage, insurer, partner garage, rental company, checklist item or body panel active again (R-MD-27, R-TEN-24, R-MD-44, R-MD-58). |
public.retire_master_data |
kind master_data_kind, row_id uuid |
void |
owner | Retires a brand, model, pricing group, charge type, lead source, legal entity, pool, bank account, contract template, garage, insurer, partner garage, rental company, checklist item or body panel; it stays in its table (R-MD-26, R-TEN-23, R-MD-43, R-MD-57). |
public.revoke_delegation |
membership_id uuid, pool_id uuid, permission_code text |
void |
owner | Removes a member's delegated override of a permission at a pool, for a holder of it there through a role or of user:write there (R-ACC-239). Ends the member's sessions (R-ACC-240). |
public.revoke_invitation |
invitation_id uuid |
void |
owner | Voids a pending invitation with the reason revoked (R-ACC-207), checked as a resend (R-ACC-208, R-ACC-210, R-ACC-219). Sends nothing. |
public.revoke_role |
membership_id uuid, pool_id uuid, role_id uuid |
void |
owner | Removes one role a member holds at one pool (R-ACC-109). Ends the member's sessions (R-ACC-08). |
public.scope_companies |
pool_id uuid |
TABLE(rental_company_id uuid, name text) |
owner | The active rental companies the tab offers: the organization's, or the caller's own when they lack the flag, for user:read there (R-ACC-143). |
public.session_is_current |
boolean |
owner | True when the caller's login token was issued after their last access change (D37, R-ACC-48). | |
public.set_all_rental_companies |
membership_id uuid |
void |
owner | Gives an active member the flag, so every car of their pools, and removes their rental companies (R-ACC-173). Ends no sessions (R-ACC-140). |
public.set_charge_type_due_days |
charge_type_id uuid, days integer |
void |
owner | Sets a charge type's default due days (R-MD-16, R-MD-39). |
public.set_company_scope |
membership_id uuid, rental_company_ids uuid[] |
void |
owner | Replaces an active member's rental companies and takes their flag away; an empty set means no cars (R-ACC-135). Ends no sessions (R-ACC-140). |
public.set_my_full_name |
full_name text |
text |
owner | Sets the signed-in person's own name, trimmed (R-ACC-284); refuses a blank one or one over 100 characters (R-ACC-285). |
public.set_my_locale |
locale text |
locale |
owner | |
public.set_organization_settings |
organization_id uuid, checkpoint_interval_weeks integer, cp_warning_days integer, cp_critical_days integer, service_interval_km_ev bigint, service_interval_km_ice bigint, queue_open boolean, queue_opens_at time without time zone, queue_closes_at time without time zone, max_tickets_per_phone integer, max_queue_miss integer, overdue_limit_days integer, panel_fee bigint, repo_fine bigint, allow_cross_entity_payments boolean, allow_cross_pool_operations boolean, default_contract_months integer, visit_due_days integer, require_visit_before_booking boolean, notification_escalation_hours jsonb, notification_digest_at time without time zone, max_repossessions integer, cp_skip_weeks_limit integer, gps_stale_minutes integer |
void |
owner | Saves an organization's settings (R-SET-17 to R-SET-20). |
public.set_override |
membership_id uuid, pool_id uuid, permission_code text, effect override_effect, reason text DEFAULT NULL::text |
member_permission_overrides |
owner | Gives an active member a grant or a deny of one permission at one pool, or switches it, or replaces a delegation past its end (R-ACC-125, R-ACC-126, R-ACC-261). Ends the member's sessions (R-ACC-08). |
public.set_pool_settings |
pool_id uuid, queue_open boolean, queue_opens_at time without time zone, queue_closes_at time without time zone, max_tickets_per_phone integer, checkpoint_interval_weeks integer, max_queue_miss integer |
void |
owner | Saves a pool's own settings; an empty one clears it, so the organization's applies (R-SET-17, R-SET-21). |
public.set_vehicle_document_file |
document_id uuid, path text |
void |
owner | Sets a document's main path once, inside its own folder |
public.set_vehicle_photo_file |
photo_id uuid, path text |
void |
owner | Sets a photo's path once, to a file in the vehicles bucket in its own folder |
public.suspend_member |
membership_id uuid |
void |
owner | Suspends an active member; their sessions end (R-ACC-187, R-ACC-52). |
public.unlink_gps_device |
device_id uuid |
void |
owner | Takes a device off its car, not active, keeping it and its positions; never activates the other device (R-GPS-26). |
public.vehicle_batch |
rows jsonb, check_only boolean DEFAULT true |
jsonb |
owner | Checks rows of new cars and saves them, every row or none: { refusals: [{ row, field, key }] } for a check, { created: [uuid] } for a save, vehicle.batch_refused with the refusals for a refused save (R-VEH-77 to R-VEH-83, D109). |
public.vehicle_stnk |
vehicle_id uuid |
TABLE(expires_on date, state text) |
caller | The STNK that counts, its expiry and its state on the pool's today: valid, expired or not_on_file (R-VEH-51). |
Helpers in the app schema
Section titled “Helpers in the app schema”Not reachable through the API. Policies, triggers and RPCs call them.
| Function | Arguments | Returns | Runs as | Note |
|---|---|---|---|---|
app.accept_invitation_on_confirm |
trigger |
owner | Accepts or voids the pending invitation of a login whose email Auth has just confirmed (D98, R-ACC-96, R-ACC-97, R-ACC-155, R-ACC-162, R-ACC-183). Never raises. | |
app.after_allocation_change |
trigger |
owner | ||
app.after_payment_void |
trigger |
owner | ||
app.allocation_guard |
trigger |
owner | ||
app.audit_row |
trigger |
owner | Writes audit_log (P6). A job marks its source with set_config('app.source', 'cron', true); otherwise a change through the API reads app and a direct database change reads system, with the database user (R-AUD-05). Rows of one transaction share its id (R-AUD-13). | |
app.backup_starts_on_standby |
trigger |
caller | ||
app.change_pricing_group_rate |
trigger |
owner | ||
app.charge_balance |
charge uuid |
bigint |
owner | |
app.charge_pool |
id uuid |
uuid |
owner | |
app.check_account_number |
org uuid, bank text, account_number text, self uuid |
void |
owner | |
app.check_delegation_member |
membership uuid |
memberships |
owner | |
app.check_driver_secondary_phone |
trigger |
caller | ||
app.check_entity_active |
e legal_entities |
void |
caller | |
app.check_entity_code |
tbl text, org uuid, code text |
void |
owner | |
app.check_escalation_hours |
trigger |
owner | ||
app.check_invitation_in_scope |
inv invitations |
void |
owner | |
app.check_invitation_scope |
org uuid, pool uuid, ids uuid[] |
void |
owner | |
app.check_invitation_sender |
pool uuid, role uuid |
uuid |
owner | |
app.check_master_data |
org uuid, row_id uuid, perm text |
void |
owner | |
app.check_master_data_code |
tbl text, org uuid, code text, pattern text DEFAULT '^[a-z_]+$'::text |
void |
owner | |
app.check_master_data_min |
v bigint, field text |
void |
caller | |
app.check_master_data_name |
tbl text, org uuid, name text, self uuid, brand uuid DEFAULT NULL::uuid |
void |
owner | |
app.check_master_data_range |
v bigint, field text, lo bigint, hi bigint |
void |
caller | |
app.check_master_data_required |
missing boolean, field text |
void |
caller | |
app.check_master_data_write |
org uuid, perm text DEFAULT 'master_data:write'::text |
void |
owner | |
app.check_member_changer |
membership uuid, pool uuid |
memberships |
owner | |
app.check_member_held |
membership uuid |
void |
owner | |
app.check_member_in_scope |
membership uuid, org uuid |
void |
owner | |
app.check_member_manager |
membership uuid, perm text |
memberships |
owner | |
app.check_model_links |
brand uuid, pricing_group uuid, org uuid DEFAULT NULL::uuid |
uuid |
owner | |
app.check_model_retired |
brand uuid, pricing_group uuid, old_brand uuid, old_pricing_group uuid |
void |
owner | |
app.check_override_held |
pool uuid, permission text |
void |
owner | |
app.check_partner_sides |
insurer uuid, garage uuid, org uuid |
void |
owner | |
app.check_policy |
org uuid, policy uuid, cur_insurer uuid, insurer uuid, number text, starts date, ends date, premium bigint |
void |
caller | |
app.check_pool |
id uuid |
uuid |
owner | |
app.check_rental_company_write |
org uuid |
void |
owner | |
app.check_role_held |
pool uuid, role uuid |
void |
owner | |
app.check_setting_range |
v bigint, field text, lo bigint, hi bigint |
void |
caller | |
app.check_template_free |
org uuid, entity uuid, platform ride_platform, self uuid |
void |
owner | |
app.claim_photo_kind_only |
trigger |
caller | ||
app.claim_pool |
id uuid |
uuid |
owner | |
app.create_organization_settings |
trigger |
owner | ||
app.debt_letter_pool |
id uuid |
uuid |
owner | |
app.default_debt_letters_issued_on |
trigger |
caller | ||
app.default_drivers_registered_on |
trigger |
caller | ||
app.default_maintenance_records_started_on |
trigger |
caller | ||
app.default_pool_from_vehicle |
trigger |
owner | ||
app.deny |
key error_key, detail jsonb DEFAULT '{}'::jsonb |
void |
caller | Refuses an action the caller has no permission for (D10, D30): SQLSTATE 42501. |
app.driver_pool |
id uuid |
uuid |
owner | |
app.easygo_normalize |
body jsonb |
jsonb |
caller | |
app.end_sessions_of |
person uuid |
void |
owner | |
app.end_sessions_on_access_change |
trigger |
owner | ||
app.end_sessions_on_membership_change |
trigger |
owner | ||
app.end_sessions_on_role_permission_change |
trigger |
owner | ||
app.entity_for |
org uuid, entity uuid |
legal_entities |
owner | |
app.expected_table_grants |
TABLE(table_name text, grantee text, privilege text) |
caller | What authenticated and service_role hold on each public table and view at table level, as granted beside its policies. Written by tools/db/gen_rls.py; a pgTAP test compares it with the catalog (R-ACC-72). | |
app.fleet_driver_name |
vehicle_id uuid |
text |
owner | |
app.gate_approval_stamp |
trigger |
caller | ||
app.gate_pass_pool |
id uuid |
uuid |
owner | |
app.gate_pass_stamp |
trigger |
caller | ||
app.gps_collect |
integer |
owner | Settles the pending pulls whose answer has arrived, through the provider's adapter and the ingest (R-GPS-10, R-GPS-11). | |
app.gps_device_for_write |
device_id uuid |
gps_devices |
owner | |
app.gps_device_partner |
id uuid |
uuid |
owner | |
app.gps_device_pool |
id uuid |
uuid |
owner | |
app.gps_ingest |
provider text, organization_id uuid, batch jsonb |
jsonb |
owner | The one writer of positions, for every provider (D113, R-GPS-01 to R-GPS-09). Matches devices only within the pull's organization (R-GPS-06, R-GPS-41). Run only by the pull job, as postgres. |
app.gps_is_stale |
org uuid, recorded_at timestamp with time zone |
boolean |
owner | |
app.gps_normalize |
provider text, body jsonb |
jsonb |
caller | |
app.gps_pull |
provider text |
bigint |
owner | Sends one pull to a configured provider with its key from Vault and records it pending; an unconfigured provider writes nothing (R-GPS-10, R-GPS-12). |
app.gps_purge |
void |
owner | Deletes positions recorded and pulls started more than 90 days ago (R-GPS-13). | |
app.gps_schedule |
trigger |
owner | ||
app.grant_invitation |
inv invitations, login uuid, granted_by uuid |
uuid |
owner | |
app.grant_new_pool_to_super_admins |
trigger |
owner | ||
app.guard_charge_inspection |
trigger |
caller | ||
app.guard_charge_status |
trigger |
caller | ||
app.guard_delegable |
trigger |
owner | ||
app.guard_grant_held |
trigger |
caller | ||
app.guard_last_user_manager |
trigger |
caller | ||
app.guard_payment_migrated |
trigger |
caller | ||
app.guard_payout_company |
trigger |
owner | ||
app.guard_status_column |
trigger |
caller | ||
app.handle_new_user |
trigger |
owner | ||
app.has_inline_file |
t text |
boolean |
caller | |
app.inspection_may_write |
inspection uuid |
boolean |
owner | |
app.inspection_partner |
id uuid |
uuid |
owner | |
app.inspection_pool |
id uuid |
uuid |
owner | |
app.inspection_return_reason |
trigger |
owner | ||
app.insurance_state |
ends_on date, today date |
text |
caller | none, active, expiring (0 to 30 days left) or expired, from a policy's end date and the pool's today (R-ASR-25). |
app.invitation_delivery |
addr text |
text |
owner | |
app.invitation_missing |
person uuid, pool uuid, role uuid |
text[] |
owner | |
app.invitation_outside_scope |
person uuid, inv uuid |
uuid[] |
owner | |
app.invitation_pool |
id uuid |
uuid |
owner | |
app.is_refusal |
state text, message text, detail text |
boolean |
caller | |
app.keep_old_plate |
trigger |
owner | ||
app.legacy_columns |
tbl text |
SETOF text |
caller | The columns of a public table that hold v1-only data (D84): named legacy_..., except drivers.legacy_id. No API role inserts or updates them (R-RNT-71). |
app.lock_invitation |
inv uuid |
invitations |
owner | |
app.lock_user_managers |
org uuid |
void |
caller | |
app.mark_temporary_plate |
trigger |
owner | ||
app.master_data_opt |
v text |
text |
caller | |
app.master_data_phone |
v text, field text |
text |
caller | |
app.master_data_text |
v text, field text |
text |
caller | |
app.may_set_scope |
org uuid |
boolean |
owner | |
app.may_use_object |
name text, write boolean |
boolean |
owner | |
app.member_codes |
membership uuid |
TABLE(pool_id uuid, permission_code text) |
owner | |
app.member_not_held |
membership uuid |
jsonb |
owner | |
app.member_outside |
membership uuid, partners uuid[] |
uuid[] |
owner | |
app.my_codes_at |
pool uuid |
text[] |
owner | |
app.my_membership_ids |
uuid[] |
owner | ||
app.my_org_ids |
uuid[] |
owner | ||
app.my_partner_ids |
uuid[] |
owner | ||
app.my_partners_in |
org uuid |
uuid[] |
owner | |
app.my_permission_codes |
text[] |
owner | ||
app.my_permissions |
TABLE(organization_id uuid, pool_id uuid, pool_code text, permission_code text, pool_is_active boolean) |
owner | ||
app.my_role_codes_at |
pool uuid |
text[] |
owner | |
app.next_document_number |
org uuid, entity uuid, doc doc_kind, period text |
integer |
owner | |
app.notification_seen |
type_code text, pool uuid, recipient uuid |
boolean |
owner | |
app.notify |
type_code text, subject_table text, subject_id uuid, pool_id uuid, recipient_membership_id uuid DEFAULT NULL::uuid |
uuid |
owner | Raises a notification in the caller's transaction, or returns the open one of that type and subject (R-NTF-09, R-NTF-10). |
app.opname_counts |
session_id uuid |
TABLE(expected integer, matched integer, missing integer, extra_known integer, extra_unknown integer, typed integer) |
caller | |
app.opname_recheck_finished |
trigger |
owner | ||
app.opname_scan_check |
trigger |
owner | ||
app.opname_session_pool |
id uuid |
uuid |
owner | |
app.org_pools_missing |
org uuid, perm text |
uuid[] |
owner | |
app.org_user_managers |
org uuid |
integer |
owner | |
app.orgs_with |
perm text |
uuid[] |
owner | |
app.orgs_with_any |
perms text[] |
uuid[] |
owner | |
app.orgs_with_every_pool |
perms text[] |
uuid[] |
owner | |
app.partner_limited_orgs |
uuid[] |
owner | ||
app.partner_side |
tbl text, org uuid, row_id uuid |
boolean |
owner | |
app.payment_pool |
id uuid |
uuid |
owner | |
app.person_codes |
person uuid |
TABLE(pool_id uuid, permission_code text) |
owner | |
app.person_name |
profile uuid |
text |
owner | |
app.person_partners_in |
person uuid, org uuid |
uuid[] |
owner | |
app.person_pools_with_any |
person uuid, perms text[] |
uuid[] |
owner | |
app.pool_org |
pool uuid |
uuid |
owner | |
app.pool_today |
pool uuid |
date |
owner | |
app.pools_with |
perm text |
uuid[] |
owner | |
app.pools_with_any |
perms text[] |
uuid[] |
owner | |
app.profile_orgs |
profile uuid |
uuid[] |
owner | |
app.queue_hours_invalid |
pool uuid, pool_code text, opens time without time zone, closes time without time zone |
void |
caller | |
app.queue_ticket_pool |
id uuid |
uuid |
owner | |
app.refresh_charge_status |
charge uuid |
void |
owner | |
app.refresh_temporary_plate |
trigger |
owner | ||
app.refuse |
key error_key, detail jsonb DEFAULT '{}'::jsonb |
void |
caller | Refuses an action that breaks a rule (D10, D30): SQLSTATE P0001. |
app.refuse_invitation_rental_companies_with_flag |
trigger |
owner | ||
app.refuse_rental_companies_with_flag |
trigger |
owner | ||
app.rental_chain_first |
id uuid |
uuid |
owner | |
app.rental_partner |
id uuid |
uuid |
owner | |
app.rental_pool |
id uuid |
uuid |
owner | |
app.rentals_end_reason |
trigger |
owner | ||
app.rentals_pool_guard |
trigger |
owner | ||
app.repo_request_partner |
id uuid |
uuid |
owner | |
app.repo_requests_one_live |
trigger |
owner | Refuses a second live repo request on a rental with repo_request.already_open (R-REP-05). | |
app.repo_work_order_has_my_partner |
id uuid |
boolean |
owner | |
app.repo_work_order_pool |
id uuid |
uuid |
owner | |
app.repo_work_order_units_guard |
trigger |
owner | Refuses a unit on another pool, a second pending unit for a request, a closing time before the assignment and a closer who is not a PIC (R-REP-19, R-REP-21, R-REP-23, R-REP-25). | |
app.resolve_notification |
type_code text, subject_table text, subject_id uuid |
void |
owner | Resolves the open notification of a type and subject, if there is one (R-NTF-15). |
app.role_is_system |
role uuid |
boolean |
owner | |
app.role_live_from_valid |
v jsonb |
boolean |
caller | |
app.role_org |
role uuid |
uuid |
owner | |
app.role_permission_codes |
role uuid |
text[] |
owner | |
app.row_orgs |
tbl text, row_id uuid |
uuid[] |
owner | |
app.row_readable |
tbl text, row_id uuid |
boolean |
owner | |
app.row_writable |
tbl text, row_id uuid |
boolean |
owner | |
app.scope_pools_missing |
org uuid |
uuid[] |
owner | |
app.seed_new_organization |
trigger |
owner | ||
app.seed_organization |
org uuid |
void |
owner | |
app.set_driver_stage |
driver uuid, to_stage driver_stage |
void |
owner | |
app.set_master_data_active |
kind master_data_kind, row_id uuid, active boolean |
void |
owner | |
app.set_updated_at |
trigger |
caller | Keeps updated_at current on every mutable table (P14). | |
app.set_vehicle_status |
vehicle uuid, to_status vehicle_status, note text DEFAULT NULL::text, rental uuid DEFAULT NULL::uuid |
void |
owner | |
app.setting |
pool uuid, key text |
text |
owner | |
app.settle_invitation |
inv invitations, login uuid |
uuid |
owner | |
app.track_invite_password |
trigger |
owner | Records the random password Auth gives an invited login before confirming its email, and forgets it once the password changes again (R-ACC-245). | |
app.vehicle_check |
p_pool uuid, p_model uuid, p_unit_code text, p_plate text, p_year integer, p_vin text, p_odometer integer, p_company uuid |
uuid |
owner | The check create_vehicle and vehicle_batch share (R-VEH-47, D109): refuses with the vehicle keys, returns the car's organization. |
app.vehicle_input |
home_pool_id uuid, model_id uuid, unit_code text, plate_number text, year integer, color text, vin text, odometer_km integer, rental_company_id uuid |
TABLE(n_pool uuid, n_model uuid, n_unit_code text, n_plate text, n_year integer, n_color text, n_vin text, n_odometer integer, n_company uuid) |
caller | |
app.vehicle_partner |
id uuid |
uuid |
owner | |
app.vehicle_pool |
id uuid |
uuid |
owner | |
app.vehicle_readable |
id uuid |
boolean |
owner | |
app.work_order_pool |
id uuid |
uuid |
owner |