office-related spec-clarifications and -amendmends (contact.emailaddresses+.phonenumbers JSON) (#50)
Co-authored-by: Michael Hoennig <michael@hoennig.de> Reviewed-on: https://dev.hostsharing.net/hostsharing/hs.hsadmin.ng/pulls/50 Reviewed-by: Marc Sandlus <marc.sandlus@hostsharing.net>
This commit is contained in:
@ -14,9 +14,9 @@ components:
|
||||
postalAddress:
|
||||
type: string
|
||||
emailAddresses:
|
||||
type: string
|
||||
$ref: '#/components/schemas/HsOfficeContactEmailAddresses'
|
||||
phoneNumbers:
|
||||
type: string
|
||||
$ref: '#/components/schemas/HsOfficeContactPhoneNumbers'
|
||||
|
||||
HsOfficeContactInsert:
|
||||
type: object
|
||||
@ -26,9 +26,9 @@ components:
|
||||
postalAddress:
|
||||
type: string
|
||||
emailAddresses:
|
||||
type: string
|
||||
$ref: '#/components/schemas/HsOfficeContactEmailAddresses'
|
||||
phoneNumbers:
|
||||
type: string
|
||||
$ref: '#/components/schemas/HsOfficeContactPhoneNumbers'
|
||||
required:
|
||||
- label
|
||||
|
||||
@ -42,8 +42,31 @@ components:
|
||||
type: string
|
||||
nullable: true
|
||||
emailAddresses:
|
||||
type: string
|
||||
nullable: true
|
||||
$ref: '#/components/schemas/HsOfficeContactEmailAddresses'
|
||||
phoneNumbers:
|
||||
type: string
|
||||
nullable: true
|
||||
$ref: '#/components/schemas/HsOfficeContactPhoneNumbers'
|
||||
|
||||
HsOfficeContactEmailAddresses:
|
||||
# forces generating a java.lang.Object containing a Map, instead of class HsOfficeContactEmailAddresses
|
||||
anyOf:
|
||||
- type: object
|
||||
additionalProperties: true
|
||||
|
||||
HsOfficeContactPhoneNumbers:
|
||||
# forces generating a java.lang.Object containing a Map, instead of class HsOfficeContactEmailAddresses
|
||||
anyOf:
|
||||
- type: object
|
||||
properties:
|
||||
phone_office:
|
||||
type: string
|
||||
nullable: true
|
||||
phone_private:
|
||||
type: string
|
||||
nullable: true
|
||||
phone_mobile:
|
||||
type: string
|
||||
nullable: true
|
||||
fax:
|
||||
type: string
|
||||
nullable: true
|
||||
additionalProperties: false
|
||||
|
@ -63,7 +63,7 @@ begin
|
||||
insert
|
||||
into RbacGrants (grantedByRoleUuid, ascendantUuid, descendantUuid, assumed)
|
||||
values (grantedByRoleUuid, userUuid, grantedRoleUuid, doAssume);
|
||||
-- TODO.spec: What should happen on mupltiple grants? What if options (doAssume) are not the same?
|
||||
-- TODO.impl: What should happen on mupltiple grants? What if options (doAssume) are not the same?
|
||||
-- Most powerful or latest grant wins? What about managed?
|
||||
-- on conflict do nothing; -- allow granting multiple times
|
||||
end; $$;
|
||||
|
@ -52,7 +52,7 @@ begin
|
||||
if cardinality(userUuids) > 0 then
|
||||
-- direct grants to users need a grantedByRole which can revoke the grant
|
||||
if grantedByRole is null then
|
||||
userGrantsByRoleUuid := roleUuid; -- TODO.spec: or do we want to require an explicit userGrantsByRoleUuid?
|
||||
userGrantsByRoleUuid := roleUuid; -- TODO.impl: or do we want to require an explicit userGrantsByRoleUuid?
|
||||
else
|
||||
userGrantsByRoleUuid := getRoleId(grantedByRole);
|
||||
end if;
|
||||
|
@ -10,8 +10,8 @@ create table if not exists hs_office_contact
|
||||
version int not null default 0,
|
||||
label varchar(128) not null,
|
||||
postalAddress text,
|
||||
emailAddresses text, -- TODO.feat: change to json
|
||||
phoneNumbers text -- TODO.feat: change to json
|
||||
emailAddresses jsonb not null,
|
||||
phoneNumbers jsonb not null
|
||||
);
|
||||
--//
|
||||
|
||||
|
@ -11,8 +11,9 @@
|
||||
create or replace procedure createHsOfficeContactTestData(contLabel varchar)
|
||||
language plpgsql as $$
|
||||
declare
|
||||
currentTask varchar;
|
||||
emailAddr varchar;
|
||||
currentTask varchar;
|
||||
postalAddr varchar;
|
||||
emailAddr varchar;
|
||||
begin
|
||||
currentTask = 'creating contact test-data ' || contLabel;
|
||||
execute format('set local hsadminng.currentTask to %L', currentTask);
|
||||
@ -22,14 +23,17 @@ begin
|
||||
perform createRbacUser(emailAddr);
|
||||
call defineContext(currentTask, null, emailAddr);
|
||||
|
||||
postalAddr := E'Vorname Nachname\nStraße Hnr\nPLZ Stadt';
|
||||
|
||||
raise notice 'creating test contact: %', contLabel;
|
||||
insert
|
||||
into hs_office_contact (label, postaladdress, emailaddresses, phonenumbers)
|
||||
values (contLabel, $address$
|
||||
Vorname Nachname
|
||||
Straße Hnr
|
||||
PLZ Stadt
|
||||
$address$, emailAddr, '+49 123 1234567');
|
||||
values (
|
||||
contLabel,
|
||||
postalAddr,
|
||||
('{ "main": "' || emailAddr || '" }')::jsonb,
|
||||
('{ "phone_office": "+49 123 1234567" }')::jsonb
|
||||
);
|
||||
end; $$;
|
||||
--//
|
||||
|
||||
|
@ -11,7 +11,7 @@ create table hs_office_debitor
|
||||
debitorNumberSuffix char(2) not null check (debitorNumberSuffix::text ~ '^[0-9][0-9]$'),
|
||||
debitorRelUuid uuid not null references hs_office_relation(uuid),
|
||||
billable boolean not null default true,
|
||||
vatId varchar(24), -- TODO.spec: here or in person?
|
||||
vatId varchar(24),
|
||||
vatCountryCode varchar(2),
|
||||
vatBusiness boolean not null,
|
||||
vatReverseCharge boolean not null,
|
||||
|
Reference in New Issue
Block a user