Files
visa/migrations/0004_company_office.sql
grabowski 2a6e972b68
CI / secret scan (push) Successful in 4s
CI / fmt, clippy, tests (push) Successful in 22s
A company's office: its GPS position and a photo
The company form has a field for the office's GPS position (migration
0004, column companies.office_gps). It takes what people have at hand:
the numbers Google Maps copies, a link to the place on Google Maps or
OpenStreetMap, a geo: URI, or degrees, minutes and seconds. It keeps
decimal degrees with six decimals and refuses a position outside Thailand,
which catches a swapped pair; a short maps.app.goo.gl link is refused with
a hint, as it holds no position (src/gps.rs, with unit tests).

The company's page has an Office card: the position with links that open
it on OpenStreetMap and Google Maps, the newest photo of the office, and a
strip that uploads a photo (kind "Photo of the office") and returns to the
card. The photos are documents like any other: encrypted on the server and
audited. A refused photo shows its errors on the card only; office photos
that are PDFs are counted under Company documents.

The demo company has a position. Tests: the position read from a link,
from degrees, minutes and seconds, the three refusals, the audit entry and
its removal; a photo uploaded from the card, shown, and its errors placed.
2026-11-18 11:56:26 +07:00

10 lines
431 B
SQL

-- The GPS position of a company's office, as decimal degrees with six
-- decimals ("18.796500, 99.008200"); empty when not recorded. Photos of the
-- office are documents of the kind office-photo (0003).
ALTER TABLE companies ADD COLUMN office_gps TEXT NOT NULL DEFAULT ''
CONSTRAINT companies_office_gps_check CHECK (
office_gps = ''
OR office_gps ~ '^-?[0-9]{1,2}\.[0-9]{6}, -?[0-9]{1,3}\.[0-9]{6}$'
);