Create route for Opinions

create OpinionRepository
create OpinionVoter
create OpinionChoiceRef
create extention String.toUUID() and List<String>.toUUID()
create OpinionAggregation
create interface RequestBuilderWithCreator for create entity by request
rename opinion_list to opinion_choice
create sql function find_citizen_opinions
fix sql function find_citizen_opinions_by_target_id
fix sql funciton find_opinion_choices
This commit is contained in:
2020-02-12 14:46:36 +01:00
parent ec6e39b130
commit 4a2d18ff87
24 changed files with 411 additions and 45 deletions

View File

@@ -4,7 +4,7 @@ drop table if exists resource_view;
-- Extra resources
drop table if exists opinion_on_article;
drop table if exists opinion;
drop table if exists opinion_list;
drop table if exists opinion_choice;
drop table if exists follow_article;
drop table if exists follow_constitution;

View File

@@ -503,7 +503,7 @@ create table resource_view
ip cidr null
);
create table opinion_list
create table opinion_choice
(
id uuid default uuid_generate_v4() not null primary key,
name text not null unique,
@@ -514,20 +514,20 @@ create table opinion_list
create table opinion
(
opinion uuid not null references opinion_list (id),
choice_id uuid not null references opinion_choice (id),
foreign key (created_by_id) references citizen (id),
primary key (id),
unique (created_by_id, target_id, opinion)
unique (created_by_id, target_id, choice_id)
) inherits (extra);
create table opinion_on_article
(
target_reference regclass default 'article'::regclass not null,
foreign key (opinion) references opinion_list (id),
foreign key (choice_id) references opinion_choice (id),
foreign key (target_id) references article (id),
foreign key (created_by_id) references citizen (id),
primary key (id),
unique (created_by_id, target_id, opinion)
unique (created_by_id, target_id, choice_id)
) inherits (opinion);