2023-01-17 21:30:01 +00:00
|
|
|
|
begin;
|
|
|
|
|
|
|
|
|
|
set search_path to auth, numerus, public;
|
|
|
|
|
|
Add the company relation and read-only form to edit
I do not have more time to update the update to the company today, but i
believe this is already a good amount of work for a commit.
The company is going to be used for row level security, as users will
only have access to the data from companies they are granted access, by
virtue of being in the company_user relation.
I did not know how add a row level security policy to the company_user
because i needed the to select on the same relation and this is not
allowed, because it would create an infinite loop.
Had to add the vat, pg_libphonenumber, and uri extensions in order to
validate VAT identification numbers, phone numbers, and URIs,
repectively. These libraries are not in Debian, but i created packages
for them all in https://dev.tandem.ws/tandem.
2023-01-24 20:46:07 +00:00
|
|
|
|
insert into auth."user" (user_id, email, name, password, role)
|
|
|
|
|
values (1, 'demo@numerus', 'Demo User', 'demo', 'invoicer')
|
|
|
|
|
, (2, 'admin@numerus', 'Demo Admin', 'admin', 'admin')
|
|
|
|
|
;
|
|
|
|
|
|
2023-01-27 20:30:14 +00:00
|
|
|
|
insert into company (company_id, business_name, vatin, trade_name, phone, email, web, address, city, province, postal_code, country_code, currency_code)
|
2023-02-01 13:32:46 +00:00
|
|
|
|
values (1, 'Juli Verd', 'ES40404040D', 'Pesebre', parse_packed_phone_number('972 50 60 70', 'ES'), 'info@numerus.cat', 'https://numerus.cat/', 'C/ de l’Hort', 'Castelló d’Empúries', 'Girona', '17486', 'ES', 'EUR');
|
Add the company relation and read-only form to edit
I do not have more time to update the update to the company today, but i
believe this is already a good amount of work for a commit.
The company is going to be used for row level security, as users will
only have access to the data from companies they are granted access, by
virtue of being in the company_user relation.
I did not know how add a row level security policy to the company_user
because i needed the to select on the same relation and this is not
allowed, because it would create an infinite loop.
Had to add the vat, pg_libphonenumber, and uri extensions in order to
validate VAT identification numbers, phone numbers, and URIs,
repectively. These libraries are not in Debian, but i created packages
for them all in https://dev.tandem.ws/tandem.
2023-01-24 20:46:07 +00:00
|
|
|
|
|
|
|
|
|
insert into company_user (company_id, user_id)
|
|
|
|
|
values (1, 1)
|
|
|
|
|
, (1, 2)
|
2023-01-17 21:30:01 +00:00
|
|
|
|
;
|
|
|
|
|
|
2023-01-28 13:18:58 +00:00
|
|
|
|
insert into tax (company_id, name, rate)
|
|
|
|
|
values (1, 'Retenció 15 %', -0.15)
|
|
|
|
|
, (1, 'IVA 21 %', 0.21)
|
|
|
|
|
;
|
|
|
|
|
|
2023-01-17 21:30:01 +00:00
|
|
|
|
commit;
|