From ea8803a4556186e402e99ad0aef615e3fc5240b7 Mon Sep 17 00:00:00 2001 From: "Alice K." Date: Sat, 14 Sep 2024 20:40:39 +0200 Subject: [PATCH] frontend: add category specific fields --- ...8fdce052e0c081452e9fbbed8a2d252349f9.json} | 4 +- ...656848b554b808b614a60d3655567d7f7d48.json} | 4 +- ...164f6ab2dda148f167497edf4972e753d585.json} | 4 +- ...fa2ee0a06d4d2ff0efa530600be4e1369519.json} | 4 +- ...26a2859a2944030ca6a52917f7d3c7cf3947.json} | 4 +- ...e12555141ffcfaefa7c068b2f4c8f73c9c64.json} | 4 +- ...4afe19b1248c62a022da4df181a93a11bd0b.json} | 4 +- ...4172230801ba506d4aae70c84f8ea8da8d22.json} | 6 +-- ...a2dd89b45756b33e94879c2860ea5cb5f8df.json} | 4 +- ...6db9a4bc74d864a3f1184ea2ab0a4988e869.json} | 6 +-- ...02e6cf93bf1d75dd33eae15052bf7ba5829b.json} | 4 +- ...6069d5c3558bd41481674ed50d6926d6d93e.json} | 4 +- ...b3a073f83afc9eb0198fe440405e54687dc8.json} | 4 +- ...0ecaa0c912138ac77009f2461a228c106c7b.json} | 6 +-- ...9efd68d52f47025750e6663ea76ea529a3b7.json} | 4 +- ...c783b9553ae0745c5f464dfb73557bca0f19.json} | 4 +- ...70f1ef1912a68005f77837fc0a3336e30304.json} | 4 +- ...a6fdb8dbecf42873fd2ce76c825e60fcb7ec.json} | 4 +- ...9723e0385de509d1f81eb37cb30a2e2d73e4.json} | 4 +- ...3fab45e39a4193d222338506c348e9abff56.json} | 4 +- ...18bcea27807509963d6a1d3dc69a8d67df41.json} | 4 +- ...b67123b085062e19f586a116868677338682.json} | 6 +-- ...f5d657286d7dba845a0551efc6677d40378d.json} | 4 +- ...5e5c882d692f86a72281b2a0b2c7d9c5cefa.json} | 4 +- ...e4df322b902a68a86a4e82ee1fc47e031db6.json} | 4 +- ...e59619e9fa861a22334f27d852073f09adbf.json} | 4 +- ...2a6cca50b06f187095053888bee95c1fd9c1.json} | 4 +- ...2dc01b5ba5a467708225c63870f6b5eeeece.json} | 4 +- ...1c4d3f603ec4992a6845c87b282bc870320e.json} | 4 +- ...59729ba8ff51fd774558cd26bf34e2957f1a.json} | 4 +- ...922b4f0a4a79dd6da1bc2728a93811b27e6e.json} | 4 +- backend/src/models/comment.rs | 24 ++++++--- backend/src/models/entity.rs | 12 +++-- backend/src/models/family.rs | 48 +++++++++++------- frontend/components/CommentsDisplayer.vue | 5 +- .../components/admin/families/EditForm.vue | 49 ++++++++++++++----- frontend/components/viewer/CommentAddForm.vue | 4 +- frontend/components/viewer/EntityAddForm.vue | 10 +++- .../viewer/common/EntityDisplayer.vue | 4 +- frontend/openapi.json | 37 ++++++++++---- .../pages/admin/[familyId]/comments/[id].vue | 7 ++- .../pages/admin/[familyId]/entities/[id].vue | 5 +- .../pages/admin/[familyId]/entities/new.vue | 4 +- .../pages/admin/families/[id]/comments.vue | 5 +- .../pages/admin/families/[id]/entities.vue | 3 ++ 45 files changed, 223 insertions(+), 126 deletions(-) rename backend/.sqlx/{query-27436785b3afa62ffc9ea51931d7b0ff0918b477604df009b90c575f412740aa.json => query-0425aa387b7928417c59e1d127448fdce052e0c081452e9fbbed8a2d252349f9.json} (82%) rename backend/.sqlx/{query-5d080e45e18351ad5522d8669291615282acf60417740c529a3e427877351908.json => query-121c55cfc66bfdcadda3b6c879ec656848b554b808b614a60d3655567d7f7d48.json} (79%) rename backend/.sqlx/{query-59119986a14c65df932b9f038d764f8139646253c3439efc5a7564a668959423.json => query-17a7cade3e2aa93f9d6f1beddbcb164f6ab2dda148f167497edf4972e753d585.json} (73%) rename backend/.sqlx/{query-2bf3946bc918212efca87de647ca671f1702e174ace2ea56d71094e6653588ce.json => query-1c8aa530619f6ef63665671e7999fa2ee0a06d4d2ff0efa530600be4e1369519.json} (90%) rename backend/.sqlx/{query-92732dac31495d20b6cd7d10fc9ccd722999e5ffc1d11d2c7ddad4df7b51e7c3.json => query-1da41567d2f9913ad2e43cd889bf26a2859a2944030ca6a52917f7d3c7cf3947.json} (90%) rename backend/.sqlx/{query-57eda34b265da49a19800c3bc9f20f1935599e10139a5d0814fbdbe95b81dbb3.json => query-3357c72b39b5cfb154ed22ed2471e12555141ffcfaefa7c068b2f4c8f73c9c64.json} (84%) rename backend/.sqlx/{query-2b79614c0b46b674c0967694a692071d4752e9d2395b3341f0a9d30468e882f3.json => query-3ec8dc8e90248fb05b43c65ed1944afe19b1248c62a022da4df181a93a11bd0b.json} (75%) rename backend/.sqlx/{query-0ac9a4372e3b224f1e6ea2862128118b130d13aafb0ee16da9b52aa51858132c.json => query-435644c7645eb37d5c869105ddbc4172230801ba506d4aae70c84f8ea8da8d22.json} (86%) rename backend/.sqlx/{query-1f3ff6a401eab7441ce33dda930f570fe793ad077357017afd4aa456569e5162.json => query-47dcef54f2d7b53f35623f5747b4a2dd89b45756b33e94879c2860ea5cb5f8df.json} (91%) rename backend/.sqlx/{query-60ab13c4272c0a0303351fe03c98704a09a91c421dca369b8c4c0535a083ddf5.json => query-4de1c6da26f19d7f56049709bc786db9a4bc74d864a3f1184ea2ab0a4988e869.json} (79%) rename backend/.sqlx/{query-b84048f1a935c83bc70655032ef406371762e5b989ffd2220ac0df6f2c2aeef5.json => query-50ca7413465d5fc7facfcb8598fb02e6cf93bf1d75dd33eae15052bf7ba5829b.json} (91%) rename backend/.sqlx/{query-03cb34689fa33ae22fd07ec057729ec673097aec3ed15adaf43c8c5ad5d31b5c.json => query-5e6df0456cb4b90598b6f8d04bc86069d5c3558bd41481674ed50d6926d6d93e.json} (82%) rename backend/.sqlx/{query-6f58e99a3aba105a086785eba7fe844eb995f5cb3eef9ce8a5183ab486873ad8.json => query-774a79f460f88cbacfe0a7cd963ab3a073f83afc9eb0198fe440405e54687dc8.json} (87%) rename backend/.sqlx/{query-e3283e3ec47d6e41137df2e1546a381d7423de3099703efcdf9a9b6baebef6cc.json => query-857475123f7d8c8793f2021635520ecaa0c912138ac77009f2461a228c106c7b.json} (81%) rename backend/.sqlx/{query-ee00246f0ce73a59ea62ac87b53d2908d2fbdc1ca0140faa25121e4b437e3876.json => query-93ea354a30d421bc27be9f28bfc99efd68d52f47025750e6663ea76ea529a3b7.json} (90%) rename backend/.sqlx/{query-078bdd4c81141f6b317242699d09aa024cbce2aaf369f8b91b4c4dd9947d3ad1.json => query-9617c158d7c8cb409d9db78cfc77c783b9553ae0745c5f464dfb73557bca0f19.json} (83%) rename backend/.sqlx/{query-fa677201f50027889f9efd84a8707e4611a5e957f8f547e01f26ea0280ee41a5.json => query-a2215f2b60f0171eff8a5c1f5e3c70f1ef1912a68005f77837fc0a3336e30304.json} (91%) rename backend/.sqlx/{query-a2e3e58c85c52afd3b85a6b181e9be083c3811e58e85a5d7217c5275a023f3a4.json => query-a4ad29d1517628e943a7ae118deda6fdb8dbecf42873fd2ce76c825e60fcb7ec.json} (85%) rename backend/.sqlx/{query-f10f7ebc6ab934115a10d9185360bbdc2a7355c47945a9f0a1f3ef725d9b9416.json => query-a4d1f12942fa45b55e31dc8f35499723e0385de509d1f81eb37cb30a2e2d73e4.json} (89%) rename backend/.sqlx/{query-db4e416f35ff31f109760123320c6af4879dce2dcb3c8fee2a39d4b04f5c563c.json => query-a9447d27feca9fbef65a6233465c3fab45e39a4193d222338506c348e9abff56.json} (91%) rename backend/.sqlx/{query-81fbc12a23bdf9169dd8d0064e6f00ee26101ab31a2fd7217ee82deddf20530c.json => query-ae38d2ce78819912784f250c1d2418bcea27807509963d6a1d3dc69a8d67df41.json} (91%) rename backend/.sqlx/{query-45d4a034f7e5bc3c5e2d8be72e29306a8ca8086b4f01b0761071a3657ef01139.json => query-b6ca4088314dfb1de406a59fd977b67123b085062e19f586a116868677338682.json} (84%) rename backend/.sqlx/{query-4c3a1f26ab7d97bbbe852fa7700658dd3f486789102dfdf73960b6b0c667ec1c.json => query-b96e044361f8664aef6dcf8ca00cf5d657286d7dba845a0551efc6677d40378d.json} (85%) rename backend/.sqlx/{query-a6736caa3d3bfc6bb9ae445b1a308fe2bbb2585ccf4b4e03215b3c453863693c.json => query-c23fb52d04418585be96aca83b155e5c882d692f86a72281b2a0b2c7d9c5cefa.json} (83%) rename backend/.sqlx/{query-aba42450270f601311464fb9db099dff6fd4a6857f054ba0c49addb588cf8e92.json => query-d0645eb40bf50d186b229cca83e2e4df322b902a68a86a4e82ee1fc47e031db6.json} (78%) rename backend/.sqlx/{query-7957200302a289a9315869cd2cd2ed7f977e67052f18bcc48f5f864ef7468a9e.json => query-d167f47a4e4b04f0616d205cd7c3e59619e9fa861a22334f27d852073f09adbf.json} (86%) rename backend/.sqlx/{query-11f936e79d6d201d85db3c611d16baef040d744a776df1755da317358363e9f2.json => query-d4667242ba0c1d645f19ad1c560d2a6cca50b06f187095053888bee95c1fd9c1.json} (89%) rename backend/.sqlx/{query-4ca3a61ca8604f7bdf1088001281a4c7eef55ba3aa608135f42714b2358158ba.json => query-d7fa934a55e704afce7ad68af9502dc01b5ba5a467708225c63870f6b5eeeece.json} (83%) rename backend/.sqlx/{query-7a87abadc4dbddc100efd70dce1e966dedd113a6b393de7e3ab0a8c7f8f47626.json => query-df114f7704654e85ae8a9433a91d1c4d3f603ec4992a6845c87b282bc870320e.json} (91%) rename backend/.sqlx/{query-089c120308f17da6ac502ce46c67049884c4055999900cbb6cce56ef990b8dd4.json => query-e92063f48832afff02878e598c3b59729ba8ff51fd774558cd26bf34e2957f1a.json} (90%) rename backend/.sqlx/{query-1ed734f901c3b77d912f4f2086fd7d44e3d7df859711d8417aae03ff98f6b1ce.json => query-fd9c4f718c8d31bf339faf83d4c5922b4f0a4a79dd6da1bc2728a93811b27e6e.json} (90%) diff --git a/backend/.sqlx/query-27436785b3afa62ffc9ea51931d7b0ff0918b477604df009b90c575f412740aa.json b/backend/.sqlx/query-0425aa387b7928417c59e1d127448fdce052e0c081452e9fbbed8a2d252349f9.json similarity index 82% rename from backend/.sqlx/query-27436785b3afa62ffc9ea51931d7b0ff0918b477604df009b90c575f412740aa.json rename to backend/.sqlx/query-0425aa387b7928417c59e1d127448fdce052e0c081452e9fbbed8a2d252349f9.json index 94762b8..4ca12e3 100644 --- a/backend/.sqlx/query-27436785b3afa62ffc9ea51931d7b0ff0918b477604df009b90c575f412740aa.json +++ b/backend/.sqlx/query-0425aa387b7928417c59e1d127448fdce052e0c081452e9fbbed8a2d252349f9.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n (SELECT COUNT(*) FROM entities WHERE moderated) as \"total_entities!\",\n (SELECT COUNT(*) FROM comments WHERE moderated) as \"total_comments!\",\n (SELECT COUNT(*) FROM entities WHERE NOT moderated) as \"pending_entities!\",\n (SELECT COUNT(*) FROM comments WHERE NOT moderated) as \"pending_comments!\",\n (SELECT COUNT(*) FROM access_tokens_visits WHERE visited_at >= NOW()::date - INTERVAL '30 days') as \"total_visits_30_days!\",\n (SELECT COUNT(*) FROM access_tokens_visits WHERE visited_at >= NOW()::date - INTERVAL '7 days') as \"total_visits_7_days!\",\n (\n WITH date_series AS (\n SELECT generate_series(\n NOW()::date - INTERVAL '30 days',\n NOW()::date,\n INTERVAL '1 day'\n )::date AS visit_date\n ),\n aggregated_visits AS (\n SELECT\n ds.visit_date,\n COALESCE(COUNT(atv.visited_at), 0) AS visit_count\n FROM\n date_series ds\n LEFT JOIN\n access_tokens_visits atv\n ON\n ds.visit_date = DATE(atv.visited_at)\n WHERE\n ds.visit_date >= NOW()::date - INTERVAL '30 days'\n GROUP BY\n ds.visit_date\n ORDER BY\n ds.visit_date\n )\n SELECT json_object_agg(\n TO_CHAR(visit_date, 'YYYY-MM-DD'),\n visit_count\n ) AS visits\n FROM aggregated_visits\n )\n as \"visits_30_days!\"\n ", + "query": "\n SELECT\n (SELECT COUNT(*) FROM entities WHERE moderated) AS \"total_entities!\",\n (SELECT COUNT(*) FROM comments WHERE moderated) AS \"total_comments!\",\n (SELECT COUNT(*) FROM entities WHERE NOT moderated) AS \"pending_entities!\",\n (SELECT COUNT(*) FROM comments WHERE NOT moderated) AS \"pending_comments!\",\n (SELECT COUNT(*) FROM access_tokens_visits WHERE visited_at >= NOW()::date - INTERVAL '30 days') AS \"total_visits_30_days!\",\n (SELECT COUNT(*) FROM access_tokens_visits WHERE visited_at >= NOW()::date - INTERVAL '7 days') AS \"total_visits_7_days!\",\n (\n WITH date_series AS (\n SELECT generate_series(\n NOW()::date - INTERVAL '30 days',\n NOW()::date,\n INTERVAL '1 day'\n )::date AS visit_date\n ),\n aggregated_visits AS (\n SELECT\n ds.visit_date,\n COALESCE(COUNT(atv.visited_at), 0) AS visit_count\n FROM\n date_series ds\n LEFT JOIN\n access_tokens_visits atv\n ON\n ds.visit_date = DATE(atv.visited_at)\n WHERE\n ds.visit_date >= NOW()::date - INTERVAL '30 days'\n GROUP BY\n ds.visit_date\n ORDER BY\n ds.visit_date\n )\n SELECT json_object_agg(\n TO_CHAR(visit_date, 'YYYY-MM-DD'),\n visit_count\n ) AS visits\n FROM aggregated_visits\n )\n AS \"visits_30_days!\"\n ", "describe": { "columns": [ { @@ -52,5 +52,5 @@ null ] }, - "hash": "27436785b3afa62ffc9ea51931d7b0ff0918b477604df009b90c575f412740aa" + "hash": "0425aa387b7928417c59e1d127448fdce052e0c081452e9fbbed8a2d252349f9" } diff --git a/backend/.sqlx/query-5d080e45e18351ad5522d8669291615282acf60417740c529a3e427877351908.json b/backend/.sqlx/query-121c55cfc66bfdcadda3b6c879ec656848b554b808b614a60d3655567d7f7d48.json similarity index 79% rename from backend/.sqlx/query-5d080e45e18351ad5522d8669291615282acf60417740c529a3e427877351908.json rename to backend/.sqlx/query-121c55cfc66bfdcadda3b6c879ec656848b554b808b614a60d3655567d7f7d48.json index 8e1fb06..3ce8be3 100644 --- a/backend/.sqlx/query-5d080e45e18351ad5522d8669291615282acf60417740c529a3e427877351908.json +++ b/backend/.sqlx/query-121c55cfc66bfdcadda3b6c879ec656848b554b808b614a60d3655567d7f7d48.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT id, title, (SELECT hash FROM icons WHERE id = icon_id) as icon_hash,\n entity_form as \"entity_form: Json
\", \n comment_form as \"comment_form: Json\",\n sort_order,\n version\n FROM families\n ", + "query": "\n SELECT id, title, (SELECT hash FROM icons WHERE id = icon_id) AS icon_hash,\n entity_form AS \"entity_form: Json\", \n comment_form AS \"comment_form: Json\",\n sort_order,\n version\n FROM families\n ", "describe": { "columns": [ { @@ -52,5 +52,5 @@ false ] }, - "hash": "5d080e45e18351ad5522d8669291615282acf60417740c529a3e427877351908" + "hash": "121c55cfc66bfdcadda3b6c879ec656848b554b808b614a60d3655567d7f7d48" } diff --git a/backend/.sqlx/query-59119986a14c65df932b9f038d764f8139646253c3439efc5a7564a668959423.json b/backend/.sqlx/query-17a7cade3e2aa93f9d6f1beddbcb164f6ab2dda148f167497edf4972e753d585.json similarity index 73% rename from backend/.sqlx/query-59119986a14c65df932b9f038d764f8139646253c3439efc5a7564a668959423.json rename to backend/.sqlx/query-17a7cade3e2aa93f9d6f1beddbcb164f6ab2dda148f167497edf4972e753d585.json index 4a5b1a2..3778b99 100644 --- a/backend/.sqlx/query-59119986a14c65df932b9f038d764f8139646253c3439efc5a7564a668959423.json +++ b/backend/.sqlx/query-17a7cade3e2aa93f9d6f1beddbcb164f6ab2dda148f167497edf4972e753d585.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT \n id as \"id!\",\n entity_id as \"entity_id!\",\n category_id as \"category_id!\",\n tags_ids as \"tags_ids!\",\n family_id as \"family_id!\",\n display_name as \"display_name!\",\n total_results as \"total_results!\",\n total_pages as \"total_pages!\",\n response_current_page as \"response_current_page!\",\n hidden as \"hidden!\"\n FROM search_entities_admin(\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8\n )\n ", + "query": "\n SELECT \n id AS \"id!\",\n entity_id AS \"entity_id!\",\n category_id AS \"category_id!\",\n tags_ids AS \"tags_ids!\",\n family_id AS \"family_id!\",\n display_name AS \"display_name!\",\n total_results AS \"total_results!\",\n total_pages AS \"total_pages!\",\n response_current_page AS \"response_current_page!\",\n hidden AS \"hidden!\"\n FROM search_entities_admin(\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8\n )\n ", "describe": { "columns": [ { @@ -79,5 +79,5 @@ null ] }, - "hash": "59119986a14c65df932b9f038d764f8139646253c3439efc5a7564a668959423" + "hash": "17a7cade3e2aa93f9d6f1beddbcb164f6ab2dda148f167497edf4972e753d585" } diff --git a/backend/.sqlx/query-2bf3946bc918212efca87de647ca671f1702e174ace2ea56d71094e6653588ce.json b/backend/.sqlx/query-1c8aa530619f6ef63665671e7999fa2ee0a06d4d2ff0efa530600be4e1369519.json similarity index 90% rename from backend/.sqlx/query-2bf3946bc918212efca87de647ca671f1702e174ace2ea56d71094e6653588ce.json rename to backend/.sqlx/query-1c8aa530619f6ef63665671e7999fa2ee0a06d4d2ff0efa530600be4e1369519.json index 9d2aabc..2b6f5e5 100644 --- a/backend/.sqlx/query-2bf3946bc918212efca87de647ca671f1702e174ace2ea56d71094e6653588ce.json +++ b/backend/.sqlx/query-1c8aa530619f6ef63665671e7999fa2ee0a06d4d2ff0efa530600be4e1369519.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n id,\n title,\n family_id,\n default_status,\n (SELECT hash FROM icons WHERE id = icon_id) as icon_hash,\n fill_color,\n border_color,\n version\n FROM categories\n WHERE NOT (id = ANY($1)) AND family_id = ANY($2)\n ", + "query": "\n SELECT\n id,\n title,\n family_id,\n default_status,\n (SELECT hash FROM icons WHERE id = icon_id) AS icon_hash,\n fill_color,\n border_color,\n version\n FROM categories\n WHERE NOT (id = ANY($1)) AND family_id = ANY($2)\n ", "describe": { "columns": [ { @@ -61,5 +61,5 @@ false ] }, - "hash": "2bf3946bc918212efca87de647ca671f1702e174ace2ea56d71094e6653588ce" + "hash": "1c8aa530619f6ef63665671e7999fa2ee0a06d4d2ff0efa530600be4e1369519" } diff --git a/backend/.sqlx/query-92732dac31495d20b6cd7d10fc9ccd722999e5ffc1d11d2c7ddad4df7b51e7c3.json b/backend/.sqlx/query-1da41567d2f9913ad2e43cd889bf26a2859a2944030ca6a52917f7d3c7cf3947.json similarity index 90% rename from backend/.sqlx/query-92732dac31495d20b6cd7d10fc9ccd722999e5ffc1d11d2c7ddad4df7b51e7c3.json rename to backend/.sqlx/query-1da41567d2f9913ad2e43cd889bf26a2859a2944030ca6a52917f7d3c7cf3947.json index 3c6c452..db578e5 100644 --- a/backend/.sqlx/query-92732dac31495d20b6cd7d10fc9ccd722999e5ffc1d11d2c7ddad4df7b51e7c3.json +++ b/backend/.sqlx/query-1da41567d2f9913ad2e43cd889bf26a2859a2944030ca6a52917f7d3c7cf3947.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT e.id, e.display_name, e.category_id, e.created_at, e.hidden,\n e.moderated, e.updated_at,\n COALESCE(\n (SELECT array_agg(t.tag_id) FROM entity_tags t WHERE t.entity_id = e.id), \n array[]::uuid[]\n ) as \"tags!\"\n FROM entities e\n WHERE NOT e.moderated\n ORDER BY created_at\n ", + "query": "\n SELECT e.id, e.display_name, e.category_id, e.created_at, e.hidden,\n e.moderated, e.updated_at,\n COALESCE(\n (SELECT array_agg(t.tag_id) FROM entity_tags t WHERE t.entity_id = e.id), \n array[]::uuid[]\n ) AS \"tags!\"\n FROM entities e\n WHERE NOT e.moderated\n ORDER BY created_at\n ", "describe": { "columns": [ { @@ -58,5 +58,5 @@ null ] }, - "hash": "92732dac31495d20b6cd7d10fc9ccd722999e5ffc1d11d2c7ddad4df7b51e7c3" + "hash": "1da41567d2f9913ad2e43cd889bf26a2859a2944030ca6a52917f7d3c7cf3947" } diff --git a/backend/.sqlx/query-57eda34b265da49a19800c3bc9f20f1935599e10139a5d0814fbdbe95b81dbb3.json b/backend/.sqlx/query-3357c72b39b5cfb154ed22ed2471e12555141ffcfaefa7c068b2f4c8f73c9c64.json similarity index 84% rename from backend/.sqlx/query-57eda34b265da49a19800c3bc9f20f1935599e10139a5d0814fbdbe95b81dbb3.json rename to backend/.sqlx/query-3357c72b39b5cfb154ed22ed2471e12555141ffcfaefa7c068b2f4c8f73c9c64.json index 4388188..8a88284 100644 --- a/backend/.sqlx/query-57eda34b265da49a19800c3bc9f20f1935599e10139a5d0814fbdbe95b81dbb3.json +++ b/backend/.sqlx/query-3357c72b39b5cfb154ed22ed2471e12555141ffcfaefa7c068b2f4c8f73c9c64.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT \n id,\n title,\n token,\n permissions as \"permissions: Json\",\n active,\n (SELECT COUNT(*) FROM access_tokens_visits WHERE token_id = id AND visited_at > NOW() - INTERVAL '1 week') as \"last_week_visits!\"\n FROM access_tokens\n WHERE id = $1\n ", + "query": "\n SELECT \n id,\n title,\n token,\n permissions AS \"permissions: Json\",\n active,\n (SELECT COUNT(*) FROM access_tokens_visits WHERE token_id = id AND visited_at > NOW() - INTERVAL '1 week') AS \"last_week_visits!\"\n FROM access_tokens\n WHERE id = $1\n ", "describe": { "columns": [ { @@ -48,5 +48,5 @@ null ] }, - "hash": "57eda34b265da49a19800c3bc9f20f1935599e10139a5d0814fbdbe95b81dbb3" + "hash": "3357c72b39b5cfb154ed22ed2471e12555141ffcfaefa7c068b2f4c8f73c9c64" } diff --git a/backend/.sqlx/query-2b79614c0b46b674c0967694a692071d4752e9d2395b3341f0a9d30468e882f3.json b/backend/.sqlx/query-3ec8dc8e90248fb05b43c65ed1944afe19b1248c62a022da4df181a93a11bd0b.json similarity index 75% rename from backend/.sqlx/query-2b79614c0b46b674c0967694a692071d4752e9d2395b3341f0a9d30468e882f3.json rename to backend/.sqlx/query-3ec8dc8e90248fb05b43c65ed1944afe19b1248c62a022da4df181a93a11bd0b.json index 4ebc322..043ec6d 100644 --- a/backend/.sqlx/query-2b79614c0b46b674c0967694a692071d4752e9d2395b3341f0a9d30468e882f3.json +++ b/backend/.sqlx/query-3ec8dc8e90248fb05b43c65ed1944afe19b1248c62a022da4df181a93a11bd0b.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT \n id as \"id!\",\n entity_id as \"entity_id!\",\n category_id as \"category_id!\",\n family_id as \"family_id!\",\n display_name as \"display_name!\",\n parents as \"parents!: Json>\",\n locations as \"locations!: Json>\",\n total_results as \"total_results!\",\n total_pages as \"total_pages!\",\n response_current_page as \"response_current_page!\"\n FROM search_entities(\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10,\n $11,\n $12,\n $13,\n $14,\n $15,\n $16\n )\n ", + "query": "\n SELECT \n id AS \"id!\",\n entity_id AS \"entity_id!\",\n category_id AS \"category_id!\",\n family_id AS \"family_id!\",\n display_name AS \"display_name!\",\n parents AS \"parents!: Json>\",\n locations AS \"locations!: Json>\",\n total_results AS \"total_results!\",\n total_pages AS \"total_pages!\",\n response_current_page AS \"response_current_page!\"\n FROM search_entities(\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10,\n $11,\n $12,\n $13,\n $14,\n $15,\n $16\n )\n ", "describe": { "columns": [ { @@ -87,5 +87,5 @@ null ] }, - "hash": "2b79614c0b46b674c0967694a692071d4752e9d2395b3341f0a9d30468e882f3" + "hash": "3ec8dc8e90248fb05b43c65ed1944afe19b1248c62a022da4df181a93a11bd0b" } diff --git a/backend/.sqlx/query-0ac9a4372e3b224f1e6ea2862128118b130d13aafb0ee16da9b52aa51858132c.json b/backend/.sqlx/query-435644c7645eb37d5c869105ddbc4172230801ba506d4aae70c84f8ea8da8d22.json similarity index 86% rename from backend/.sqlx/query-0ac9a4372e3b224f1e6ea2862128118b130d13aafb0ee16da9b52aa51858132c.json rename to backend/.sqlx/query-435644c7645eb37d5c869105ddbc4172230801ba506d4aae70c84f8ea8da8d22.json index 7aef45f..4d245de 100644 --- a/backend/.sqlx/query-0ac9a4372e3b224f1e6ea2862128118b130d13aafb0ee16da9b52aa51858132c.json +++ b/backend/.sqlx/query-435644c7645eb37d5c869105ddbc4172230801ba506d4aae70c84f8ea8da8d22.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n WITH inserted AS (\n UPDATE comments\n SET \n entity_id = $2,\n author = $3,\n text = $4,\n data = $5,\n moderated = $6,\n version = $7\n WHERE id = $1\n RETURNING *\n )\n SELECT i.id, i.entity_id, i.author, i.text, i.data, i.created_at, i.updated_at, i.moderated, i.version, \n e.display_name as entity_display_name, e.category_id \n FROM inserted i\n JOIN entities e \n ON e.id = entity_id\n ", + "query": "\n WITH inserted AS (\n UPDATE comments\n SET \n entity_id = $2,\n author = $3,\n text = $4,\n data = $5,\n moderated = $6,\n version = $7\n WHERE id = $1\n RETURNING *\n )\n SELECT i.id, i.entity_id, i.author, i.text, i.data, i.created_at, i.updated_at, i.moderated, i.version, \n e.display_name AS entity_display_name, e.category_id AS entity_category_id\n FROM inserted i\n JOIN entities e \n ON e.id = entity_id\n ", "describe": { "columns": [ { @@ -55,7 +55,7 @@ }, { "ordinal": 10, - "name": "category_id", + "name": "entity_category_id", "type_info": "Uuid" } ], @@ -84,5 +84,5 @@ false ] }, - "hash": "0ac9a4372e3b224f1e6ea2862128118b130d13aafb0ee16da9b52aa51858132c" + "hash": "435644c7645eb37d5c869105ddbc4172230801ba506d4aae70c84f8ea8da8d22" } diff --git a/backend/.sqlx/query-1f3ff6a401eab7441ce33dda930f570fe793ad077357017afd4aa456569e5162.json b/backend/.sqlx/query-47dcef54f2d7b53f35623f5747b4a2dd89b45756b33e94879c2860ea5cb5f8df.json similarity index 91% rename from backend/.sqlx/query-1f3ff6a401eab7441ce33dda930f570fe793ad077357017afd4aa456569e5162.json rename to backend/.sqlx/query-47dcef54f2d7b53f35623f5747b4a2dd89b45756b33e94879c2860ea5cb5f8df.json index 07f751c..dcf2bce 100644 --- a/backend/.sqlx/query-1f3ff6a401eab7441ce33dda930f570fe793ad077357017afd4aa456569e5162.json +++ b/backend/.sqlx/query-47dcef54f2d7b53f35623f5747b4a2dd89b45756b33e94879c2860ea5cb5f8df.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n COALESCE((\n WITH origins AS (\n SELECT DISTINCT(COALESCE(referrer, 'unknown')) AS referrer, COUNT(*) AS total\n FROM access_tokens_visits\n WHERE token_id = $1\n GROUP BY referrer\n )\n SELECT json_object_agg(referrer, total) FROM origins\n ), '{}') as \"origins: JsonValue\",\n (\n WITH date_series AS (\n SELECT generate_series(\n NOW()::date - INTERVAL '30 days',\n NOW()::date,\n INTERVAL '1 day'\n )::date AS visit_date\n ),\n aggregated_visits AS (\n SELECT\n ds.visit_date,\n COALESCE(COUNT(atv.visited_at), 0) AS visit_count\n FROM\n date_series ds\n LEFT JOIN\n access_tokens_visits atv\n ON\n ds.visit_date = DATE(atv.visited_at) \n AND atv.token_id = $1\n GROUP BY\n ds.visit_date\n ORDER BY\n ds.visit_date\n )\n SELECT COALESCE(json_object_agg(\n TO_CHAR(visit_date, 'YYYY-MM-DD'),\n visit_count\n ), '{}') AS visits\n FROM aggregated_visits\n ) as \"visits_30_days: JsonValue\"\n ", + "query": "\n SELECT\n COALESCE((\n WITH origins AS (\n SELECT DISTINCT(COALESCE(referrer, 'unknown')) AS referrer, COUNT(*) AS total\n FROM access_tokens_visits\n WHERE token_id = $1\n GROUP BY referrer\n )\n SELECT json_object_agg(referrer, total) FROM origins\n ), '{}') AS \"origins: JsonValue\",\n (\n WITH date_series AS (\n SELECT generate_series(\n NOW()::date - INTERVAL '30 days',\n NOW()::date,\n INTERVAL '1 day'\n )::date AS visit_date\n ),\n aggregated_visits AS (\n SELECT\n ds.visit_date,\n COALESCE(COUNT(atv.visited_at), 0) AS visit_count\n FROM\n date_series ds\n LEFT JOIN\n access_tokens_visits atv\n ON\n ds.visit_date = DATE(atv.visited_at) \n AND atv.token_id = $1\n GROUP BY\n ds.visit_date\n ORDER BY\n ds.visit_date\n )\n SELECT COALESCE(json_object_agg(\n TO_CHAR(visit_date, 'YYYY-MM-DD'),\n visit_count\n ), '{}') AS visits\n FROM aggregated_visits\n ) AS \"visits_30_days: JsonValue\"\n ", "describe": { "columns": [ { @@ -24,5 +24,5 @@ null ] }, - "hash": "1f3ff6a401eab7441ce33dda930f570fe793ad077357017afd4aa456569e5162" + "hash": "47dcef54f2d7b53f35623f5747b4a2dd89b45756b33e94879c2860ea5cb5f8df" } diff --git a/backend/.sqlx/query-60ab13c4272c0a0303351fe03c98704a09a91c421dca369b8c4c0535a083ddf5.json b/backend/.sqlx/query-4de1c6da26f19d7f56049709bc786db9a4bc74d864a3f1184ea2ab0a4988e869.json similarity index 79% rename from backend/.sqlx/query-60ab13c4272c0a0303351fe03c98704a09a91c421dca369b8c4c0535a083ddf5.json rename to backend/.sqlx/query-4de1c6da26f19d7f56049709bc786db9a4bc74d864a3f1184ea2ab0a4988e869.json index bf832aa..9eb18e2 100644 --- a/backend/.sqlx/query-60ab13c4272c0a0303351fe03c98704a09a91c421dca369b8c4c0535a083ddf5.json +++ b/backend/.sqlx/query-4de1c6da26f19d7f56049709bc786db9a4bc74d864a3f1184ea2ab0a4988e869.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT c.id, c.entity_id, c.author, c.text, c.data, c.created_at, c.updated_at, c.moderated, c.version,\n e.display_name as entity_display_name, e.category_id\n FROM comments c\n JOIN entities e ON e.id = c.entity_id\n WHERE entity_id = $1\n ORDER BY created_at\n ", + "query": "\n SELECT c.id, c.entity_id, c.author, c.text, c.data, c.created_at, c.updated_at, c.moderated, c.version,\n e.display_name AS entity_display_name, e.category_id AS entity_category_id\n FROM comments c\n JOIN entities e ON e.id = c.entity_id\n WHERE entity_id = $1\n ORDER BY created_at\n ", "describe": { "columns": [ { @@ -55,7 +55,7 @@ }, { "ordinal": 10, - "name": "category_id", + "name": "entity_category_id", "type_info": "Uuid" } ], @@ -78,5 +78,5 @@ false ] }, - "hash": "60ab13c4272c0a0303351fe03c98704a09a91c421dca369b8c4c0535a083ddf5" + "hash": "4de1c6da26f19d7f56049709bc786db9a4bc74d864a3f1184ea2ab0a4988e869" } diff --git a/backend/.sqlx/query-b84048f1a935c83bc70655032ef406371762e5b989ffd2220ac0df6f2c2aeef5.json b/backend/.sqlx/query-50ca7413465d5fc7facfcb8598fb02e6cf93bf1d75dd33eae15052bf7ba5829b.json similarity index 91% rename from backend/.sqlx/query-b84048f1a935c83bc70655032ef406371762e5b989ffd2220ac0df6f2c2aeef5.json rename to backend/.sqlx/query-50ca7413465d5fc7facfcb8598fb02e6cf93bf1d75dd33eae15052bf7ba5829b.json index 29a850e..550d7c7 100644 --- a/backend/.sqlx/query-b84048f1a935c83bc70655032ef406371762e5b989ffd2220ac0df6f2c2aeef5.json +++ b/backend/.sqlx/query-50ca7413465d5fc7facfcb8598fb02e6cf93bf1d75dd33eae15052bf7ba5829b.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n UPDATE categories\n SET title = $2, family_id = $3, default_status = $4, fill_color = $5, border_color = $6, version = $7\n WHERE id = $1\n RETURNING\n id,\n title,\n family_id,\n default_status,\n (SELECT hash FROM icons WHERE id = icon_id) as icon_hash,\n fill_color,\n border_color,\n version\n ", + "query": "\n UPDATE categories\n SET title = $2, family_id = $3, default_status = $4, fill_color = $5, border_color = $6, version = $7\n WHERE id = $1\n RETURNING\n id,\n title,\n family_id,\n default_status,\n (SELECT hash FROM icons WHERE id = icon_id) AS icon_hash,\n fill_color,\n border_color,\n version\n ", "describe": { "columns": [ { @@ -66,5 +66,5 @@ false ] }, - "hash": "b84048f1a935c83bc70655032ef406371762e5b989ffd2220ac0df6f2c2aeef5" + "hash": "50ca7413465d5fc7facfcb8598fb02e6cf93bf1d75dd33eae15052bf7ba5829b" } diff --git a/backend/.sqlx/query-03cb34689fa33ae22fd07ec057729ec673097aec3ed15adaf43c8c5ad5d31b5c.json b/backend/.sqlx/query-5e6df0456cb4b90598b6f8d04bc86069d5c3558bd41481674ed50d6926d6d93e.json similarity index 82% rename from backend/.sqlx/query-03cb34689fa33ae22fd07ec057729ec673097aec3ed15adaf43c8c5ad5d31b5c.json rename to backend/.sqlx/query-5e6df0456cb4b90598b6f8d04bc86069d5c3558bd41481674ed50d6926d6d93e.json index b1fe415..47de596 100644 --- a/backend/.sqlx/query-03cb34689fa33ae22fd07ec057729ec673097aec3ed15adaf43c8c5ad5d31b5c.json +++ b/backend/.sqlx/query-5e6df0456cb4b90598b6f8d04bc86069d5c3558bd41481674ed50d6926d6d93e.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT families.id, families.title, (SELECT hash FROM icons WHERE id = families.icon_id) as icon_hash,\n families.entity_form as \"entity_form: Json\", \n families.comment_form as \"comment_form: Json\",\n families.sort_order,\n families.version\n FROM families\n JOIN categories ON families.id = categories.family_id\n WHERE categories.id = $1\n ", + "query": "\n SELECT families.id, families.title, (SELECT hash FROM icons WHERE id = families.icon_id) AS icon_hash,\n families.entity_form AS \"entity_form: Json\", \n families.comment_form AS \"comment_form: Json\",\n families.sort_order,\n families.version\n FROM families\n JOIN categories ON families.id = categories.family_id\n WHERE categories.id = $1\n ", "describe": { "columns": [ { @@ -54,5 +54,5 @@ false ] }, - "hash": "03cb34689fa33ae22fd07ec057729ec673097aec3ed15adaf43c8c5ad5d31b5c" + "hash": "5e6df0456cb4b90598b6f8d04bc86069d5c3558bd41481674ed50d6926d6d93e" } diff --git a/backend/.sqlx/query-6f58e99a3aba105a086785eba7fe844eb995f5cb3eef9ce8a5183ab486873ad8.json b/backend/.sqlx/query-774a79f460f88cbacfe0a7cd963ab3a073f83afc9eb0198fe440405e54687dc8.json similarity index 87% rename from backend/.sqlx/query-6f58e99a3aba105a086785eba7fe844eb995f5cb3eef9ce8a5183ab486873ad8.json rename to backend/.sqlx/query-774a79f460f88cbacfe0a7cd963ab3a073f83afc9eb0198fe440405e54687dc8.json index c88405e..ef9d6f1 100644 --- a/backend/.sqlx/query-6f58e99a3aba105a086785eba7fe844eb995f5cb3eef9ce8a5183ab486873ad8.json +++ b/backend/.sqlx/query-774a79f460f88cbacfe0a7cd963ab3a073f83afc9eb0198fe440405e54687dc8.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n UPDATE access_tokens\n SET title = $2, token = $3, permissions = $4, active = $5\n WHERE id = $1\n RETURNING \n id,\n title,\n token,\n permissions as \"permissions: Json\",\n active,\n (SELECT COUNT(*) FROM access_tokens_visits WHERE token_id = id AND visited_at > NOW() - INTERVAL '1 week') as \"last_week_visits!\"\n ", + "query": "\n UPDATE access_tokens\n SET title = $2, token = $3, permissions = $4, active = $5\n WHERE id = $1\n RETURNING \n id,\n title,\n token,\n permissions AS \"permissions: Json\",\n active,\n (SELECT COUNT(*) FROM access_tokens_visits WHERE token_id = id AND visited_at > NOW() - INTERVAL '1 week') AS \"last_week_visits!\"\n ", "describe": { "columns": [ { @@ -52,5 +52,5 @@ null ] }, - "hash": "6f58e99a3aba105a086785eba7fe844eb995f5cb3eef9ce8a5183ab486873ad8" + "hash": "774a79f460f88cbacfe0a7cd963ab3a073f83afc9eb0198fe440405e54687dc8" } diff --git a/backend/.sqlx/query-e3283e3ec47d6e41137df2e1546a381d7423de3099703efcdf9a9b6baebef6cc.json b/backend/.sqlx/query-857475123f7d8c8793f2021635520ecaa0c912138ac77009f2461a228c106c7b.json similarity index 81% rename from backend/.sqlx/query-e3283e3ec47d6e41137df2e1546a381d7423de3099703efcdf9a9b6baebef6cc.json rename to backend/.sqlx/query-857475123f7d8c8793f2021635520ecaa0c912138ac77009f2461a228c106c7b.json index 09369fa..96c9f25 100644 --- a/backend/.sqlx/query-e3283e3ec47d6e41137df2e1546a381d7423de3099703efcdf9a9b6baebef6cc.json +++ b/backend/.sqlx/query-857475123f7d8c8793f2021635520ecaa0c912138ac77009f2461a228c106c7b.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT c.id, c.entity_id, c.author, c.text, c.data, c.created_at, c.updated_at, c.moderated, c.version,\n e.display_name as entity_display_name, e.category_id\n FROM comments c\n JOIN entities e ON e.id = c.entity_id\n WHERE c.id = $1\n ", + "query": "\n SELECT c.id, c.entity_id, c.author, c.text, c.data, c.created_at, c.updated_at, c.moderated, c.version,\n e.display_name AS entity_display_name, e.category_id AS entity_category_id\n FROM comments c\n JOIN entities e ON e.id = c.entity_id\n WHERE c.id = $1\n ", "describe": { "columns": [ { @@ -55,7 +55,7 @@ }, { "ordinal": 10, - "name": "category_id", + "name": "entity_category_id", "type_info": "Uuid" } ], @@ -78,5 +78,5 @@ false ] }, - "hash": "e3283e3ec47d6e41137df2e1546a381d7423de3099703efcdf9a9b6baebef6cc" + "hash": "857475123f7d8c8793f2021635520ecaa0c912138ac77009f2461a228c106c7b" } diff --git a/backend/.sqlx/query-ee00246f0ce73a59ea62ac87b53d2908d2fbdc1ca0140faa25121e4b437e3876.json b/backend/.sqlx/query-93ea354a30d421bc27be9f28bfc99efd68d52f47025750e6663ea76ea529a3b7.json similarity index 90% rename from backend/.sqlx/query-ee00246f0ce73a59ea62ac87b53d2908d2fbdc1ca0140faa25121e4b437e3876.json rename to backend/.sqlx/query-93ea354a30d421bc27be9f28bfc99efd68d52f47025750e6663ea76ea529a3b7.json index 3bbe04e..acffbb2 100644 --- a/backend/.sqlx/query-ee00246f0ce73a59ea62ac87b53d2908d2fbdc1ca0140faa25121e4b437e3876.json +++ b/backend/.sqlx/query-93ea354a30d421bc27be9f28bfc99efd68d52f47025750e6663ea76ea529a3b7.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n id,\n title,\n family_id,\n default_status,\n (SELECT hash FROM icons WHERE id = icon_id) as icon_hash,\n fill_color,\n border_color,\n version\n FROM categories\n ", + "query": "\n SELECT\n id,\n title,\n family_id,\n default_status,\n (SELECT hash FROM icons WHERE id = icon_id) AS icon_hash,\n fill_color,\n border_color,\n version\n FROM categories\n ", "describe": { "columns": [ { @@ -58,5 +58,5 @@ false ] }, - "hash": "ee00246f0ce73a59ea62ac87b53d2908d2fbdc1ca0140faa25121e4b437e3876" + "hash": "93ea354a30d421bc27be9f28bfc99efd68d52f47025750e6663ea76ea529a3b7" } diff --git a/backend/.sqlx/query-078bdd4c81141f6b317242699d09aa024cbce2aaf369f8b91b4c4dd9947d3ad1.json b/backend/.sqlx/query-9617c158d7c8cb409d9db78cfc77c783b9553ae0745c5f464dfb73557bca0f19.json similarity index 83% rename from backend/.sqlx/query-078bdd4c81141f6b317242699d09aa024cbce2aaf369f8b91b4c4dd9947d3ad1.json rename to backend/.sqlx/query-9617c158d7c8cb409d9db78cfc77c783b9553ae0745c5f464dfb73557bca0f19.json index 66d2665..578d948 100644 --- a/backend/.sqlx/query-078bdd4c81141f6b317242699d09aa024cbce2aaf369f8b91b4c4dd9947d3ad1.json +++ b/backend/.sqlx/query-9617c158d7c8cb409d9db78cfc77c783b9553ae0745c5f464dfb73557bca0f19.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT families.id, families.title, (SELECT hash FROM icons WHERE id = families.icon_id) as icon_hash,\n families.entity_form as \"entity_form: Json\", \n families.comment_form as \"comment_form: Json\",\n families.sort_order,\n families.version\n FROM families\n JOIN categories ON families.id = categories.family_id\n JOIN entities ON categories.id = entities.category_id\n WHERE entities.id = $1\n ", + "query": "\n SELECT families.id, families.title, (SELECT hash FROM icons WHERE id = families.icon_id) AS icon_hash,\n families.entity_form AS \"entity_form: Json\", \n families.comment_form AS \"comment_form: Json\",\n families.sort_order,\n families.version\n FROM families\n JOIN categories ON families.id = categories.family_id\n JOIN entities ON categories.id = entities.category_id\n WHERE entities.id = $1\n ", "describe": { "columns": [ { @@ -54,5 +54,5 @@ false ] }, - "hash": "078bdd4c81141f6b317242699d09aa024cbce2aaf369f8b91b4c4dd9947d3ad1" + "hash": "9617c158d7c8cb409d9db78cfc77c783b9553ae0745c5f464dfb73557bca0f19" } diff --git a/backend/.sqlx/query-fa677201f50027889f9efd84a8707e4611a5e957f8f547e01f26ea0280ee41a5.json b/backend/.sqlx/query-a2215f2b60f0171eff8a5c1f5e3c70f1ef1912a68005f77837fc0a3336e30304.json similarity index 91% rename from backend/.sqlx/query-fa677201f50027889f9efd84a8707e4611a5e957f8f547e01f26ea0280ee41a5.json rename to backend/.sqlx/query-a2215f2b60f0171eff8a5c1f5e3c70f1ef1912a68005f77837fc0a3336e30304.json index 58260f0..9582eaa 100644 --- a/backend/.sqlx/query-fa677201f50027889f9efd84a8707e4611a5e957f8f547e01f26ea0280ee41a5.json +++ b/backend/.sqlx/query-a2215f2b60f0171eff8a5c1f5e3c70f1ef1912a68005f77837fc0a3336e30304.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT e.id, e.display_name, e.category_id, e.created_at, e.hidden,\n e.moderated, e.updated_at,\n COALESCE(\n (SELECT array_agg(t.tag_id) FROM entity_tags t WHERE t.entity_id = e.id), \n array[]::uuid[]\n ) as \"tags!\"\n FROM entities e\n INNER JOIN entities_entities ee ON e.id = ee.child_id\n WHERE ee.parent_id = $1\n ", + "query": "\n SELECT e.id, e.display_name, e.category_id, e.created_at, e.hidden,\n e.moderated, e.updated_at,\n COALESCE(\n (SELECT array_agg(t.tag_id) FROM entity_tags t WHERE t.entity_id = e.id), \n array[]::uuid[]\n ) AS \"tags!\"\n FROM entities e\n INNER JOIN entities_entities ee ON e.id = ee.child_id\n WHERE ee.parent_id = $1\n ", "describe": { "columns": [ { @@ -60,5 +60,5 @@ null ] }, - "hash": "fa677201f50027889f9efd84a8707e4611a5e957f8f547e01f26ea0280ee41a5" + "hash": "a2215f2b60f0171eff8a5c1f5e3c70f1ef1912a68005f77837fc0a3336e30304" } diff --git a/backend/.sqlx/query-a2e3e58c85c52afd3b85a6b181e9be083c3811e58e85a5d7217c5275a023f3a4.json b/backend/.sqlx/query-a4ad29d1517628e943a7ae118deda6fdb8dbecf42873fd2ce76c825e60fcb7ec.json similarity index 85% rename from backend/.sqlx/query-a2e3e58c85c52afd3b85a6b181e9be083c3811e58e85a5d7217c5275a023f3a4.json rename to backend/.sqlx/query-a4ad29d1517628e943a7ae118deda6fdb8dbecf42873fd2ce76c825e60fcb7ec.json index 76f6193..89bf66e 100644 --- a/backend/.sqlx/query-a2e3e58c85c52afd3b85a6b181e9be083c3811e58e85a5d7217c5275a023f3a4.json +++ b/backend/.sqlx/query-a4ad29d1517628e943a7ae118deda6fdb8dbecf42873fd2ce76c825e60fcb7ec.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n INSERT INTO access_tokens (title, token, permissions, active)\n VALUES ($1, $2, $3, $4)\n RETURNING \n id,\n title,\n token, \n permissions as \"permissions: Json\",\n active,\n 0 as \"last_week_visits!\"\n ", + "query": "\n INSERT INTO access_tokens (title, token, permissions, active)\n VALUES ($1, $2, $3, $4)\n RETURNING \n id,\n title,\n token, \n permissions AS \"permissions: Json\",\n active,\n 0 AS \"last_week_visits!\"\n ", "describe": { "columns": [ { @@ -51,5 +51,5 @@ null ] }, - "hash": "a2e3e58c85c52afd3b85a6b181e9be083c3811e58e85a5d7217c5275a023f3a4" + "hash": "a4ad29d1517628e943a7ae118deda6fdb8dbecf42873fd2ce76c825e60fcb7ec" } diff --git a/backend/.sqlx/query-f10f7ebc6ab934115a10d9185360bbdc2a7355c47945a9f0a1f3ef725d9b9416.json b/backend/.sqlx/query-a4d1f12942fa45b55e31dc8f35499723e0385de509d1f81eb37cb30a2e2d73e4.json similarity index 89% rename from backend/.sqlx/query-f10f7ebc6ab934115a10d9185360bbdc2a7355c47945a9f0a1f3ef725d9b9416.json rename to backend/.sqlx/query-a4d1f12942fa45b55e31dc8f35499723e0385de509d1f81eb37cb30a2e2d73e4.json index 47bdbe5..fc9cf09 100644 --- a/backend/.sqlx/query-f10f7ebc6ab934115a10d9185360bbdc2a7355c47945a9f0a1f3ef725d9b9416.json +++ b/backend/.sqlx/query-a4d1f12942fa45b55e31dc8f35499723e0385de509d1f81eb37cb30a2e2d73e4.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT e.id,\n e.display_name,\n e.category_id,\n e.created_at,\n COALESCE(\n (SELECT array_agg(t.tag_id) FROM entity_tags t WHERE t.entity_id = e.id), \n array[]::uuid[]\n ) as \"tags!\"\n FROM entities e\n INNER JOIN entities_entities ee ON e.id = ee.child_id\n WHERE ee.parent_id = $1 AND e.moderated AND NOT e.hidden\n ", + "query": "\n SELECT e.id,\n e.display_name,\n e.category_id,\n e.created_at,\n COALESCE(\n (SELECT array_agg(t.tag_id) FROM entity_tags t WHERE t.entity_id = e.id), \n array[]::uuid[]\n ) AS \"tags!\"\n FROM entities e\n INNER JOIN entities_entities ee ON e.id = ee.child_id\n WHERE ee.parent_id = $1 AND e.moderated AND NOT e.hidden\n ", "describe": { "columns": [ { @@ -42,5 +42,5 @@ null ] }, - "hash": "f10f7ebc6ab934115a10d9185360bbdc2a7355c47945a9f0a1f3ef725d9b9416" + "hash": "a4d1f12942fa45b55e31dc8f35499723e0385de509d1f81eb37cb30a2e2d73e4" } diff --git a/backend/.sqlx/query-db4e416f35ff31f109760123320c6af4879dce2dcb3c8fee2a39d4b04f5c563c.json b/backend/.sqlx/query-a9447d27feca9fbef65a6233465c3fab45e39a4193d222338506c348e9abff56.json similarity index 91% rename from backend/.sqlx/query-db4e416f35ff31f109760123320c6af4879dce2dcb3c8fee2a39d4b04f5c563c.json rename to backend/.sqlx/query-a9447d27feca9fbef65a6233465c3fab45e39a4193d222338506c348e9abff56.json index b5b5e67..34250bf 100644 --- a/backend/.sqlx/query-db4e416f35ff31f109760123320c6af4879dce2dcb3c8fee2a39d4b04f5c563c.json +++ b/backend/.sqlx/query-a9447d27feca9fbef65a6233465c3fab45e39a4193d222338506c348e9abff56.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT e.id, c.family_id, e.display_name, e.category_id, \n e.locations as \"locations: Json>\", \n e.data, e.hidden, e.moderation_notes, e.moderated, \n e.created_at, e.updated_at, e.version,\n COALESCE(\n (SELECT array_agg(t.tag_id) FROM entity_tags t WHERE t.entity_id = e.id), \n array[]::uuid[]\n ) as \"tags!\"\n FROM entities e\n INNER JOIN categories c ON e.category_id = c.id\n WHERE e.id = $1\n ", + "query": "\n SELECT e.id, c.family_id, e.display_name, e.category_id, \n e.locations AS \"locations: Json>\", \n e.data, e.hidden, e.moderation_notes, e.moderated, \n e.created_at, e.updated_at, e.version,\n COALESCE(\n (SELECT array_agg(t.tag_id) FROM entity_tags t WHERE t.entity_id = e.id), \n array[]::uuid[]\n ) AS \"tags!\"\n FROM entities e\n INNER JOIN categories c ON e.category_id = c.id\n WHERE e.id = $1\n ", "describe": { "columns": [ { @@ -90,5 +90,5 @@ null ] }, - "hash": "db4e416f35ff31f109760123320c6af4879dce2dcb3c8fee2a39d4b04f5c563c" + "hash": "a9447d27feca9fbef65a6233465c3fab45e39a4193d222338506c348e9abff56" } diff --git a/backend/.sqlx/query-81fbc12a23bdf9169dd8d0064e6f00ee26101ab31a2fd7217ee82deddf20530c.json b/backend/.sqlx/query-ae38d2ce78819912784f250c1d2418bcea27807509963d6a1d3dc69a8d67df41.json similarity index 91% rename from backend/.sqlx/query-81fbc12a23bdf9169dd8d0064e6f00ee26101ab31a2fd7217ee82deddf20530c.json rename to backend/.sqlx/query-ae38d2ce78819912784f250c1d2418bcea27807509963d6a1d3dc69a8d67df41.json index da9e2fe..628f9bb 100644 --- a/backend/.sqlx/query-81fbc12a23bdf9169dd8d0064e6f00ee26101ab31a2fd7217ee82deddf20530c.json +++ b/backend/.sqlx/query-ae38d2ce78819912784f250c1d2418bcea27807509963d6a1d3dc69a8d67df41.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n INSERT INTO categories (title, family_id, default_status, fill_color, border_color)\n VALUES ($1, $2, $3, $4, $5)\n RETURNING\n id,\n title,\n family_id,\n default_status,\n (SELECT hash FROM icons WHERE id = icon_id) as icon_hash,\n fill_color,\n border_color,\n version\n ", + "query": "\n INSERT INTO categories (title, family_id, default_status, fill_color, border_color)\n VALUES ($1, $2, $3, $4, $5)\n RETURNING\n id,\n title,\n family_id,\n default_status,\n (SELECT hash FROM icons WHERE id = icon_id) AS icon_hash,\n fill_color,\n border_color,\n version\n ", "describe": { "columns": [ { @@ -64,5 +64,5 @@ false ] }, - "hash": "81fbc12a23bdf9169dd8d0064e6f00ee26101ab31a2fd7217ee82deddf20530c" + "hash": "ae38d2ce78819912784f250c1d2418bcea27807509963d6a1d3dc69a8d67df41" } diff --git a/backend/.sqlx/query-45d4a034f7e5bc3c5e2d8be72e29306a8ca8086b4f01b0761071a3657ef01139.json b/backend/.sqlx/query-b6ca4088314dfb1de406a59fd977b67123b085062e19f586a116868677338682.json similarity index 84% rename from backend/.sqlx/query-45d4a034f7e5bc3c5e2d8be72e29306a8ca8086b4f01b0761071a3657ef01139.json rename to backend/.sqlx/query-b6ca4088314dfb1de406a59fd977b67123b085062e19f586a116868677338682.json index 2e262d2..9cd996c 100644 --- a/backend/.sqlx/query-45d4a034f7e5bc3c5e2d8be72e29306a8ca8086b4f01b0761071a3657ef01139.json +++ b/backend/.sqlx/query-b6ca4088314dfb1de406a59fd977b67123b085062e19f586a116868677338682.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n WITH inserted AS (\n INSERT INTO comments (entity_id, author, text, data, moderated)\n VALUES ($1, $2, $3, $4, $5)\n RETURNING *\n )\n SELECT i.id, i.entity_id, i.author, i.text, i.data, i.created_at, i.updated_at, i.moderated, i.version, \n display_name as entity_display_name, category_id \n FROM inserted i\n JOIN entities e \n ON e.id = entity_id\n ", + "query": "\n WITH inserted AS (\n INSERT INTO comments (entity_id, author, text, data, moderated)\n VALUES ($1, $2, $3, $4, $5)\n RETURNING *\n )\n SELECT i.id, i.entity_id, i.author, i.text, i.data, i.created_at, i.updated_at, i.moderated, i.version, \n display_name AS entity_display_name, category_id AS entity_category_id\n FROM inserted i\n JOIN entities e \n ON e.id = entity_id\n ", "describe": { "columns": [ { @@ -55,7 +55,7 @@ }, { "ordinal": 10, - "name": "category_id", + "name": "entity_category_id", "type_info": "Uuid" } ], @@ -82,5 +82,5 @@ false ] }, - "hash": "45d4a034f7e5bc3c5e2d8be72e29306a8ca8086b4f01b0761071a3657ef01139" + "hash": "b6ca4088314dfb1de406a59fd977b67123b085062e19f586a116868677338682" } diff --git a/backend/.sqlx/query-4c3a1f26ab7d97bbbe852fa7700658dd3f486789102dfdf73960b6b0c667ec1c.json b/backend/.sqlx/query-b96e044361f8664aef6dcf8ca00cf5d657286d7dba845a0551efc6677d40378d.json similarity index 85% rename from backend/.sqlx/query-4c3a1f26ab7d97bbbe852fa7700658dd3f486789102dfdf73960b6b0c667ec1c.json rename to backend/.sqlx/query-b96e044361f8664aef6dcf8ca00cf5d657286d7dba845a0551efc6677d40378d.json index 096f313..3087b42 100644 --- a/backend/.sqlx/query-4c3a1f26ab7d97bbbe852fa7700658dd3f486789102dfdf73960b6b0c667ec1c.json +++ b/backend/.sqlx/query-b96e044361f8664aef6dcf8ca00cf5d657286d7dba845a0551efc6677d40378d.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT e.id, c.family_id, e.category_id, e.display_name, e.data, e.created_at, e.updated_at,\n e.locations as \"locations: Json>\",\n COALESCE(\n (SELECT array_agg(t.tag_id) FROM entity_tags t WHERE t.entity_id = e.id), \n array[]::uuid[]\n ) as \"tags!\",\n f.entity_form as \"entity_form: Json\",\n f.comment_form as \"comment_form: Json\"\n FROM entities e\n INNER JOIN categories c ON e.category_id = c.id\n INNER JOIN families f ON c.family_id = f.id\n WHERE e.id = $1 AND e.moderated AND NOT e.hidden\n ", + "query": "\n SELECT e.id, c.family_id, e.category_id, e.display_name, e.data, e.created_at, e.updated_at,\n e.locations AS \"locations: Json>\",\n COALESCE(\n (SELECT array_agg(t.tag_id) FROM entity_tags t WHERE t.entity_id = e.id), \n array[]::uuid[]\n ) AS \"tags!\",\n f.entity_form AS \"entity_form: Json\",\n f.comment_form AS \"comment_form: Json\"\n FROM entities e\n INNER JOIN categories c ON e.category_id = c.id\n INNER JOIN families f ON c.family_id = f.id\n WHERE e.id = $1 AND e.moderated AND NOT e.hidden\n ", "describe": { "columns": [ { @@ -78,5 +78,5 @@ false ] }, - "hash": "4c3a1f26ab7d97bbbe852fa7700658dd3f486789102dfdf73960b6b0c667ec1c" + "hash": "b96e044361f8664aef6dcf8ca00cf5d657286d7dba845a0551efc6677d40378d" } diff --git a/backend/.sqlx/query-a6736caa3d3bfc6bb9ae445b1a308fe2bbb2585ccf4b4e03215b3c453863693c.json b/backend/.sqlx/query-c23fb52d04418585be96aca83b155e5c882d692f86a72281b2a0b2c7d9c5cefa.json similarity index 83% rename from backend/.sqlx/query-a6736caa3d3bfc6bb9ae445b1a308fe2bbb2585ccf4b4e03215b3c453863693c.json rename to backend/.sqlx/query-c23fb52d04418585be96aca83b155e5c882d692f86a72281b2a0b2c7d9c5cefa.json index 9481645..41c57da 100644 --- a/backend/.sqlx/query-a6736caa3d3bfc6bb9ae445b1a308fe2bbb2585ccf4b4e03215b3c453863693c.json +++ b/backend/.sqlx/query-c23fb52d04418585be96aca83b155e5c882d692f86a72281b2a0b2c7d9c5cefa.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n id as \"id!\",\n entity_id as \"entity_id!\",\n category_id as \"category_id!\",\n family_id as \"family_id!\",\n display_name as \"display_name!\",\n parent_id,\n parent_display_name,\n web_mercator_x as \"web_mercator_x!\",\n web_mercator_y as \"web_mercator_y!\",\n plain_text_location as \"plain_text_location!\",\n cluster_id,\n cluster_center_x,\n cluster_center_y\n FROM fetch_entities_within_view(\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10,\n $11,\n $12,\n $13,\n $14,\n $15,\n $16,\n $17,\n $18\n )\n ", + "query": "\n SELECT\n id AS \"id!\",\n entity_id AS \"entity_id!\",\n category_id AS \"category_id!\",\n family_id AS \"family_id!\",\n display_name AS \"display_name!\",\n parent_id,\n parent_display_name,\n web_mercator_x AS \"web_mercator_x!\",\n web_mercator_y AS \"web_mercator_y!\",\n plain_text_location AS \"plain_text_location!\",\n cluster_id,\n cluster_center_x,\n cluster_center_y\n FROM fetch_entities_within_view(\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10,\n $11,\n $12,\n $13,\n $14,\n $15,\n $16,\n $17,\n $18\n )\n ", "describe": { "columns": [ { @@ -107,5 +107,5 @@ null ] }, - "hash": "a6736caa3d3bfc6bb9ae445b1a308fe2bbb2585ccf4b4e03215b3c453863693c" + "hash": "c23fb52d04418585be96aca83b155e5c882d692f86a72281b2a0b2c7d9c5cefa" } diff --git a/backend/.sqlx/query-aba42450270f601311464fb9db099dff6fd4a6857f054ba0c49addb588cf8e92.json b/backend/.sqlx/query-d0645eb40bf50d186b229cca83e2e4df322b902a68a86a4e82ee1fc47e031db6.json similarity index 78% rename from backend/.sqlx/query-aba42450270f601311464fb9db099dff6fd4a6857f054ba0c49addb588cf8e92.json rename to backend/.sqlx/query-d0645eb40bf50d186b229cca83e2e4df322b902a68a86a4e82ee1fc47e031db6.json index 72d7330..5142ff5 100644 --- a/backend/.sqlx/query-aba42450270f601311464fb9db099dff6fd4a6857f054ba0c49addb588cf8e92.json +++ b/backend/.sqlx/query-d0645eb40bf50d186b229cca83e2e4df322b902a68a86a4e82ee1fc47e031db6.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n id,\n title,\n token,\n permissions as \"permissions: Json\",\n active,\n (SELECT COUNT(*) FROM access_tokens_visits WHERE token_id = id AND visited_at > NOW() - INTERVAL '1 week') as \"last_week_visits!\"\n FROM access_tokens\n ", + "query": "\n SELECT\n id,\n title,\n token,\n permissions AS \"permissions: Json\",\n active,\n (SELECT COUNT(*) FROM access_tokens_visits WHERE token_id = id AND visited_at > NOW() - INTERVAL '1 week') AS \"last_week_visits!\"\n FROM access_tokens\n ", "describe": { "columns": [ { @@ -46,5 +46,5 @@ null ] }, - "hash": "aba42450270f601311464fb9db099dff6fd4a6857f054ba0c49addb588cf8e92" + "hash": "d0645eb40bf50d186b229cca83e2e4df322b902a68a86a4e82ee1fc47e031db6" } diff --git a/backend/.sqlx/query-7957200302a289a9315869cd2cd2ed7f977e67052f18bcc48f5f864ef7468a9e.json b/backend/.sqlx/query-d167f47a4e4b04f0616d205cd7c3e59619e9fa861a22334f27d852073f09adbf.json similarity index 86% rename from backend/.sqlx/query-7957200302a289a9315869cd2cd2ed7f977e67052f18bcc48f5f864ef7468a9e.json rename to backend/.sqlx/query-d167f47a4e4b04f0616d205cd7c3e59619e9fa861a22334f27d852073f09adbf.json index 3e2c8aa..349db5b 100644 --- a/backend/.sqlx/query-7957200302a289a9315869cd2cd2ed7f977e67052f18bcc48f5f864ef7468a9e.json +++ b/backend/.sqlx/query-d167f47a4e4b04f0616d205cd7c3e59619e9fa861a22334f27d852073f09adbf.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n INSERT INTO families (title, entity_form, comment_form, sort_order)\n VALUES ($1, $2, $3, $4)\n RETURNING \n id,\n title,\n (SELECT hash FROM icons WHERE id = icon_id) as icon_hash,\n entity_form as \"entity_form: Json\",\n comment_form as \"comment_form: Json\",\n sort_order,\n version\n ", + "query": "\n INSERT INTO families (title, entity_form, comment_form, sort_order)\n VALUES ($1, $2, $3, $4)\n RETURNING \n id,\n title,\n (SELECT hash FROM icons WHERE id = icon_id) AS icon_hash,\n entity_form AS \"entity_form: Json\",\n comment_form AS \"comment_form: Json\",\n sort_order,\n version\n ", "describe": { "columns": [ { @@ -57,5 +57,5 @@ false ] }, - "hash": "7957200302a289a9315869cd2cd2ed7f977e67052f18bcc48f5f864ef7468a9e" + "hash": "d167f47a4e4b04f0616d205cd7c3e59619e9fa861a22334f27d852073f09adbf" } diff --git a/backend/.sqlx/query-11f936e79d6d201d85db3c611d16baef040d744a776df1755da317358363e9f2.json b/backend/.sqlx/query-d4667242ba0c1d645f19ad1c560d2a6cca50b06f187095053888bee95c1fd9c1.json similarity index 89% rename from backend/.sqlx/query-11f936e79d6d201d85db3c611d16baef040d744a776df1755da317358363e9f2.json rename to backend/.sqlx/query-d4667242ba0c1d645f19ad1c560d2a6cca50b06f187095053888bee95c1fd9c1.json index 964fa60..5a2d197 100644 --- a/backend/.sqlx/query-11f936e79d6d201d85db3c611d16baef040d744a776df1755da317358363e9f2.json +++ b/backend/.sqlx/query-d4667242ba0c1d645f19ad1c560d2a6cca50b06f187095053888bee95c1fd9c1.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT e.id,\n e.display_name,\n e.category_id,\n e.created_at,\n COALESCE(\n (SELECT array_agg(t.tag_id) FROM entity_tags t WHERE t.entity_id = e.id), \n array[]::uuid[]\n ) as \"tags!\"\n FROM entities e\n INNER JOIN entities_entities ee ON e.id = ee.parent_id\n WHERE ee.child_id = $1 AND e.moderated AND NOT e.hidden\n ", + "query": "\n SELECT e.id,\n e.display_name,\n e.category_id,\n e.created_at,\n COALESCE(\n (SELECT array_agg(t.tag_id) FROM entity_tags t WHERE t.entity_id = e.id), \n array[]::uuid[]\n ) AS \"tags!\"\n FROM entities e\n INNER JOIN entities_entities ee ON e.id = ee.parent_id\n WHERE ee.child_id = $1 AND e.moderated AND NOT e.hidden\n ", "describe": { "columns": [ { @@ -42,5 +42,5 @@ null ] }, - "hash": "11f936e79d6d201d85db3c611d16baef040d744a776df1755da317358363e9f2" + "hash": "d4667242ba0c1d645f19ad1c560d2a6cca50b06f187095053888bee95c1fd9c1" } diff --git a/backend/.sqlx/query-4ca3a61ca8604f7bdf1088001281a4c7eef55ba3aa608135f42714b2358158ba.json b/backend/.sqlx/query-d7fa934a55e704afce7ad68af9502dc01b5ba5a467708225c63870f6b5eeeece.json similarity index 83% rename from backend/.sqlx/query-4ca3a61ca8604f7bdf1088001281a4c7eef55ba3aa608135f42714b2358158ba.json rename to backend/.sqlx/query-d7fa934a55e704afce7ad68af9502dc01b5ba5a467708225c63870f6b5eeeece.json index a4ed101..5575bba 100644 --- a/backend/.sqlx/query-4ca3a61ca8604f7bdf1088001281a4c7eef55ba3aa608135f42714b2358158ba.json +++ b/backend/.sqlx/query-d7fa934a55e704afce7ad68af9502dc01b5ba5a467708225c63870f6b5eeeece.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n id,\n title,\n token,\n permissions as \"permissions: Json\",\n active,\n 0 as \"last_week_visits!\"\n FROM access_tokens\n WHERE token = $1\n ", + "query": "\n SELECT\n id,\n title,\n token,\n permissions AS \"permissions: Json\",\n active,\n 0 AS \"last_week_visits!\"\n FROM access_tokens\n WHERE token = $1\n ", "describe": { "columns": [ { @@ -48,5 +48,5 @@ null ] }, - "hash": "4ca3a61ca8604f7bdf1088001281a4c7eef55ba3aa608135f42714b2358158ba" + "hash": "d7fa934a55e704afce7ad68af9502dc01b5ba5a467708225c63870f6b5eeeece" } diff --git a/backend/.sqlx/query-7a87abadc4dbddc100efd70dce1e966dedd113a6b393de7e3ab0a8c7f8f47626.json b/backend/.sqlx/query-df114f7704654e85ae8a9433a91d1c4d3f603ec4992a6845c87b282bc870320e.json similarity index 91% rename from backend/.sqlx/query-7a87abadc4dbddc100efd70dce1e966dedd113a6b393de7e3ab0a8c7f8f47626.json rename to backend/.sqlx/query-df114f7704654e85ae8a9433a91d1c4d3f603ec4992a6845c87b282bc870320e.json index 8425b4f..6c8c6f1 100644 --- a/backend/.sqlx/query-7a87abadc4dbddc100efd70dce1e966dedd113a6b393de7e3ab0a8c7f8f47626.json +++ b/backend/.sqlx/query-df114f7704654e85ae8a9433a91d1c4d3f603ec4992a6845c87b282bc870320e.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT e.id, e.display_name, e.category_id, e.created_at, e.hidden,\n e.moderated, e.updated_at,\n COALESCE(\n (SELECT array_agg(t.tag_id) FROM entity_tags t WHERE t.entity_id = e.id), \n array[]::uuid[]\n ) as \"tags!\"\n FROM entities e\n INNER JOIN entities_entities ee ON e.id = ee.parent_id\n WHERE ee.child_id = $1\n ", + "query": "\n SELECT e.id, e.display_name, e.category_id, e.created_at, e.hidden,\n e.moderated, e.updated_at,\n COALESCE(\n (SELECT array_agg(t.tag_id) FROM entity_tags t WHERE t.entity_id = e.id), \n array[]::uuid[]\n ) AS \"tags!\"\n FROM entities e\n INNER JOIN entities_entities ee ON e.id = ee.parent_id\n WHERE ee.child_id = $1\n ", "describe": { "columns": [ { @@ -60,5 +60,5 @@ null ] }, - "hash": "7a87abadc4dbddc100efd70dce1e966dedd113a6b393de7e3ab0a8c7f8f47626" + "hash": "df114f7704654e85ae8a9433a91d1c4d3f603ec4992a6845c87b282bc870320e" } diff --git a/backend/.sqlx/query-089c120308f17da6ac502ce46c67049884c4055999900cbb6cce56ef990b8dd4.json b/backend/.sqlx/query-e92063f48832afff02878e598c3b59729ba8ff51fd774558cd26bf34e2957f1a.json similarity index 90% rename from backend/.sqlx/query-089c120308f17da6ac502ce46c67049884c4055999900cbb6cce56ef990b8dd4.json rename to backend/.sqlx/query-e92063f48832afff02878e598c3b59729ba8ff51fd774558cd26bf34e2957f1a.json index 744aa23..080b8bc 100644 --- a/backend/.sqlx/query-089c120308f17da6ac502ce46c67049884c4055999900cbb6cce56ef990b8dd4.json +++ b/backend/.sqlx/query-e92063f48832afff02878e598c3b59729ba8ff51fd774558cd26bf34e2957f1a.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n id,\n title,\n family_id,\n default_status,\n (SELECT hash FROM icons WHERE id = icon_id) as icon_hash,\n fill_color,\n border_color,\n version\n FROM categories\n WHERE id = $1\n ", + "query": "\n SELECT\n id,\n title,\n family_id,\n default_status,\n (SELECT hash FROM icons WHERE id = icon_id) AS icon_hash,\n fill_color,\n border_color,\n version\n FROM categories\n WHERE id = $1\n ", "describe": { "columns": [ { @@ -60,5 +60,5 @@ false ] }, - "hash": "089c120308f17da6ac502ce46c67049884c4055999900cbb6cce56ef990b8dd4" + "hash": "e92063f48832afff02878e598c3b59729ba8ff51fd774558cd26bf34e2957f1a" } diff --git a/backend/.sqlx/query-1ed734f901c3b77d912f4f2086fd7d44e3d7df859711d8417aae03ff98f6b1ce.json b/backend/.sqlx/query-fd9c4f718c8d31bf339faf83d4c5922b4f0a4a79dd6da1bc2728a93811b27e6e.json similarity index 90% rename from backend/.sqlx/query-1ed734f901c3b77d912f4f2086fd7d44e3d7df859711d8417aae03ff98f6b1ce.json rename to backend/.sqlx/query-fd9c4f718c8d31bf339faf83d4c5922b4f0a4a79dd6da1bc2728a93811b27e6e.json index b0a27af..0c14d17 100644 --- a/backend/.sqlx/query-1ed734f901c3b77d912f4f2086fd7d44e3d7df859711d8417aae03ff98f6b1ce.json +++ b/backend/.sqlx/query-fd9c4f718c8d31bf339faf83d4c5922b4f0a4a79dd6da1bc2728a93811b27e6e.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT c.id, c.entity_id, e.display_name as entity_display_name, e.category_id as entity_category_id, c.created_at,\n c.author, c.moderated, c.updated_at\n FROM comments c\n INNER JOIN entities e ON c.entity_id = e.id\n WHERE NOT c.moderated\n ORDER BY created_at\n ", + "query": "\n SELECT c.id, c.entity_id, e.display_name AS entity_display_name, e.category_id AS entity_category_id, c.created_at,\n c.author, c.moderated, c.updated_at\n FROM comments c\n INNER JOIN entities e ON c.entity_id = e.id\n WHERE NOT c.moderated\n ORDER BY created_at\n ", "describe": { "columns": [ { @@ -58,5 +58,5 @@ false ] }, - "hash": "1ed734f901c3b77d912f4f2086fd7d44e3d7df859711d8417aae03ff98f6b1ce" + "hash": "fd9c4f718c8d31bf339faf83d4c5922b4f0a4a79dd6da1bc2728a93811b27e6e" } diff --git a/backend/src/models/comment.rs b/backend/src/models/comment.rs index 2e3e5cf..ead7651 100644 --- a/backend/src/models/comment.rs +++ b/backend/src/models/comment.rs @@ -12,6 +12,7 @@ pub struct PublicNewComment { pub author: String, pub text: String, pub data: Value, + pub entity_category_id: Uuid, } #[derive(FromRow, Deserialize, Serialize, ToSchema, Debug)] @@ -45,7 +46,9 @@ impl PublicComment { conn: &mut PgConnection, ) -> Result { let family = Family::get_from_entity(comment.entity_id, conn).await?; - family.comment_form.validate_data(&comment.data)?; + family + .comment_form + .validate_data(&comment.data, comment.entity_category_id)?; sqlx::query_as!( PublicComment, @@ -105,7 +108,7 @@ pub struct AdminComment { pub moderated: bool, pub version: i32, pub entity_display_name: String, - pub category_id: Uuid, + pub entity_category_id: Uuid, } #[derive(FromRow, Deserialize, Serialize, ToSchema, Debug)] @@ -128,6 +131,7 @@ pub struct AdminNewOrUpdateComment { pub data: Value, pub moderated: bool, pub version: i32, + pub entity_category_id: Uuid, } impl AdminComment { @@ -136,7 +140,9 @@ impl AdminComment { conn: &mut PgConnection, ) -> Result { let family = Family::get_from_entity(new_comment.entity_id, conn).await?; - family.comment_form.validate_data(&new_comment.data)?; + family + .comment_form + .validate_data(&new_comment.data, new_comment.entity_category_id)?; sqlx::query_as!( AdminComment, @@ -147,7 +153,7 @@ impl AdminComment { RETURNING * ) SELECT i.id, i.entity_id, i.author, i.text, i.data, i.created_at, i.updated_at, i.moderated, i.version, - display_name as entity_display_name, category_id + display_name as entity_display_name, category_id as entity_category_id FROM inserted i JOIN entities e ON e.id = entity_id @@ -169,7 +175,9 @@ impl AdminComment { conn: &mut PgConnection, ) -> Result { let family = Family::get_from_entity(update.entity_id, conn).await?; - family.comment_form.validate_data(&update.data)?; + family + .comment_form + .validate_data(&update.data, update.entity_category_id)?; sqlx::query_as!( AdminComment, @@ -187,7 +195,7 @@ impl AdminComment { RETURNING * ) SELECT i.id, i.entity_id, i.author, i.text, i.data, i.created_at, i.updated_at, i.moderated, i.version, - e.display_name as entity_display_name, e.category_id + e.display_name as entity_display_name, e.category_id as entity_category_id FROM inserted i JOIN entities e ON e.id = entity_id @@ -210,7 +218,7 @@ impl AdminComment { AdminComment, r#" SELECT c.id, c.entity_id, c.author, c.text, c.data, c.created_at, c.updated_at, c.moderated, c.version, - e.display_name as entity_display_name, e.category_id + e.display_name as entity_display_name, e.category_id as entity_category_id FROM comments c JOIN entities e ON e.id = c.entity_id WHERE c.id = $1 @@ -245,7 +253,7 @@ impl AdminComment { AdminComment, r#" SELECT c.id, c.entity_id, c.author, c.text, c.data, c.created_at, c.updated_at, c.moderated, c.version, - e.display_name as entity_display_name, e.category_id + e.display_name as entity_display_name, e.category_id as entity_category_id FROM comments c JOIN entities e ON e.id = c.entity_id WHERE entity_id = $1 diff --git a/backend/src/models/entity.rs b/backend/src/models/entity.rs index 18f5145..5744978 100644 --- a/backend/src/models/entity.rs +++ b/backend/src/models/entity.rs @@ -74,7 +74,9 @@ impl PublicEntity { conn: &mut PgConnection, ) -> Result { let family = Family::get_from_category(entity.category_id, conn).await?; - family.entity_form.validate_data(&entity.data)?; + family + .entity_form + .validate_data(&entity.data, entity.category_id)?; let locations = to_value(entity.locations).unwrap(); @@ -246,7 +248,9 @@ impl AdminEntity { // Validate the new data against the form from the corresponding family let family = Family::get_from_category(new_entity.category_id, &mut tx).await?; - family.entity_form.validate_data(&new_entity.data)?; + family + .entity_form + .validate_data(&new_entity.data, new_entity.category_id)?; // Serialize locations to JSON let locations = to_value(new_entity.locations).unwrap(); @@ -327,7 +331,9 @@ impl AdminEntity { // Validate the new data against the form from the corresponding family let family = Family::get_from_category(update.category_id, &mut tx).await?; - family.entity_form.validate_data(&update.data)?; + family + .entity_form + .validate_data(&update.data, update.category_id)?; // Serialize locations to JSON let locations = to_value(update.locations).unwrap(); diff --git a/backend/src/models/family.rs b/backend/src/models/family.rs index ffd8ca4..e355918 100644 --- a/backend/src/models/family.rs +++ b/backend/src/models/family.rs @@ -44,7 +44,7 @@ pub struct Field { /// The type of the field pub field_type: FieldType, - /// Used to store detail about the field that relevent + /// Used to store detail about the field that relevant /// only for the frontend. For instance, if the field is an enum /// use it to store possible values. If it is a SingleLineText, specify /// if it's an email, a phone number, etc... @@ -55,7 +55,7 @@ pub struct Field { pub indexed: bool, /// Sets if the field is indexed, the field must be indexed for this setting to be used. - /// Privatly indexed means only administrators can constraint on this field. + /// Privately indexed means only administrators can constraint on this field. /// It only works for EnumSingleOption and EnumMultiOption pub privately_indexed: bool, @@ -73,6 +73,9 @@ pub struct Field { /// The weight of the field in the display (when displayed, ordered by weight) pub display_weight: u8, + + /// The categories this field is restricted to, if any + pub categories: Option>, } #[derive(Deserialize, Serialize, ToSchema, Debug)] @@ -118,9 +121,9 @@ impl Form { Ok(()) } - pub fn validate_data(&self, data: &Value) -> Result<(), AppError> { + pub fn validate_data(&self, data: &Value, entity_category: Uuid) -> Result<(), AppError> { for field in &self.fields { - field.validate_data(data.get(&field.key))?; + field.validate_data(data.get(&field.key), entity_category)?; } Ok(()) } @@ -141,9 +144,18 @@ impl Field { Ok(()) } - fn validate_data(&self, value: Option<&Value>) -> Result<(), AppError> { - let value = match value { - None if self.mandatory => { + fn validate_data( + &self, + field_value: Option<&Value>, + entity_category: Uuid, + ) -> Result<(), AppError> { + let field_required = self.mandatory + && self.categories.as_ref().map_or(true, |categories| { + categories.iter().any(|&c| c == entity_category) + }); + + let field_value = match field_value { + None if field_required => { return Err(AppError::Validation(format!( "Mandatory field {} is missing", self.key @@ -153,8 +165,8 @@ impl Field { Some(value) => value, }; - if value.is_null() { - if self.mandatory { + if field_value.is_null() { + if field_required { return Err(AppError::Validation(format!( "Mandatory field {} is missing", self.key @@ -166,11 +178,11 @@ impl Field { match &self.field_type { FieldType::SingleLineText | FieldType::MultiLineText | FieldType::RichText => { - let str_value = value.as_str().ok_or_else(|| { + let str_value = field_value.as_str().ok_or_else(|| { AppError::Validation(format!("Field {} is not a string", self.key)) })?; - if self.mandatory && str_value.is_empty() { + if field_required && str_value.is_empty() { return Err(AppError::Validation(format!( "Mandatory field {} is empty", self.key @@ -179,11 +191,11 @@ impl Field { } FieldType::Number | FieldType::DiscreteScore => { - let num_value = value.as_f64().ok_or_else(|| { + let num_value = field_value.as_f64().ok_or_else(|| { AppError::Validation(format!("Field {} is not a number", self.key)) })?; - if self.mandatory && num_value.is_nan() { + if field_required && num_value.is_nan() { return Err(AppError::Validation(format!( "Mandatory field {} is not a valid number", self.key @@ -192,17 +204,17 @@ impl Field { } FieldType::Boolean => { - value.as_bool().ok_or_else(|| { + field_value.as_bool().ok_or_else(|| { AppError::Validation(format!("Field {} is not a boolean", self.key)) })?; } FieldType::Date => { - let str_value = value.as_str().ok_or_else(|| { + let str_value = field_value.as_str().ok_or_else(|| { AppError::Validation(format!("Field {} is not a string", self.key)) })?; - if self.mandatory && str_value.is_empty() { + if field_required && str_value.is_empty() { return Err(AppError::Validation(format!( "Mandatory field {} is empty", self.key @@ -213,11 +225,11 @@ impl Field { } FieldType::EnumMultiOption | FieldType::EventList => { - let arr_value = value.as_array().ok_or_else(|| { + let arr_value = field_value.as_array().ok_or_else(|| { AppError::Validation(format!("Field {} is not an array", self.key)) })?; - if self.mandatory && arr_value.is_empty() { + if field_required && arr_value.is_empty() { return Err(AppError::Validation(format!( "Mandatory field {} is empty", self.key diff --git a/frontend/components/CommentsDisplayer.vue b/frontend/components/CommentsDisplayer.vue index 8a922d5..efa43f7 100644 --- a/frontend/components/CommentsDisplayer.vue +++ b/frontend/components/CommentsDisplayer.vue @@ -34,7 +34,8 @@ /> @@ -50,10 +51,12 @@ const props = defineProps<{ commentFormFields: FormField[] comments: PublicComment[] public: true + entityCategoryId: string } | { commentFormFields: FormField[] comments: AdminComment[] public: false + entityCategoryId: string }>() const emit = defineEmits<{ diff --git a/frontend/components/admin/families/EditForm.vue b/frontend/components/admin/families/EditForm.vue index db91fea..9199f88 100644 --- a/frontend/components/admin/families/EditForm.vue +++ b/frontend/components/admin/families/EditForm.vue @@ -149,6 +149,17 @@ value="!" /> + + +