rename annonymous to anonymous

This commit is contained in:
2019-08-30 13:25:54 +02:00
parent 1b8a02c2b3
commit 16b71fb1e6
22 changed files with 48 additions and 48 deletions

View File

@@ -6,7 +6,7 @@ import java.util.*
class Article( class Article(
id: UUID = UUID.randomUUID(), id: UUID = UUID.randomUUID(),
var title: String?, var title: String?,
var annonymous: Boolean? = true, var anonymous: Boolean? = true,
var content: String?, var content: String?,
var description: String?, var description: String?,
var tags: List<String> = emptyList(), var tags: List<String> = emptyList(),

View File

@@ -12,8 +12,8 @@ class Citizen(
var name: Name?, var name: Name?,
var birthday: DateTime?, var birthday: DateTime?,
var userId: UUID? = null, var userId: UUID? = null,
var voteAnnonymous: Boolean? = null, var voteanonymous: Boolean? = null,
var followAnnonymous: Boolean? = null, var followanonymous: Boolean? = null,
var user: User? var user: User?
) : UuidEntity(id), ) : UuidEntity(id),
EntityCreatedAt by EntityCreatedAtImp() { EntityCreatedAt by EntityCreatedAtImp() {

View File

@@ -6,7 +6,7 @@ import java.util.*
class Constitution( class Constitution(
id: UUID = UUID.randomUUID(), id: UUID = UUID.randomUUID(),
var title: String?, var title: String?,
var annonymous: Boolean? = true, var anonymous: Boolean? = true,
var titles: List<Title> = listOf(), var titles: List<Title> = listOf(),
createdBy: Citizen? createdBy: Citizen?
): UuidEntity(id), ): UuidEntity(id),

View File

@@ -10,7 +10,7 @@ open class Vote <T: UuidEntity> (
createdBy: Citizen, createdBy: Citizen,
override var target: T, override var target: T,
var note: Int, var note: Int,
var annonymous: Boolean = true var anonymous: Boolean = true
): Extra<T>(id, createdBy), ): Extra<T>(id, createdBy),
EntityUpdatedAt by EntityUpdatedAtImp() { EntityUpdatedAt by EntityUpdatedAtImp() {
init { init {

View File

@@ -14,7 +14,7 @@ open class Vote <T: UuidEntity>(override var requester: Requester): RepositoryI<
fun vote(vote: VoteEntity<T>) { fun vote(vote: VoteEntity<T>) {
val reference = vote.target::class.simpleName!!.toLowerCase() val reference = vote.target::class.simpleName!!.toLowerCase()
val author = vote.createdBy ?: error("vote must be contain an author") val author = vote.createdBy ?: error("vote must be contain an author")
val anonymous = author.voteAnnonymous val anonymous = author.voteanonymous
requester requester
.getFunction("vote") .getFunction("vote")
.sendQuery( .sendQuery(

View File

@@ -2,7 +2,7 @@ do
$$ $$
begin begin
delete from citizen; delete from citizen;
insert into citizen (id, name, birthday, user_id, vote_annonymous, follow_annonymous) insert into citizen (id, name, birthday, user_id, vote_anonymous, follow_anonymous)
select select
uuid_in(md5('citizen'||row_number() over ()::text)::cstring), uuid_in(md5('citizen'||row_number() over ()::text)::cstring),
jsonb_build_object( jsonb_build_object(

View File

@@ -6,7 +6,7 @@ begin
delete from citizen_in_workgroup; delete from citizen_in_workgroup;
delete from workgroup; delete from workgroup;
insert into workgroup (id, created_by_id, name, description, annonymous, owner_id) insert into workgroup (id, created_by_id, name, description, anonymous, owner_id)
select select
uuid_in(md5('workgroup'||rn::text)::cstring), uuid_in(md5('workgroup'||rn::text)::cstring),
z.id, z.id,

View File

@@ -12,7 +12,7 @@ begin
delete from article_relations; delete from article_relations;
delete from article; delete from article;
insert into article (id, version_id, created_by_id, title, annonymous, content, description, tags) insert into article (id, version_id, created_by_id, title, anonymous, content, description, tags)
select select
uuid_in(md5('article'||row_number() over ())::cstring), uuid_in(md5('article'||row_number() over ())::cstring),
uuid_in(md5('article_v'||row_number() over ())::cstring), uuid_in(md5('article_v'||row_number() over ())::cstring),

View File

@@ -7,7 +7,7 @@ begin
delete from title; delete from title;
delete from constitution; delete from constitution;
insert into constitution (id, version_id, created_by_id, title, annonymous) insert into constitution (id, version_id, created_by_id, title, anonymous)
select select
uuid_in(md5('constitution'||row_number() over ())::cstring), uuid_in(md5('constitution'||row_number() over ())::cstring),
uuid_in(md5('constitution_v'||row_number() over ())::cstring), uuid_in(md5('constitution_v'||row_number() over ())::cstring),

View File

@@ -14,14 +14,14 @@ begin
-- and draft = false -- and draft = false
; ;
insert into article (id, version_id, created_by_id, title, annonymous, content, description, tags) insert into article (id, version_id, created_by_id, title, anonymous, content, description, tags)
select select
case when _id_exist then uuid_generate_v4() case when _id_exist then uuid_generate_v4()
else coalesce(id, uuid_generate_v4()) end, else coalesce(id, uuid_generate_v4()) end,
coalesce(version_id, uuid_generate_v4()), coalesce(version_id, uuid_generate_v4()),
(resource#>>'{created_by, id}')::uuid, (resource#>>'{created_by, id}')::uuid,
title, title,
annonymous, anonymous,
content, content,
description, description,
tags tags

View File

@@ -7,21 +7,21 @@ declare
begin begin
select insert_user(resource->'user') into inserted_user; select insert_user(resource->'user') into inserted_user;
insert into citizen (id, name, birthday, user_id, vote_annonymous, follow_annonymous) insert into citizen (id, name, birthday, user_id, vote_anonymous, follow_anonymous)
select select
coalesce(id, uuid_generate_v4()), coalesce(id, uuid_generate_v4()),
name, name,
birthday, birthday,
(inserted_user->>'id')::uuid, (inserted_user->>'id')::uuid,
coalesce(vote_annonymous, true), coalesce(vote_anonymous, true),
coalesce(follow_annonymous, true) coalesce(follow_anonymous, true)
from json_populate_record(null::citizen, resource) from json_populate_record(null::citizen, resource)
on conflict (id) do update set on conflict (id) do update set
name = excluded.name, name = excluded.name,
birthday = excluded.birthday, birthday = excluded.birthday,
user_id = excluded.user_id, user_id = excluded.user_id,
vote_annonymous = excluded.vote_annonymous, vote_anonymous = excluded.vote_anonymous,
follow_annonymous = excluded.follow_annonymous follow_anonymous = excluded.follow_anonymous
returning id into new_id; returning id into new_id;
select find_citizen_by_id_with_user(new_id) into resource; select find_citizen_by_id_with_user(new_id) into resource;

View File

@@ -4,21 +4,21 @@ $$
declare declare
new_id uuid; new_id uuid;
begin begin
insert into citizen (id, name, birthday, user_id, vote_annonymous, follow_annonymous) insert into citizen (id, name, birthday, user_id, vote_anonymous, follow_anonymous)
select select
coalesce(id, uuid_generate_v4()), coalesce(id, uuid_generate_v4()),
name, name,
birthday, birthday,
(resource#>>'{user, id}')::uuid, (resource#>>'{user, id}')::uuid,
coalesce(vote_annonymous, true), coalesce(vote_anonymous, true),
coalesce(follow_annonymous, true) coalesce(follow_anonymous, true)
from json_populate_record(null::citizen, resource) from json_populate_record(null::citizen, resource)
on conflict (id) do update set on conflict (id) do update set
name = excluded.name, name = excluded.name,
birthday = excluded.birthday, birthday = excluded.birthday,
user_id = excluded.user_id, user_id = excluded.user_id,
vote_annonymous = excluded.vote_annonymous, vote_anonymous = excluded.vote_anonymous,
follow_annonymous = excluded.follow_annonymous follow_anonymous = excluded.follow_anonymous
returning id into new_id; returning id into new_id;
select find_citizen_by_id(new_id) into resource; select find_citizen_by_id(new_id) into resource;

View File

@@ -19,14 +19,14 @@ begin
raise notice '%', _id_exist; raise notice '%', _id_exist;
insert into constitution (id, version_id, created_by_id, title, annonymous) insert into constitution (id, version_id, created_by_id, title, anonymous)
select select
case when _id_exist then uuid_generate_v4() case when _id_exist then uuid_generate_v4()
else coalesce(id, uuid_generate_v4()) end, else coalesce(id, uuid_generate_v4()) end,
version_id, version_id,
_citizen_id, _citizen_id,
title, title,
annonymous anonymous
from json_populate_record(null::constitution, resource) from json_populate_record(null::constitution, resource)
returning id into new_id; returning id into new_id;

View File

@@ -17,8 +17,8 @@ create table citizen
name jsonb not null check ( name ? 'first_name' and name ? 'last_name' ), name jsonb not null check ( name ? 'first_name' and name ? 'last_name' ),
birthday date not null, birthday date not null,
user_id uuid not null references "user" (id) unique, user_id uuid not null references "user" (id) unique,
vote_annonymous boolean default true not null, vote_anonymous boolean default true not null,
follow_annonymous boolean default true not null follow_anonymous boolean default true not null
); );
create table workgroup create table workgroup
@@ -29,7 +29,7 @@ create table workgroup
created_by_id uuid not null references citizen (id), created_by_id uuid not null references citizen (id),
name varchar(128) not null, name varchar(128) not null,
description text null, description text null,
annonymous boolean default false not null, anonymous boolean default false not null,
logo text null, logo text null,
owner_id uuid not null references citizen (id) owner_id uuid not null references citizen (id)
); );
@@ -100,7 +100,7 @@ create table article
version_id uuid default uuid_generate_v4() not null, version_id uuid default uuid_generate_v4() not null,
version_number int not null, version_number int not null,
title text not null check ( length(title) < 128 ), title text not null check ( length(title) < 128 ),
annonymous boolean default false not null, anonymous boolean default false not null,
content text not null check ( content != '' ), content text not null check ( content != '' ),
description text null check ( description != '' ), description text null check ( description != '' ),
tags varchar(32)[] default '{}' not null, tags varchar(32)[] default '{}' not null,
@@ -121,7 +121,7 @@ create table constitution
version_id uuid default uuid_generate_v4() not null, version_id uuid default uuid_generate_v4() not null,
version_number int not null, version_number int not null,
title text not null check ( length(title) < 128 ), title text not null check ( length(title) < 128 ),
annonymous boolean default false not null anonymous boolean default false not null
); );
create trigger generate_version_number_trigger create trigger generate_version_number_trigger

View File

@@ -24,7 +24,7 @@ class ArticleTest {
"version_id" : "fff2311c-07cc-43a6-bab1-aec6b649a903", "version_id" : "fff2311c-07cc-43a6-bab1-aec6b649a903",
"version_number" : null, "version_number" : null,
"title" : "Hello world!", "title" : "Hello world!",
"annonymous" : true, "anonymous" : true,
"content" : "bla bla bla", "content" : "bla bla bla",
"description" : "this is the changement !", "description" : "this is the changement !",
"tags" : [ ], "tags" : [ ],
@@ -37,8 +37,8 @@ class ArticleTest {
}, },
"birthday" : "2019-08-03T13:43:13.765Z", "birthday" : "2019-08-03T13:43:13.765Z",
"user_id" : null, "user_id" : null,
"vote_annonymous" : null, "vote_anonymous" : null,
"follow_annonymous" : null, "follow_anonymous" : null,
"user" : { "user" : {
"id" : "151ec430-3aad-4792-9a14-e394b2be491b", "id" : "151ec430-3aad-4792-9a14-e394b2be491b",
"username" : "jaque", "username" : "jaque",

View File

@@ -21,7 +21,7 @@ class ConstitutionTest {
private val constitutionJson: String = """{ private val constitutionJson: String = """{
"id":"15814bb6-8d90-4c6a-a456-c3939a8ec75e", "id":"15814bb6-8d90-4c6a-a456-c3939a8ec75e",
"title":"Hello world!", "title":"Hello world!",
"annonymous":true, "anonymous":true,
"titles":[ "titles":[
{ {
"id":"8156b66f-a9c8-4fd9-8375-a8a1f42ccfd2", "id":"8156b66f-a9c8-4fd9-8375-a8a1f42ccfd2",
@@ -36,8 +36,8 @@ class ConstitutionTest {
}, },
"birthday":"2019-08-07T20:34:08.013Z", "birthday":"2019-08-07T20:34:08.013Z",
"user_id":null, "user_id":null,
"vote_annonymous":null, "vote_anonymous":null,
"follow_annonymous":null, "follow_anonymous":null,
"user":{ "user":{
"id":"257abe9f-be17-4ad3-ae6a-b1dc9706d5d7", "id":"257abe9f-be17-4ad3-ae6a-b1dc9706d5d7",
"username":"jaque", "username":"jaque",
@@ -60,8 +60,8 @@ class ConstitutionTest {
}, },
"birthday":"2019-08-07T20:34:08.013Z", "birthday":"2019-08-07T20:34:08.013Z",
"user_id":null, "user_id":null,
"vote_annonymous":null, "vote_anonymous":null,
"follow_annonymous":null, "follow_anonymous":null,
"user":{ "user":{
"id":"257abe9f-be17-4ad3-ae6a-b1dc9706d5d7", "id":"257abe9f-be17-4ad3-ae6a-b1dc9706d5d7",
"username":"jaque", "username":"jaque",
@@ -86,7 +86,7 @@ class ConstitutionTest {
) )
val constitution = Constitution( val constitution = Constitution(
title = "Hello world!", title = "Hello world!",
annonymous = true, anonymous = true,
titles = listOf(title1), titles = listOf(title1),
createdBy = citizen createdBy = citizen
) )

View File

@@ -30,8 +30,8 @@ class FollowTest {
}, },
"birthday":"2019-08-09T11:42:47.168Z", "birthday":"2019-08-09T11:42:47.168Z",
"user_id":null, "user_id":null,
"vote_annonymous":null, "vote_anonymous":null,
"follow_annonymous":null, "follow_anonymous":null,
"user":{ "user":{
"id":"721db690-d050-46e6-92b0-056f2e8ba993", "id":"721db690-d050-46e6-92b0-056f2e8ba993",
"username":"jaque", "username":"jaque",
@@ -45,7 +45,7 @@ class FollowTest {
"target":{ "target":{
"id":"34588ea7-c180-4694-801b-1b5c5a6ed73f", "id":"34588ea7-c180-4694-801b-1b5c5a6ed73f",
"title":"Hello world!", "title":"Hello world!",
"annonymous":true, "anonymous":true,
"content":"bla bla bla", "content":"bla bla bla",
"description":"this is the changement !", "description":"this is the changement !",
"tags":[ "tags":[

View File

@@ -37,7 +37,7 @@ class ConstitutionSteps: En, KoinTest {
title = "hello", title = "hello",
titles = listOf(title1), titles = listOf(title1),
createdBy = citizen, createdBy = citizen,
annonymous = false anonymous = false
) )
get<ConstitutionRepository>().upsert(constitution) get<ConstitutionRepository>().upsert(constitution)
} }
@@ -54,7 +54,7 @@ class ConstitutionSteps: En, KoinTest {
title = "hello", title = "hello",
titles = listOf(title1), titles = listOf(title1),
createdBy = citizen, createdBy = citizen,
annonymous = false anonymous = false
) )
get<ConstitutionRepository>().upsert(constitution) get<ConstitutionRepository>().upsert(constitution)
} }

View File

@@ -5,7 +5,7 @@ declare
_user_id uuid; _user_id uuid;
_citizen_id uuid; _citizen_id uuid;
created_citizen json := '{"name": {"first_name":"George", "last_name":"MICHEL"}, "birthday": "2001-01-01"}'; created_citizen json := '{"name": {"first_name":"George", "last_name":"MICHEL"}, "birthday": "2001-01-01"}';
created_article json := '{"version_id":"933b6a1b-50c9-42b6-989f-c02a57814ef9", "title": "Love the world", "annonymous": false, "content": "bla bal bla", "tags": ["love", "test"]}'; created_article json := '{"version_id":"933b6a1b-50c9-42b6-989f-c02a57814ef9", "title": "Love the world", "anonymous": false, "content": "bla bal bla", "tags": ["love", "test"]}';
selected_article json; selected_article json;
begin begin
-- insert user for context -- insert user for context

View File

@@ -17,7 +17,7 @@ declare
{ {
"version_id": "933b6a1b-50c9-42b6-989f-c02a57814ef9", "version_id": "933b6a1b-50c9-42b6-989f-c02a57814ef9",
"title": "Love the world", "title": "Love the world",
"annonymous": false, "anonymous": false,
"content": "bla bal bla", "content": "bla bal bla",
"tags": [ "tags": [
"love", "love",

View File

@@ -17,7 +17,7 @@ declare
{ {
"version_id": "933b6a1b-50c9-42b6-989f-c02a57814ef9", "version_id": "933b6a1b-50c9-42b6-989f-c02a57814ef9",
"title": "Love the world", "title": "Love the world",
"annonymous": false, "anonymous": false,
"content": "bla bal bla", "content": "bla bal bla",
"tags": [ "tags": [
"love", "love",
@@ -29,7 +29,7 @@ declare
{ {
"version_id": "18ff6dd6-3bc1-4c59-82f0-5e2a8d54ae3e", "version_id": "18ff6dd6-3bc1-4c59-82f0-5e2a8d54ae3e",
"title": "Love the world", "title": "Love the world",
"annonymous": false, "anonymous": false,
"titles": [ "titles": [
{ {
"name": "titleOne" "name": "titleOne"

View File

@@ -16,7 +16,7 @@ declare
{ {
"version_id": "933b6a1b-50c9-42b6-989f-c02a57814ef9", "version_id": "933b6a1b-50c9-42b6-989f-c02a57814ef9",
"title": "Love the world", "title": "Love the world",
"annonymous": false, "anonymous": false,
"content": "bla bal bla", "content": "bla bal bla",
"tags": [ "tags": [
"love", "love",