add-subscriber-role (#14)
Co-authored-by: Michael Hoennig <michael@hoennig.de> Reviewed-on: https://dev.hostsharing.net/hostsharing/hs.hsadmin.ng/pulls/14 Reviewed-by: Timotheus Pokorra <timotheus.pokorra@hostsharing.net>
This commit is contained in:
@ -12,6 +12,7 @@ components:
|
||||
- VIP_CONTACT
|
||||
- ACCOUNTING,
|
||||
- OPERATIONS
|
||||
- SUBSCRIBER
|
||||
|
||||
HsOfficeRelationship:
|
||||
type: object
|
||||
@ -25,6 +26,9 @@ components:
|
||||
$ref: './hs-office-person-schemas.yaml#/components/schemas/HsOfficePerson'
|
||||
relType:
|
||||
type: string
|
||||
relMark:
|
||||
type: string
|
||||
nullable: true
|
||||
contact:
|
||||
$ref: './hs-office-contact-schemas.yaml#/components/schemas/HsOfficeContact'
|
||||
|
||||
@ -48,6 +52,8 @@ components:
|
||||
relType:
|
||||
type: string
|
||||
nullable: true
|
||||
relMark:
|
||||
type: string
|
||||
contactUuid:
|
||||
type: string
|
||||
format: uuid
|
||||
|
@ -10,7 +10,8 @@ CREATE TYPE HsOfficeRelationshipType AS ENUM (
|
||||
'REPRESENTATIVE',
|
||||
'VIP_CONTACT',
|
||||
'ACCOUNTING',
|
||||
'OPERATIONS');
|
||||
'OPERATIONS',
|
||||
'SUBSCRIBER');
|
||||
|
||||
CREATE CAST (character varying as HsOfficeRelationshipType) WITH INOUT AS IMPLICIT;
|
||||
|
||||
@ -20,7 +21,8 @@ create table if not exists hs_office_relationship
|
||||
relAnchorUuid uuid not null references hs_office_person(uuid),
|
||||
relHolderUuid uuid not null references hs_office_person(uuid),
|
||||
contactUuid uuid references hs_office_contact(uuid),
|
||||
relType HsOfficeRelationshipType not null
|
||||
relType HsOfficeRelationshipType not null,
|
||||
relMark varchar(24)
|
||||
);
|
||||
--//
|
||||
|
||||
|
@ -12,7 +12,8 @@ create or replace procedure createHsOfficeRelationshipTestData(
|
||||
anchorPersonTradeName varchar,
|
||||
holderPersonFamilyName varchar,
|
||||
relationshipType HsOfficeRelationshipType,
|
||||
contactLabel varchar)
|
||||
contactLabel varchar,
|
||||
mark varchar default null)
|
||||
language plpgsql as $$
|
||||
declare
|
||||
currentTask varchar;
|
||||
@ -36,8 +37,8 @@ begin
|
||||
raise notice '- using holder person (%): %', holderPerson.uuid, holderPerson;
|
||||
raise notice '- using contact (%): %', contact.uuid, contact;
|
||||
insert
|
||||
into hs_office_relationship (uuid, relanchoruuid, relholderuuid, reltype, contactUuid)
|
||||
values (uuid_generate_v4(), anchorPerson.uuid, holderPerson.uuid, relationshipType, contact.uuid);
|
||||
into hs_office_relationship (uuid, relanchoruuid, relholderuuid, reltype, relmark, contactUuid)
|
||||
values (uuid_generate_v4(), anchorPerson.uuid, holderPerson.uuid, relationshipType, mark, contact.uuid);
|
||||
end; $$;
|
||||
--//
|
||||
|
||||
@ -76,6 +77,8 @@ do language plpgsql $$
|
||||
call createHsOfficeRelationshipTestData('Second e.K.', 'Smith', 'REPRESENTATIVE', 'second contact');
|
||||
|
||||
call createHsOfficeRelationshipTestData('Third OHG', 'Smith', 'REPRESENTATIVE', 'third contact');
|
||||
|
||||
call createHsOfficeRelationshipTestData('Third OHG', 'Smith', 'SUBSCRIBER', 'third contact', 'members-announce');
|
||||
end;
|
||||
$$;
|
||||
--//
|
||||
|
Reference in New Issue
Block a user