diff --git a/src/main/kotlin/fr/dcproject/entity/Article.kt b/src/main/kotlin/fr/dcproject/entity/Article.kt index e3f7ee9..d9ccb39 100644 --- a/src/main/kotlin/fr/dcproject/entity/Article.kt +++ b/src/main/kotlin/fr/dcproject/entity/Article.kt @@ -6,7 +6,7 @@ import java.util.* class Article( id: UUID = UUID.randomUUID(), var title: String?, - var annonymous: Boolean? = true, + var anonymous: Boolean? = true, var content: String?, var description: String?, var tags: List = emptyList(), diff --git a/src/main/kotlin/fr/dcproject/entity/Citizen.kt b/src/main/kotlin/fr/dcproject/entity/Citizen.kt index b7cb8f3..20e86b5 100644 --- a/src/main/kotlin/fr/dcproject/entity/Citizen.kt +++ b/src/main/kotlin/fr/dcproject/entity/Citizen.kt @@ -12,8 +12,8 @@ class Citizen( var name: Name?, var birthday: DateTime?, var userId: UUID? = null, - var voteAnnonymous: Boolean? = null, - var followAnnonymous: Boolean? = null, + var voteanonymous: Boolean? = null, + var followanonymous: Boolean? = null, var user: User? ) : UuidEntity(id), EntityCreatedAt by EntityCreatedAtImp() { diff --git a/src/main/kotlin/fr/dcproject/entity/Constitution.kt b/src/main/kotlin/fr/dcproject/entity/Constitution.kt index 613a318..06e4a85 100644 --- a/src/main/kotlin/fr/dcproject/entity/Constitution.kt +++ b/src/main/kotlin/fr/dcproject/entity/Constitution.kt @@ -6,7 +6,7 @@ import java.util.* class Constitution( id: UUID = UUID.randomUUID(), var title: String?, - var annonymous: Boolean? = true, + var anonymous: Boolean? = true, var titles: List = listOf(), createdBy: Citizen? ): UuidEntity(id), diff --git a/src/main/kotlin/fr/dcproject/entity/Vote.kt b/src/main/kotlin/fr/dcproject/entity/Vote.kt index 3375318..63844d6 100644 --- a/src/main/kotlin/fr/dcproject/entity/Vote.kt +++ b/src/main/kotlin/fr/dcproject/entity/Vote.kt @@ -10,7 +10,7 @@ open class Vote <T: UuidEntity> ( createdBy: Citizen, override var target: T, var note: Int, - var annonymous: Boolean = true + var anonymous: Boolean = true ): Extra<T>(id, createdBy), EntityUpdatedAt by EntityUpdatedAtImp() { init { diff --git a/src/main/kotlin/fr/dcproject/repository/Vote.kt b/src/main/kotlin/fr/dcproject/repository/Vote.kt index 033220c..4518b60 100644 --- a/src/main/kotlin/fr/dcproject/repository/Vote.kt +++ b/src/main/kotlin/fr/dcproject/repository/Vote.kt @@ -14,7 +14,7 @@ open class Vote <T: UuidEntity>(override var requester: Requester): RepositoryI< fun vote(vote: VoteEntity<T>) { val reference = vote.target::class.simpleName!!.toLowerCase() val author = vote.createdBy ?: error("vote must be contain an author") - val anonymous = author.voteAnnonymous + val anonymous = author.voteanonymous requester .getFunction("vote") .sendQuery( diff --git a/src/main/resources/sql/fixtures/02-citizen.sql b/src/main/resources/sql/fixtures/02-citizen.sql index 819fce4..aed2766 100644 --- a/src/main/resources/sql/fixtures/02-citizen.sql +++ b/src/main/resources/sql/fixtures/02-citizen.sql @@ -2,7 +2,7 @@ do $$ begin 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 uuid_in(md5('citizen'||row_number() over ()::text)::cstring), jsonb_build_object( diff --git a/src/main/resources/sql/fixtures/03-workgroup.sql b/src/main/resources/sql/fixtures/03-workgroup.sql index 2a95739..743d71b 100644 --- a/src/main/resources/sql/fixtures/03-workgroup.sql +++ b/src/main/resources/sql/fixtures/03-workgroup.sql @@ -6,7 +6,7 @@ begin delete from citizen_in_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 uuid_in(md5('workgroup'||rn::text)::cstring), z.id, diff --git a/src/main/resources/sql/fixtures/04-article.sql b/src/main/resources/sql/fixtures/04-article.sql index e3cd38c..ea409aa 100644 --- a/src/main/resources/sql/fixtures/04-article.sql +++ b/src/main/resources/sql/fixtures/04-article.sql @@ -12,7 +12,7 @@ begin delete from article_relations; 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 uuid_in(md5('article'||row_number() over ())::cstring), uuid_in(md5('article_v'||row_number() over ())::cstring), diff --git a/src/main/resources/sql/fixtures/05-constitution.sql b/src/main/resources/sql/fixtures/05-constitution.sql index 8085cdd..64ab046 100644 --- a/src/main/resources/sql/fixtures/05-constitution.sql +++ b/src/main/resources/sql/fixtures/05-constitution.sql @@ -7,7 +7,7 @@ begin delete from title; 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 uuid_in(md5('constitution'||row_number() over ())::cstring), uuid_in(md5('constitution_v'||row_number() over ())::cstring), diff --git a/src/main/resources/sql/functions/article/upsert_article.sql b/src/main/resources/sql/functions/article/upsert_article.sql index ce3a6b6..ae749c2 100644 --- a/src/main/resources/sql/functions/article/upsert_article.sql +++ b/src/main/resources/sql/functions/article/upsert_article.sql @@ -14,14 +14,14 @@ begin -- 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 case when _id_exist then uuid_generate_v4() else coalesce(id, uuid_generate_v4()) end, coalesce(version_id, uuid_generate_v4()), (resource#>>'{created_by, id}')::uuid, title, - annonymous, + anonymous, content, description, tags diff --git a/src/main/resources/sql/functions/citizen/insert_citizen_with_user.sql b/src/main/resources/sql/functions/citizen/insert_citizen_with_user.sql index 83f8218..2fad67c 100644 --- a/src/main/resources/sql/functions/citizen/insert_citizen_with_user.sql +++ b/src/main/resources/sql/functions/citizen/insert_citizen_with_user.sql @@ -7,21 +7,21 @@ declare begin 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 coalesce(id, uuid_generate_v4()), name, birthday, (inserted_user->>'id')::uuid, - coalesce(vote_annonymous, true), - coalesce(follow_annonymous, true) + coalesce(vote_anonymous, true), + coalesce(follow_anonymous, true) from json_populate_record(null::citizen, resource) on conflict (id) do update set name = excluded.name, birthday = excluded.birthday, user_id = excluded.user_id, - vote_annonymous = excluded.vote_annonymous, - follow_annonymous = excluded.follow_annonymous + vote_anonymous = excluded.vote_anonymous, + follow_anonymous = excluded.follow_anonymous returning id into new_id; select find_citizen_by_id_with_user(new_id) into resource; diff --git a/src/main/resources/sql/functions/citizen/upsert_citizen.sql b/src/main/resources/sql/functions/citizen/upsert_citizen.sql index d903292..bc2a67c 100644 --- a/src/main/resources/sql/functions/citizen/upsert_citizen.sql +++ b/src/main/resources/sql/functions/citizen/upsert_citizen.sql @@ -4,21 +4,21 @@ $$ declare new_id uuid; 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 coalesce(id, uuid_generate_v4()), name, birthday, (resource#>>'{user, id}')::uuid, - coalesce(vote_annonymous, true), - coalesce(follow_annonymous, true) + coalesce(vote_anonymous, true), + coalesce(follow_anonymous, true) from json_populate_record(null::citizen, resource) on conflict (id) do update set name = excluded.name, birthday = excluded.birthday, user_id = excluded.user_id, - vote_annonymous = excluded.vote_annonymous, - follow_annonymous = excluded.follow_annonymous + vote_anonymous = excluded.vote_anonymous, + follow_anonymous = excluded.follow_anonymous returning id into new_id; select find_citizen_by_id(new_id) into resource; diff --git a/src/main/resources/sql/functions/constitution/upsert_constitution.sql b/src/main/resources/sql/functions/constitution/upsert_constitution.sql index 8c134fc..1d93364 100644 --- a/src/main/resources/sql/functions/constitution/upsert_constitution.sql +++ b/src/main/resources/sql/functions/constitution/upsert_constitution.sql @@ -19,14 +19,14 @@ begin 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 case when _id_exist then uuid_generate_v4() else coalesce(id, uuid_generate_v4()) end, version_id, _citizen_id, title, - annonymous + anonymous from json_populate_record(null::constitution, resource) returning id into new_id; diff --git a/src/main/resources/sql/migrations/0000-init_schema.up.sql b/src/main/resources/sql/migrations/0000-init_schema.up.sql index 19772ea..962ef5a 100644 --- a/src/main/resources/sql/migrations/0000-init_schema.up.sql +++ b/src/main/resources/sql/migrations/0000-init_schema.up.sql @@ -17,8 +17,8 @@ create table citizen name jsonb not null check ( name ? 'first_name' and name ? 'last_name' ), birthday date not null, user_id uuid not null references "user" (id) unique, - vote_annonymous boolean default true not null, - follow_annonymous boolean default true not null + vote_anonymous boolean default true not null, + follow_anonymous boolean default true not null ); create table workgroup @@ -29,7 +29,7 @@ create table workgroup created_by_id uuid not null references citizen (id), name varchar(128) not null, description text null, - annonymous boolean default false not null, + anonymous boolean default false not null, logo text null, 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_number int not null, 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 != '' ), description text null check ( description != '' ), tags varchar(32)[] default '{}' not null, @@ -121,7 +121,7 @@ create table constitution version_id uuid default uuid_generate_v4() not null, version_number int not null, 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 diff --git a/src/test/kotlin/ArticleTest.kt b/src/test/kotlin/ArticleTest.kt index e48c58e..fbc0724 100644 --- a/src/test/kotlin/ArticleTest.kt +++ b/src/test/kotlin/ArticleTest.kt @@ -24,7 +24,7 @@ class ArticleTest { "version_id" : "fff2311c-07cc-43a6-bab1-aec6b649a903", "version_number" : null, "title" : "Hello world!", - "annonymous" : true, + "anonymous" : true, "content" : "bla bla bla", "description" : "this is the changement !", "tags" : [ ], @@ -37,8 +37,8 @@ class ArticleTest { }, "birthday" : "2019-08-03T13:43:13.765Z", "user_id" : null, - "vote_annonymous" : null, - "follow_annonymous" : null, + "vote_anonymous" : null, + "follow_anonymous" : null, "user" : { "id" : "151ec430-3aad-4792-9a14-e394b2be491b", "username" : "jaque", diff --git a/src/test/kotlin/ConstitutionTest.kt b/src/test/kotlin/ConstitutionTest.kt index bfc8f6c..23b1838 100644 --- a/src/test/kotlin/ConstitutionTest.kt +++ b/src/test/kotlin/ConstitutionTest.kt @@ -21,7 +21,7 @@ class ConstitutionTest { private val constitutionJson: String = """{ "id":"15814bb6-8d90-4c6a-a456-c3939a8ec75e", "title":"Hello world!", - "annonymous":true, + "anonymous":true, "titles":[ { "id":"8156b66f-a9c8-4fd9-8375-a8a1f42ccfd2", @@ -36,8 +36,8 @@ class ConstitutionTest { }, "birthday":"2019-08-07T20:34:08.013Z", "user_id":null, - "vote_annonymous":null, - "follow_annonymous":null, + "vote_anonymous":null, + "follow_anonymous":null, "user":{ "id":"257abe9f-be17-4ad3-ae6a-b1dc9706d5d7", "username":"jaque", @@ -60,8 +60,8 @@ class ConstitutionTest { }, "birthday":"2019-08-07T20:34:08.013Z", "user_id":null, - "vote_annonymous":null, - "follow_annonymous":null, + "vote_anonymous":null, + "follow_anonymous":null, "user":{ "id":"257abe9f-be17-4ad3-ae6a-b1dc9706d5d7", "username":"jaque", @@ -86,7 +86,7 @@ class ConstitutionTest { ) val constitution = Constitution( title = "Hello world!", - annonymous = true, + anonymous = true, titles = listOf(title1), createdBy = citizen ) diff --git a/src/test/kotlin/FollowTest.kt b/src/test/kotlin/FollowTest.kt index 5951a77..ccdfb52 100644 --- a/src/test/kotlin/FollowTest.kt +++ b/src/test/kotlin/FollowTest.kt @@ -30,8 +30,8 @@ class FollowTest { }, "birthday":"2019-08-09T11:42:47.168Z", "user_id":null, - "vote_annonymous":null, - "follow_annonymous":null, + "vote_anonymous":null, + "follow_anonymous":null, "user":{ "id":"721db690-d050-46e6-92b0-056f2e8ba993", "username":"jaque", @@ -45,7 +45,7 @@ class FollowTest { "target":{ "id":"34588ea7-c180-4694-801b-1b5c5a6ed73f", "title":"Hello world!", - "annonymous":true, + "anonymous":true, "content":"bla bla bla", "description":"this is the changement !", "tags":[ diff --git a/src/test/kotlin/feature/ConstitutionSteps.kt b/src/test/kotlin/feature/ConstitutionSteps.kt index 0b2e069..30dff3f 100644 --- a/src/test/kotlin/feature/ConstitutionSteps.kt +++ b/src/test/kotlin/feature/ConstitutionSteps.kt @@ -37,7 +37,7 @@ class ConstitutionSteps: En, KoinTest { title = "hello", titles = listOf(title1), createdBy = citizen, - annonymous = false + anonymous = false ) get<ConstitutionRepository>().upsert(constitution) } @@ -54,7 +54,7 @@ class ConstitutionSteps: En, KoinTest { title = "hello", titles = listOf(title1), createdBy = citizen, - annonymous = false + anonymous = false ) get<ConstitutionRepository>().upsert(constitution) } diff --git a/src/test/sql/article.sql b/src/test/sql/article.sql index e4b0955..ac7033a 100644 --- a/src/test/sql/article.sql +++ b/src/test/sql/article.sql @@ -5,7 +5,7 @@ declare _user_id uuid; _citizen_id uuid; 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; begin -- insert user for context diff --git a/src/test/sql/comment.sql b/src/test/sql/comment.sql index 9106390..233ef73 100644 --- a/src/test/sql/comment.sql +++ b/src/test/sql/comment.sql @@ -17,7 +17,7 @@ declare { "version_id": "933b6a1b-50c9-42b6-989f-c02a57814ef9", "title": "Love the world", - "annonymous": false, + "anonymous": false, "content": "bla bal bla", "tags": [ "love", diff --git a/src/test/sql/constitution.sql b/src/test/sql/constitution.sql index d0827eb..c17a68a 100644 --- a/src/test/sql/constitution.sql +++ b/src/test/sql/constitution.sql @@ -17,7 +17,7 @@ declare { "version_id": "933b6a1b-50c9-42b6-989f-c02a57814ef9", "title": "Love the world", - "annonymous": false, + "anonymous": false, "content": "bla bal bla", "tags": [ "love", @@ -29,7 +29,7 @@ declare { "version_id": "18ff6dd6-3bc1-4c59-82f0-5e2a8d54ae3e", "title": "Love the world", - "annonymous": false, + "anonymous": false, "titles": [ { "name": "titleOne" diff --git a/src/test/sql/vote.sql b/src/test/sql/vote.sql index 46b4959..59e5b24 100644 --- a/src/test/sql/vote.sql +++ b/src/test/sql/vote.sql @@ -16,7 +16,7 @@ declare { "version_id": "933b6a1b-50c9-42b6-989f-c02a57814ef9", "title": "Love the world", - "annonymous": false, + "anonymous": false, "content": "bla bal bla", "tags": [ "love",