diff --git a/.sqlx/query-0eafc423ff404eadb5300ad47e5b81d5f3be1fb0c1723600b6f9bbe73b1e8155.json b/.sqlx/query-0eafc423ff404eadb5300ad47e5b81d5f3be1fb0c1723600b6f9bbe73b1e8155.json index ac97e06a..06245302 100644 --- a/.sqlx/query-0eafc423ff404eadb5300ad47e5b81d5f3be1fb0c1723600b6f9bbe73b1e8155.json +++ b/.sqlx/query-0eafc423ff404eadb5300ad47e5b81d5f3be1fb0c1723600b6f9bbe73b1e8155.json @@ -29,13 +29,20 @@ }, { "Custom": { - "name": "function", + "name": "function[]", "kind": { - "Enum": [ - "posten", - "fuehrungsassistent", - "wachhabender" - ] + "Array": { + "Custom": { + "name": "function", + "kind": { + "Enum": [ + "posten", + "fuehrungsassistent", + "wachhabender" + ] + } + } + } } } }, diff --git a/.sqlx/query-3338639844455180fdc70262cb982042ee2ff5cc8ab0fd6101bf5d4182f58530.json b/.sqlx/query-4da130f5ff77ea010db74c51e5dfc966aeae7ff1c4fa44395a0136bbd4a760c5.json similarity index 70% rename from .sqlx/query-3338639844455180fdc70262cb982042ee2ff5cc8ab0fd6101bf5d4182f58530.json rename to .sqlx/query-4da130f5ff77ea010db74c51e5dfc966aeae7ff1c4fa44395a0136bbd4a760c5.json index 70033735..695b41cd 100644 --- a/.sqlx/query-3338639844455180fdc70262cb982042ee2ff5cc8ab0fd6101bf5d4182f58530.json +++ b/.sqlx/query-4da130f5ff77ea010db74c51e5dfc966aeae7ff1c4fa44395a0136bbd4a760c5.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT id,\n name,\n email,\n password,\n salt,\n role AS \"role: Role\",\n function AS \"function: Function\",\n areaId,\n locked,\n lastLogin,\n receiveNotifications\n FROM user_\n WHERE id = $1;\n ", + "query": "\n SELECT id,\n name,\n email,\n password,\n salt,\n role AS \"role: Role\",\n function AS \"function: Functions\",\n areaId,\n locked,\n lastLogin,\n receiveNotifications\n FROM user_\n WHERE areaId = $1;\n ", "describe": { "columns": [ { @@ -46,16 +46,23 @@ }, { "ordinal": 6, - "name": "function: Function", + "name": "function: Functions", "type_info": { "Custom": { - "name": "function", + "name": "function[]", "kind": { - "Enum": [ - "posten", - "fuehrungsassistent", - "wachhabender" - ] + "Array": { + "Custom": { + "name": "function", + "kind": { + "Enum": [ + "posten", + "fuehrungsassistent", + "wachhabender" + ] + } + } + } } } } @@ -100,5 +107,5 @@ false ] }, - "hash": "3338639844455180fdc70262cb982042ee2ff5cc8ab0fd6101bf5d4182f58530" + "hash": "4da130f5ff77ea010db74c51e5dfc966aeae7ff1c4fa44395a0136bbd4a760c5" } diff --git a/.sqlx/query-d3705fa03f98a5b83c65e29fe98d8c6015dfbff58460b420b9634bf2a0e38e4e.json b/.sqlx/query-6adecc71eae15d0ef809e16cfedf42ab8ec9c1e0c7eb423c0eee5be56f6ddf26.json similarity index 72% rename from .sqlx/query-d3705fa03f98a5b83c65e29fe98d8c6015dfbff58460b420b9634bf2a0e38e4e.json rename to .sqlx/query-6adecc71eae15d0ef809e16cfedf42ab8ec9c1e0c7eb423c0eee5be56f6ddf26.json index 61c01bee..20bba8b9 100644 --- a/.sqlx/query-d3705fa03f98a5b83c65e29fe98d8c6015dfbff58460b420b9634bf2a0e38e4e.json +++ b/.sqlx/query-6adecc71eae15d0ef809e16cfedf42ab8ec9c1e0c7eb423c0eee5be56f6ddf26.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n availabillity.id,\n availabillity.userId,\n availabillity.date,\n availabillity.startTime,\n availabillity.endTime,\n availabillity.comment,\n user_.name,\n user_.email,\n user_.password,\n user_.salt,\n user_.role AS \"role: Role\",\n user_.function AS \"function: Function\",\n user_.areaId,\n user_.locked,\n user_.lastLogin,\n user_.receiveNotifications,\n area.name AS areaName\n FROM availabillity\n JOIN user_ ON availabillity.userId = user_.id\n JOIN area ON user_.areaId = area.id\n WHERE user_.areaId = $1 AND\n availabillity.date >= $2 AND\n availabillity.date <= $3;\n ", + "query": "\n SELECT\n availabillity.id,\n availabillity.userId,\n availabillity.date,\n availabillity.startTime,\n availabillity.endTime,\n availabillity.comment,\n user_.name,\n user_.email,\n user_.password,\n user_.salt,\n user_.role AS \"role: Role\",\n user_.function AS \"function: Functions\",\n user_.areaId,\n user_.locked,\n user_.lastLogin,\n user_.receiveNotifications,\n area.name AS areaName\n FROM availabillity\n JOIN user_ ON availabillity.userId = user_.id\n JOIN area ON user_.areaId = area.id\n WHERE user_.areaId = $1 AND\n availabillity.date >= $2 AND\n availabillity.date <= $3;\n ", "describe": { "columns": [ { @@ -71,16 +71,23 @@ }, { "ordinal": 11, - "name": "function: Function", + "name": "function: Functions", "type_info": { "Custom": { - "name": "function", + "name": "function[]", "kind": { - "Enum": [ - "posten", - "fuehrungsassistent", - "wachhabender" - ] + "Array": { + "Custom": { + "name": "function", + "kind": { + "Enum": [ + "posten", + "fuehrungsassistent", + "wachhabender" + ] + } + } + } } } } @@ -138,5 +145,5 @@ false ] }, - "hash": "d3705fa03f98a5b83c65e29fe98d8c6015dfbff58460b420b9634bf2a0e38e4e" + "hash": "6adecc71eae15d0ef809e16cfedf42ab8ec9c1e0c7eb423c0eee5be56f6ddf26" } diff --git a/.sqlx/query-a1288bdb944dc72d5591d8686f533d124d9edacaf62539f7908c797efe44a68d.json b/.sqlx/query-a2ff81071585a31385044f022553dc1e5f81fd3727f47825991adcfae5546324.json similarity index 75% rename from .sqlx/query-a1288bdb944dc72d5591d8686f533d124d9edacaf62539f7908c797efe44a68d.json rename to .sqlx/query-a2ff81071585a31385044f022553dc1e5f81fd3727f47825991adcfae5546324.json index 0df87467..c9c1ba5f 100644 --- a/.sqlx/query-a1288bdb944dc72d5591d8686f533d124d9edacaf62539f7908c797efe44a68d.json +++ b/.sqlx/query-a2ff81071585a31385044f022553dc1e5f81fd3727f47825991adcfae5546324.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n availabillity.id,\n availabillity.userId,\n availabillity.date,\n availabillity.startTime,\n availabillity.endTime,\n availabillity.comment,\n user_.name,\n user_.email,\n user_.password,\n user_.salt,\n user_.role AS \"role: Role\",\n user_.function AS \"function: Function\",\n user_.areaId,\n user_.locked,\n user_.lastLogin,\n user_.receiveNotifications\n FROM availabillity\n JOIN user_ ON availabillity.userId = user_.id\n WHERE availabillity.date = $1\n AND user_.areaId = $2;\n ", + "query": "\n SELECT\n availabillity.id,\n availabillity.userId,\n availabillity.date,\n availabillity.startTime,\n availabillity.endTime,\n availabillity.comment,\n user_.name,\n user_.email,\n user_.password,\n user_.salt,\n user_.role AS \"role: Role\",\n user_.function AS \"function: Functions\",\n user_.areaId,\n user_.locked,\n user_.lastLogin,\n user_.receiveNotifications\n FROM availabillity\n JOIN user_ ON availabillity.userId = user_.id\n WHERE availabillity.date = $1\n AND user_.areaId = $2;\n ", "describe": { "columns": [ { @@ -71,16 +71,23 @@ }, { "ordinal": 11, - "name": "function: Function", + "name": "function: Functions", "type_info": { "Custom": { - "name": "function", + "name": "function[]", "kind": { - "Enum": [ - "posten", - "fuehrungsassistent", - "wachhabender" - ] + "Array": { + "Custom": { + "name": "function", + "kind": { + "Enum": [ + "posten", + "fuehrungsassistent", + "wachhabender" + ] + } + } + } } } } @@ -131,5 +138,5 @@ false ] }, - "hash": "a1288bdb944dc72d5591d8686f533d124d9edacaf62539f7908c797efe44a68d" + "hash": "a2ff81071585a31385044f022553dc1e5f81fd3727f47825991adcfae5546324" } diff --git a/.sqlx/query-1d5bf64843b684258fcce0e606ea01a2037890ac736b7344e0008eae2b2a7ef6.json b/.sqlx/query-aa60c8e32c6c226f0b2f9161fd27bc9bf986cb7a69a7f5449c10a1b5642d9360.json similarity index 71% rename from .sqlx/query-1d5bf64843b684258fcce0e606ea01a2037890ac736b7344e0008eae2b2a7ef6.json rename to .sqlx/query-aa60c8e32c6c226f0b2f9161fd27bc9bf986cb7a69a7f5449c10a1b5642d9360.json index 4f6b5395..7015383d 100644 --- a/.sqlx/query-1d5bf64843b684258fcce0e606ea01a2037890ac736b7344e0008eae2b2a7ef6.json +++ b/.sqlx/query-aa60c8e32c6c226f0b2f9161fd27bc9bf986cb7a69a7f5449c10a1b5642d9360.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT id,\n name,\n email,\n password,\n salt,\n role AS \"role: Role\",\n function AS \"function: Function\",\n areaId,\n locked,\n lastLogin,\n receiveNotifications\n FROM user_;\n ", + "query": "\n SELECT id,\n name,\n email,\n password,\n salt,\n role AS \"role: Role\",\n function AS \"function: Functions\",\n areaId,\n locked,\n lastLogin,\n receiveNotifications\n FROM user_;\n ", "describe": { "columns": [ { @@ -46,16 +46,23 @@ }, { "ordinal": 6, - "name": "function: Function", + "name": "function: Functions", "type_info": { "Custom": { - "name": "function", + "name": "function[]", "kind": { - "Enum": [ - "posten", - "fuehrungsassistent", - "wachhabender" - ] + "Array": { + "Custom": { + "name": "function", + "kind": { + "Enum": [ + "posten", + "fuehrungsassistent", + "wachhabender" + ] + } + } + } } } } @@ -98,5 +105,5 @@ false ] }, - "hash": "1d5bf64843b684258fcce0e606ea01a2037890ac736b7344e0008eae2b2a7ef6" + "hash": "aa60c8e32c6c226f0b2f9161fd27bc9bf986cb7a69a7f5449c10a1b5642d9360" } diff --git a/.sqlx/query-82a9b85a96c255c1bc0728ac6d3b4debcbbe0dbdf4b75e585d8e0f44fbd7a982.json b/.sqlx/query-abcd0f243fc7b93ea20c4dbd3c9b18ada4dc45893dd2f8f25873cb6819ee986e.json similarity index 70% rename from .sqlx/query-82a9b85a96c255c1bc0728ac6d3b4debcbbe0dbdf4b75e585d8e0f44fbd7a982.json rename to .sqlx/query-abcd0f243fc7b93ea20c4dbd3c9b18ada4dc45893dd2f8f25873cb6819ee986e.json index 53630be1..146ec0e6 100644 --- a/.sqlx/query-82a9b85a96c255c1bc0728ac6d3b4debcbbe0dbdf4b75e585d8e0f44fbd7a982.json +++ b/.sqlx/query-abcd0f243fc7b93ea20c4dbd3c9b18ada4dc45893dd2f8f25873cb6819ee986e.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT id,\n name,\n email,\n password,\n salt,\n role AS \"role: Role\",\n function AS \"function: Function\",\n areaId,\n locked,\n lastLogin,\n receiveNotifications\n FROM user_\n WHERE areaId = $1;\n ", + "query": "\n SELECT id,\n name,\n email,\n password,\n salt,\n role AS \"role: Role\",\n function AS \"function: Functions\",\n areaId,\n locked,\n lastLogin,\n receiveNotifications\n FROM user_\n WHERE id = $1;\n ", "describe": { "columns": [ { @@ -46,16 +46,23 @@ }, { "ordinal": 6, - "name": "function: Function", + "name": "function: Functions", "type_info": { "Custom": { - "name": "function", + "name": "function[]", "kind": { - "Enum": [ - "posten", - "fuehrungsassistent", - "wachhabender" - ] + "Array": { + "Custom": { + "name": "function", + "kind": { + "Enum": [ + "posten", + "fuehrungsassistent", + "wachhabender" + ] + } + } + } } } } @@ -100,5 +107,5 @@ false ] }, - "hash": "82a9b85a96c255c1bc0728ac6d3b4debcbbe0dbdf4b75e585d8e0f44fbd7a982" + "hash": "abcd0f243fc7b93ea20c4dbd3c9b18ada4dc45893dd2f8f25873cb6819ee986e" } diff --git a/.sqlx/query-ad4419211e4c98292eaa47ab04e0ea0201f1789ac906acc8cf79aacfbecd9f05.json b/.sqlx/query-ad4419211e4c98292eaa47ab04e0ea0201f1789ac906acc8cf79aacfbecd9f05.json index 28b73aee..097b0306 100644 --- a/.sqlx/query-ad4419211e4c98292eaa47ab04e0ea0201f1789ac906acc8cf79aacfbecd9f05.json +++ b/.sqlx/query-ad4419211e4c98292eaa47ab04e0ea0201f1789ac906acc8cf79aacfbecd9f05.json @@ -27,13 +27,20 @@ }, { "Custom": { - "name": "function", + "name": "function[]", "kind": { - "Enum": [ - "posten", - "fuehrungsassistent", - "wachhabender" - ] + "Array": { + "Custom": { + "name": "function", + "kind": { + "Enum": [ + "posten", + "fuehrungsassistent", + "wachhabender" + ] + } + } + } } } }, diff --git a/.sqlx/query-f48192661c91b4f48bb46f8ea5d60911ddeafc408d3a897dd4ab1b45fe06dd4d.json b/.sqlx/query-b06a1cfc8ba53c2f95ed5b74e9b6d73e723750b3679e2dbe970ed03e01886c90.json similarity index 74% rename from .sqlx/query-f48192661c91b4f48bb46f8ea5d60911ddeafc408d3a897dd4ab1b45fe06dd4d.json rename to .sqlx/query-b06a1cfc8ba53c2f95ed5b74e9b6d73e723750b3679e2dbe970ed03e01886c90.json index f7d95d66..a8d73121 100644 --- a/.sqlx/query-f48192661c91b4f48bb46f8ea5d60911ddeafc408d3a897dd4ab1b45fe06dd4d.json +++ b/.sqlx/query-b06a1cfc8ba53c2f95ed5b74e9b6d73e723750b3679e2dbe970ed03e01886c90.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n availabillity.id,\n availabillity.userId,\n availabillity.date,\n availabillity.startTime,\n availabillity.endTime,\n availabillity.comment,\n user_.name,\n user_.email,\n user_.password,\n user_.salt,\n user_.role AS \"role: Role\",\n user_.function AS \"function: Function\",\n user_.areaId,\n user_.locked,\n user_.lastLogin,\n user_.receiveNotifications\n FROM availabillity\n LEFT JOIN assignment ON availabillity.Id = assignment.availabillityId\n JOIN user_ ON availabillity.userId = user_.id\n WHERE availabillity.id = $1;\n ", + "query": "\n SELECT\n availabillity.id,\n availabillity.userId,\n availabillity.date,\n availabillity.startTime,\n availabillity.endTime,\n availabillity.comment,\n user_.name,\n user_.email,\n user_.password,\n user_.salt,\n user_.role AS \"role: Role\",\n user_.function AS \"function: Functions\",\n user_.areaId,\n user_.locked,\n user_.lastLogin,\n user_.receiveNotifications\n FROM availabillity\n LEFT JOIN assignment ON availabillity.Id = assignment.availabillityId\n JOIN user_ ON availabillity.userId = user_.id\n WHERE availabillity.id = $1;\n ", "describe": { "columns": [ { @@ -71,16 +71,23 @@ }, { "ordinal": 11, - "name": "function: Function", + "name": "function: Functions", "type_info": { "Custom": { - "name": "function", + "name": "function[]", "kind": { - "Enum": [ - "posten", - "fuehrungsassistent", - "wachhabender" - ] + "Array": { + "Custom": { + "name": "function", + "kind": { + "Enum": [ + "posten", + "fuehrungsassistent", + "wachhabender" + ] + } + } + } } } } @@ -130,5 +137,5 @@ false ] }, - "hash": "f48192661c91b4f48bb46f8ea5d60911ddeafc408d3a897dd4ab1b45fe06dd4d" + "hash": "b06a1cfc8ba53c2f95ed5b74e9b6d73e723750b3679e2dbe970ed03e01886c90" } diff --git a/.sqlx/query-2defbc675e894d30483e057d78344490b06c3cd5b3b3ab474ef755b67d4b6ea0.json b/.sqlx/query-cd25453504b28008dbe82aa89e8d942ad500b61beb640d2af9030872de069fb6.json similarity index 70% rename from .sqlx/query-2defbc675e894d30483e057d78344490b06c3cd5b3b3ab474ef755b67d4b6ea0.json rename to .sqlx/query-cd25453504b28008dbe82aa89e8d942ad500b61beb640d2af9030872de069fb6.json index 8f40eec1..30489124 100644 --- a/.sqlx/query-2defbc675e894d30483e057d78344490b06c3cd5b3b3ab474ef755b67d4b6ea0.json +++ b/.sqlx/query-cd25453504b28008dbe82aa89e8d942ad500b61beb640d2af9030872de069fb6.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n user_.id AS userId,\n user_.name,\n user_.email,\n user_.password,\n user_.salt,\n user_.role AS \"role: Role\",\n user_.function AS \"function: Function\",\n user_.areaId,\n user_.locked,\n user_.lastLogin,\n user_.receiveNotifications,\n area.id,\n area.name AS areaName\n FROM user_\n JOIN area ON user_.areaId = area.id\n ", + "query": "\n SELECT\n user_.id AS userId,\n user_.name,\n user_.email,\n user_.password,\n user_.salt,\n user_.role AS \"role: Role\",\n function AS \"function: Functions\",\n user_.areaId,\n user_.locked,\n user_.lastLogin,\n user_.receiveNotifications,\n area.id,\n area.name AS areaName\n FROM user_\n JOIN area ON user_.areaId = area.id\n ", "describe": { "columns": [ { @@ -46,16 +46,23 @@ }, { "ordinal": 6, - "name": "function: Function", + "name": "function: Functions", "type_info": { "Custom": { - "name": "function", + "name": "function[]", "kind": { - "Enum": [ - "posten", - "fuehrungsassistent", - "wachhabender" - ] + "Array": { + "Custom": { + "name": "function", + "kind": { + "Enum": [ + "posten", + "fuehrungsassistent", + "wachhabender" + ] + } + } + } } } } @@ -110,5 +117,5 @@ false ] }, - "hash": "2defbc675e894d30483e057d78344490b06c3cd5b3b3ab474ef755b67d4b6ea0" + "hash": "cd25453504b28008dbe82aa89e8d942ad500b61beb640d2af9030872de069fb6" } diff --git a/.sqlx/query-76bf18e05733214925ddd0cbe090a69f839c140377f043ca8181cd9a0af5e70e.json b/.sqlx/query-db1a44c82fca70aa0a0530a07b75bd2a596a16deb60ca89fedb26c8ad89dbdce.json similarity index 68% rename from .sqlx/query-76bf18e05733214925ddd0cbe090a69f839c140377f043ca8181cd9a0af5e70e.json rename to .sqlx/query-db1a44c82fca70aa0a0530a07b75bd2a596a16deb60ca89fedb26c8ad89dbdce.json index 95cf51a2..e28c5d93 100644 --- a/.sqlx/query-76bf18e05733214925ddd0cbe090a69f839c140377f043ca8181cd9a0af5e70e.json +++ b/.sqlx/query-db1a44c82fca70aa0a0530a07b75bd2a596a16deb60ca89fedb26c8ad89dbdce.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT id,\n name,\n email,\n password,\n salt,\n role AS \"role: Role\",\n function AS \"function: Function\",\n areaId,\n locked,\n lastLogin,\n receiveNotifications\n FROM user_\n WHERE email = $1 AND locked = FALSE AND password IS NOT NULL AND salt IS NOT NULL;\n ", + "query": "\n SELECT id,\n name,\n email,\n password,\n salt,\n role AS \"role: Role\",\n function AS \"function: Functions\",\n areaId,\n locked,\n lastLogin,\n receiveNotifications\n FROM user_\n WHERE email = $1 AND locked = FALSE AND password IS NOT NULL AND salt IS NOT NULL;\n ", "describe": { "columns": [ { @@ -46,16 +46,23 @@ }, { "ordinal": 6, - "name": "function: Function", + "name": "function: Functions", "type_info": { "Custom": { - "name": "function", + "name": "function[]", "kind": { - "Enum": [ - "posten", - "fuehrungsassistent", - "wachhabender" - ] + "Array": { + "Custom": { + "name": "function", + "kind": { + "Enum": [ + "posten", + "fuehrungsassistent", + "wachhabender" + ] + } + } + } } } } @@ -100,5 +107,5 @@ false ] }, - "hash": "76bf18e05733214925ddd0cbe090a69f839c140377f043ca8181cd9a0af5e70e" + "hash": "db1a44c82fca70aa0a0530a07b75bd2a596a16deb60ca89fedb26c8ad89dbdce" } diff --git a/.sqlx/query-e5c0fdebea352e78f5d34fd0774f8802090ce15f811d1b2506ff8bc12fe8fad9.json b/.sqlx/query-efe07f8477c7416eae9c0b433cf24b7dc8abf38ce56c0ad46039a5bbbdd6865b.json similarity index 71% rename from .sqlx/query-e5c0fdebea352e78f5d34fd0774f8802090ce15f811d1b2506ff8bc12fe8fad9.json rename to .sqlx/query-efe07f8477c7416eae9c0b433cf24b7dc8abf38ce56c0ad46039a5bbbdd6865b.json index 964cab1b..c3cf9d5b 100644 --- a/.sqlx/query-e5c0fdebea352e78f5d34fd0774f8802090ce15f811d1b2506ff8bc12fe8fad9.json +++ b/.sqlx/query-efe07f8477c7416eae9c0b433cf24b7dc8abf38ce56c0ad46039a5bbbdd6865b.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n availabillity.id,\n availabillity.userId,\n availabillity.date,\n availabillity.startTime,\n availabillity.endTime,\n availabillity.comment,\n user_.name,\n user_.email,\n user_.password,\n user_.salt,\n user_.role AS \"role: Role\",\n user_.function AS \"function: Function\",\n user_.areaId,\n user_.locked,\n user_.lastLogin,\n user_.receiveNotifications\n FROM availabillity\n JOIN user_ ON availabillity.userId = user_.id\n WHERE availabillity.date = $1\n AND user_.areaId = $2\n AND ((availabillity.startTime IS NULL AND availabillity.endTime IS NULL)\n OR (availabillity.startTime <= $3 AND availabillity.endTime >= $4));\n ", + "query": "\n SELECT\n availabillity.id,\n availabillity.userId,\n availabillity.date,\n availabillity.startTime,\n availabillity.endTime,\n availabillity.comment,\n user_.name,\n user_.email,\n user_.password,\n user_.salt,\n user_.role AS \"role: Role\",\n user_.function AS \"function: Functions\",\n user_.areaId,\n user_.locked,\n user_.lastLogin,\n user_.receiveNotifications\n FROM availabillity\n JOIN user_ ON availabillity.userId = user_.id\n WHERE availabillity.date = $1\n AND user_.areaId = $2\n AND ((availabillity.startTime IS NULL AND availabillity.endTime IS NULL)\n OR (availabillity.startTime <= $3 AND availabillity.endTime >= $4));\n ", "describe": { "columns": [ { @@ -71,16 +71,23 @@ }, { "ordinal": 11, - "name": "function: Function", + "name": "function: Functions", "type_info": { "Custom": { - "name": "function", + "name": "function[]", "kind": { - "Enum": [ - "posten", - "fuehrungsassistent", - "wachhabender" - ] + "Array": { + "Custom": { + "name": "function", + "kind": { + "Enum": [ + "posten", + "fuehrungsassistent", + "wachhabender" + ] + } + } + } } } } @@ -133,5 +140,5 @@ false ] }, - "hash": "e5c0fdebea352e78f5d34fd0774f8802090ce15f811d1b2506ff8bc12fe8fad9" + "hash": "efe07f8477c7416eae9c0b433cf24b7dc8abf38ce56c0ad46039a5bbbdd6865b" } diff --git a/.sqlx/query-fd2f782d28612d969aa20eb35ea8da4bfdba6f059dbd45b510122210807ac5b6.json b/.sqlx/query-fd2f782d28612d969aa20eb35ea8da4bfdba6f059dbd45b510122210807ac5b6.json index 175e32f6..8010fe0a 100644 --- a/.sqlx/query-fd2f782d28612d969aa20eb35ea8da4bfdba6f059dbd45b510122210807ac5b6.json +++ b/.sqlx/query-fd2f782d28612d969aa20eb35ea8da4bfdba6f059dbd45b510122210807ac5b6.json @@ -21,13 +21,20 @@ }, { "Custom": { - "name": "function", + "name": "function[]", "kind": { - "Enum": [ - "posten", - "fuehrungsassistent", - "wachhabender" - ] + "Array": { + "Custom": { + "name": "function", + "kind": { + "Enum": [ + "posten", + "fuehrungsassistent", + "wachhabender" + ] + } + } + } } } }, diff --git a/migrations/20230609121618_initial.sql b/migrations/20230609121618_initial.sql index d0f79f34..b8333b41 100644 --- a/migrations/20230609121618_initial.sql +++ b/migrations/20230609121618_initial.sql @@ -24,7 +24,7 @@ CREATE TABLE user_ password TEXT , salt TEXT , role role NOT NULL, - function function NOT NULL, + function function ARRAY NOT NULL, areaId INTEGER NOT NULL REFERENCES area (id) ON DELETE CASCADE, locked BOOLEAN NOT NULL DEFAULT false, lastLogin TIMESTAMP WITH TIME ZONE, diff --git a/web/src/endpoints/area/delete.rs b/web/src/endpoints/area/delete.rs index 3b04952e..6976fb39 100644 --- a/web/src/endpoints/area/delete.rs +++ b/web/src/endpoints/area/delete.rs @@ -48,7 +48,7 @@ mod tests { let config = RequestConfig { uri: "/area/delete/2".to_string(), role: Role::Admin, - function: Function::Posten, + function: vec![Function::Posten], user_area: 1, }; let response = test_delete(&context.db_pool, app, &config).await; @@ -75,7 +75,7 @@ mod tests { let config = RequestConfig { uri: "/area/delete/2".to_string(), role: Role::Admin, - function: Function::Posten, + function: vec![Function::Posten], user_area: 1, }; let response = test_delete(&context.db_pool, app, &config).await; @@ -97,7 +97,7 @@ mod tests { let config = RequestConfig { uri: "/area/delete/2".to_string(), role: Role::Admin, - function: Function::Posten, + function: vec![Function::Posten], user_area: 1, }; let response = test_delete(&context.db_pool, app, &config).await; diff --git a/web/src/endpoints/area/get_edit.rs b/web/src/endpoints/area/get_edit.rs index fa0bc7d2..34b2c614 100644 --- a/web/src/endpoints/area/get_edit.rs +++ b/web/src/endpoints/area/get_edit.rs @@ -46,7 +46,7 @@ mod tests { let config = RequestConfig { uri: "/area/edit/1".to_string(), role: Role::Admin, - function: Function::Posten, + function: vec![Function::Posten], user_area: 1, }; let response = test_get(&context.db_pool, app, &config).await; @@ -64,7 +64,7 @@ mod tests { let config = RequestConfig { uri: "/area/edit/1".to_string(), role: Role::AreaManager, - function: Function::Posten, + function: vec![Function::Posten], user_area: 1, }; let response = test_get(&context.db_pool, app, &config).await; @@ -79,7 +79,7 @@ mod tests { let config = RequestConfig { uri: "/area/edit/2".to_string(), role: Role::Admin, - function: Function::Posten, + function: vec![Function::Posten], user_area: 1, }; let response = test_get(&context.db_pool, app, &config).await; diff --git a/web/src/endpoints/area/get_new.rs b/web/src/endpoints/area/get_new.rs index 1d6d7670..a19bf3da 100644 --- a/web/src/endpoints/area/get_new.rs +++ b/web/src/endpoints/area/get_new.rs @@ -35,7 +35,7 @@ mod tests { let config = RequestConfig { uri: "/area/new".to_string(), role: Role::Admin, - function: Function::Posten, + function: vec![Function::Posten], user_area: 1, }; let response = test_get(&context.db_pool, app, &config).await; @@ -53,7 +53,7 @@ mod tests { let config = RequestConfig { uri: "/area/new".to_string(), role: Role::AreaManager, - function: Function::Posten, + function: vec![Function::Posten], user_area: 1, }; let response = test_get(&context.db_pool, app, &config).await; diff --git a/web/src/endpoints/area/post_edit.rs b/web/src/endpoints/area/post_edit.rs index 95b7312c..9c8dc9df 100644 --- a/web/src/endpoints/area/post_edit.rs +++ b/web/src/endpoints/area/post_edit.rs @@ -50,7 +50,7 @@ mod tests { let config = RequestConfig { uri: "/area/edit/1".to_string(), role: Role::Admin, - function: Function::Posten, + function: vec![Function::Posten], user_area: 1, }; @@ -77,7 +77,7 @@ mod tests { let config = RequestConfig { uri: "/area/edit/1".to_string(), role: Role::AreaManager, - function: Function::Posten, + function: vec![Function::Posten], user_area: 1, }; @@ -97,7 +97,7 @@ mod tests { let config = RequestConfig { uri: "/area/edit/2".to_string(), role: Role::Admin, - function: Function::Posten, + function: vec![Function::Posten], user_area: 1, }; diff --git a/web/src/endpoints/area/post_new.rs b/web/src/endpoints/area/post_new.rs index 7e9170b0..7e59f357 100644 --- a/web/src/endpoints/area/post_new.rs +++ b/web/src/endpoints/area/post_new.rs @@ -43,7 +43,7 @@ mod tests { let config = RequestConfig { uri: "/area/new".to_string(), role: Role::Admin, - function: Function::Posten, + function: vec![Function::Posten], user_area: 1, }; @@ -70,7 +70,7 @@ mod tests { let config = RequestConfig { uri: "/area/new".to_string(), role: Role::AreaManager, - function: Function::Posten, + function: vec![Function::Posten], user_area: 1, }; diff --git a/web/src/endpoints/assignment/mod.rs b/web/src/endpoints/assignment/mod.rs index 1ecfffe0..4f4c09bc 100644 --- a/web/src/endpoints/assignment/mod.rs +++ b/web/src/endpoints/assignment/mod.rs @@ -2,7 +2,7 @@ use rinja::Template; use crate::{ filters, - models::{Availability, AvailabilityTime, AvailabillityAssignmentState, Event, Function}, + models::{Availability, AvailabilityTime, AvailabillityAssignmentState, Event}, }; pub mod delete; diff --git a/web/src/endpoints/assignment/post_new.rs b/web/src/endpoints/assignment/post_new.rs index 72c87c7b..6d127a9e 100644 --- a/web/src/endpoints/assignment/post_new.rs +++ b/web/src/endpoints/assignment/post_new.rs @@ -70,7 +70,7 @@ pub async fn post( let context = AssignmentContext { event: event.clone(), availabillity: availabillity.clone(), - user_function: availabillity.user.as_ref().unwrap().function, + user_function: availabillity.user.as_ref().unwrap().function.clone(), assignments_for_event, assignments_for_availabillity, }; diff --git a/web/src/endpoints/events/get_edit.rs b/web/src/endpoints/events/get_edit.rs index 62f64bb3..f967c834 100644 --- a/web/src/endpoints/events/get_edit.rs +++ b/web/src/endpoints/events/get_edit.rs @@ -106,7 +106,7 @@ async fn produces_template(context: &DbTestContext) { let config = RequestConfig { uri: "/events/1/edit".to_string(), role: Role::Admin, - function: crate::models::Function::Posten, + function: vec![crate::models::Function::Posten], user_area: 1, }; let response = test_get(&context.db_pool, app, &config).await; diff --git a/web/src/endpoints/events/get_plan.rs b/web/src/endpoints/events/get_plan.rs index 7514a5cb..db69b53e 100644 --- a/web/src/endpoints/events/get_plan.rs +++ b/web/src/endpoints/events/get_plan.rs @@ -5,7 +5,7 @@ use sqlx::PgPool; use crate::{ endpoints::IdPath, filters, - models::{Availability, AvailabilityTime, AvailabillityAssignmentState, Event, Function, Role, User, Vehicle}, + models::{Availability, AvailabilityTime, AvailabillityAssignmentState, Event, Role, User, Vehicle}, utils::{ event_planning_template::{ generate_availabillity_assignment_list, generate_status_whether_staff_is_required, diff --git a/web/src/endpoints/export/get_availability_data.rs b/web/src/endpoints/export/get_availability_data.rs index 5d19e7a1..9eb6b911 100644 --- a/web/src/endpoints/export/get_availability_data.rs +++ b/web/src/endpoints/export/get_availability_data.rs @@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize}; use sqlx::PgPool; use crate::{ - models::{Area, Availability, AvailabilityTime, Function, Role, User}, + models::{Area, Availability, AvailabilityTime, Functions, Role, User}, utils::ApplicationError, END_OF_DAY, START_OF_DAY, }; @@ -33,7 +33,7 @@ struct Export { struct ExportAvailabillity { name: String, area: String, - function: Function, + function: Functions, date: NaiveDate, whole_day: bool, start_time: NaiveTime, diff --git a/web/src/endpoints/location/post_new.rs b/web/src/endpoints/location/post_new.rs index f4d71a41..01c6909b 100644 --- a/web/src/endpoints/location/post_new.rs +++ b/web/src/endpoints/location/post_new.rs @@ -41,7 +41,7 @@ async fn works_when_user_is_admin(context: &DbTestContext) { let config = RequestConfig { uri: "/locations/new".to_string(), role: Role::Admin, - function: crate::models::Function::Posten, + function: vec![crate::models::Function::Posten], user_area: 1, }; @@ -69,7 +69,7 @@ async fn uses_area_id_of_area_manager(context: &DbTestContext) { let config = RequestConfig { uri: "/locations/new".to_string(), role: Role::AreaManager, - function: crate::models::Function::Posten, + function: vec![crate::models::Function::Posten], user_area: 1, }; diff --git a/web/src/endpoints/user/get_edit.rs b/web/src/endpoints/user/get_edit.rs index 2492db4c..a2bb12f9 100644 --- a/web/src/endpoints/user/get_edit.rs +++ b/web/src/endpoints/user/get_edit.rs @@ -28,15 +28,17 @@ pub async fn get_edit( }; let template = NewOrEditUserTemplate { - user: user.into_inner(), - id: Some(user_in_db.id), - areas, - email: Some(user_in_db.email), - name: Some(user_in_db.name), - role: Some(user_in_db.role as u8), - function: Some(user_in_db.function as u8), - area_id: Some(user_in_db.area_id), - }; + user: user.into_inner(), + id: Some(user_in_db.id), + areas, + email: Some(user_in_db.email), + name: Some(user_in_db.name), + role: Some(user_in_db.role as u8), + is_posten: Some(user_in_db.function.is_posten()), + is_wachhabender: Some(user_in_db.function.is_wachhabender()), + is_fuehrungsassistent: Some(user_in_db.function.is_fuehrungsassistent()), + area_id: Some(user_in_db.area_id), + }; Ok(template.to_response()?) } diff --git a/web/src/endpoints/user/get_new.rs b/web/src/endpoints/user/get_new.rs index 349a3e1d..5cd9bda3 100644 --- a/web/src/endpoints/user/get_new.rs +++ b/web/src/endpoints/user/get_new.rs @@ -25,7 +25,9 @@ pub async fn get_new( email: None, name: None, role: None, - function: None, + is_posten: None, + is_wachhabender: None, + is_fuehrungsassistent: None, area_id: None, }; diff --git a/web/src/endpoints/user/get_overview.rs b/web/src/endpoints/user/get_overview.rs index 621e0799..cde5ac11 100644 --- a/web/src/endpoints/user/get_overview.rs +++ b/web/src/endpoints/user/get_overview.rs @@ -1,5 +1,6 @@ use crate::{ - models::{Area, Function, Role, User}, + filters, + models::{Area, Role, User}, utils::{ApplicationError, TemplateResponse}, }; diff --git a/web/src/endpoints/user/mod.rs b/web/src/endpoints/user/mod.rs index 2a13f996..feab61d6 100644 --- a/web/src/endpoints/user/mod.rs +++ b/web/src/endpoints/user/mod.rs @@ -39,7 +39,9 @@ pub struct NewOrEditUserTemplate { email: Option, name: Option, role: Option, - function: Option, + is_posten: Option, + is_wachhabender: Option, + is_fuehrungsassistent: Option, area_id: Option, } diff --git a/web/src/endpoints/user/post_edit.rs b/web/src/endpoints/user/post_edit.rs index a80b5651..961ceaad 100644 --- a/web/src/endpoints/user/post_edit.rs +++ b/web/src/endpoints/user/post_edit.rs @@ -87,7 +87,7 @@ mod tests { let config = RequestConfig { uri: "/users/edit/1".to_string(), role: Role::Admin, - function: Function::Posten, + function: vec![Function::Posten], user_area: 1, }; @@ -113,7 +113,7 @@ mod tests { assert_eq!(new_name, updated_user.name); assert_eq!(new_mail, updated_user.email); assert_eq!(Role::AreaManager, updated_user.role); - assert_eq!(Function::Fuehrungsassistent, updated_user.function); + assert!(updated_user.function.is_fuehrungsassistent()); assert_eq!(2, updated_user.area_id); } @@ -123,7 +123,7 @@ mod tests { let config = RequestConfig { uri: "/users/edit/1".to_string(), role: Role::Admin, - function: Function::Posten, + function: vec![Function::Posten], user_area: 1, }; diff --git a/web/src/filters.rs b/web/src/filters.rs index 4c41b1d7..d8cfac4a 100644 --- a/web/src/filters.rs +++ b/web/src/filters.rs @@ -1,6 +1,6 @@ use maud::html; -use crate::models::Function; +use crate::models::Functions; pub fn show_area_query(a: &Option, first: bool) -> rinja::Result { let char = if first { '?' } else { '&' }; @@ -40,15 +40,17 @@ pub fn invert(b: &bool) -> rinja::Result { Ok(!b) } -pub fn show_tree(f: &Function) -> rinja::Result { +pub fn show_tree(f: &Functions) -> rinja::Result { let html = html! { div class="tags" { - span class="tag is-primary is-light" { "Posten"} - @if *f == Function::Fuehrungsassistent || *f == Function::Wachhabender { - span class="tag is-primary has-background-primary-85 has-text-primary-85-invert" { "Führungsassistent"} + @if f.is_posten() { + span class="tag is-primary is-light" { "Posten"} } - @if *f == Function::Wachhabender { - span class="tag is-primary" { "Wachhabender"} + @if f.is_wachhabender() { + span class="tag is-primary has-background-primary-85 has-text-primary-85-invert" { "Wachhabender"} + } + @if f.is_fuehrungsassistent() { + span class="tag is-primary" { "Führungsassistent"} } } }; diff --git a/web/src/models/assignment_changeset.rs b/web/src/models/assignment_changeset.rs index a22fca2e..cdbc5235 100644 --- a/web/src/models/assignment_changeset.rs +++ b/web/src/models/assignment_changeset.rs @@ -2,7 +2,7 @@ use chrono::NaiveTime; use garde::Validate; use super::{ - start_time_lies_before_end_time, Assignment, Availability, AvailabilityTime, Event, Function, + start_time_lies_before_end_time, Assignment, Availability, AvailabilityTime, Event, Function, Functions, }; #[derive(Validate)] @@ -26,7 +26,7 @@ pub struct AssignmentChangeset { pub struct AssignmentContext { pub event: Event, pub availabillity: Availability, - pub user_function: Function, + pub user_function: Functions, pub assignments_for_event: Vec, pub assignments_for_availabillity: Vec, } @@ -50,7 +50,7 @@ fn user_of_availability_has_function( value: &Function, context: &AssignmentContext, ) -> garde::Result { - if *value > context.user_function { + if !context.user_function.contains(value) { return Err(garde::Error::new( "user has not the required function for this assignment", )); @@ -60,7 +60,7 @@ fn user_of_availability_has_function( } fn event_has_free_slot_for_function( - _value: &Function, + value: &Function, context: &AssignmentContext, ) -> garde::Result { let list: Vec<&Assignment> = context @@ -75,7 +75,7 @@ fn event_has_free_slot_for_function( .iter() .filter(|a| a.function == Function::Posten) .count(); - if match context.user_function { + if match *value { Function::Posten => a >= context.event.amount_of_posten as usize, Function::Fuehrungsassistent => context.event.voluntary_fuehrungsassistent && a >= 1, Function::Wachhabender => context.event.voluntary_wachhabender && a >= 1, diff --git a/web/src/models/availabillity.rs b/web/src/models/availabillity.rs index 4589862a..174b8c10 100644 --- a/web/src/models/availabillity.rs +++ b/web/src/models/availabillity.rs @@ -3,7 +3,7 @@ use sqlx::{query, PgPool}; use crate::{END_OF_DAY, START_OF_DAY}; -use super::{Area, AvailabilityChangeset, Function, Result, Role, User}; +use super::{Area, AvailabilityChangeset, Functions, Result, Role, User}; #[derive(Clone, Debug)] pub struct Availability { @@ -87,7 +87,7 @@ impl Availability { user_.password, user_.salt, user_.role AS "role: Role", - user_.function AS "function: Function", + user_.function AS "function: Functions", user_.areaId, user_.locked, user_.lastLogin, @@ -115,7 +115,7 @@ impl Availability { password: r.password.clone(), salt: r.salt.clone(), role: r.role, - function: r.function, + function: r.function.clone(), area_id: r.areaid, area: None, locked: r.locked, @@ -154,7 +154,7 @@ impl Availability { user_.password, user_.salt, user_.role AS "role: Role", - user_.function AS "function: Function", + user_.function AS "function: Functions", user_.areaId, user_.locked, user_.lastLogin, @@ -186,7 +186,7 @@ impl Availability { password: r.password.clone(), salt: r.salt.clone(), role: r.role, - function: r.function, + function: r.function.clone(), area_id: r.areaid, area: None, locked: r.locked, @@ -220,7 +220,7 @@ impl Availability { user_.password, user_.salt, user_.role AS "role: Role", - user_.function AS "function: Function", + user_.function AS "function: Functions", user_.areaId, user_.locked, user_.lastLogin, @@ -245,7 +245,7 @@ impl Availability { password: r.password.clone(), salt: r.salt.clone(), role: r.role, - function: r.function, + function: r.function.clone(), area_id: r.areaid, area: None, locked: r.locked, @@ -302,7 +302,7 @@ impl Availability { user_.password, user_.salt, user_.role AS "role: Role", - user_.function AS "function: Function", + user_.function AS "function: Functions", user_.areaId, user_.locked, user_.lastLogin, @@ -334,7 +334,7 @@ impl Availability { password: r.password.clone(), salt: r.salt.clone(), role: r.role, - function: r.function, + function: r.function.clone(), area_id: r.areaid, area: Some(Area { id: r.areaid, diff --git a/web/src/models/function.rs b/web/src/models/function.rs index 8d3c9e7d..ce7d8c69 100644 --- a/web/src/models/function.rs +++ b/web/src/models/function.rs @@ -1,6 +1,7 @@ use std::fmt::Display; use serde::Serialize; +use sqlx::postgres::{PgHasArrayType, PgTypeInfo}; use crate::utils::ApplicationError; @@ -12,6 +13,54 @@ pub enum Function { Wachhabender = 10, } +#[derive(sqlx::Type, Debug, Clone, PartialEq, Eq, Serialize, PartialOrd, Ord)] +#[sqlx(no_pg_array)] +pub struct Functions(Vec); + +//impl sqlx::Type for Functions { +// fn type_info() -> sqlx::postgres::PgTypeInfo { +// // Array type name is the name of the element type prefixed with `_` +// sqlx::postgres::PgTypeInfo::with_name("_functions") +// } +//} + +impl PgHasArrayType for Functions { + fn array_type_info() -> PgTypeInfo { + PgTypeInfo::with_name("function[]") + } +} + +impl Display for Functions { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let mut iterator = self.0.iter().peekable(); + while let Some(p) = iterator.next() { + write!(f, "{}", p.to_string()); + if iterator.peek().is_some() { + write!(f, ", "); + } + } + todo!() + } +} + +impl Functions { + pub fn contains(&self, f: &Function) -> bool { + self.0.contains(f) + } + + pub fn is_posten(&self) -> bool { + self.0.contains(&Function::Posten) + } + + pub fn is_fuehrungsassistent(&self) -> bool { + self.0.contains(&Function::Fuehrungsassistent) + } + + pub fn is_wachhabender(&self) -> bool { + self.0.contains(&Function::Wachhabender) + } +} + impl Display for Function { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { diff --git a/web/src/models/mod.rs b/web/src/models/mod.rs index 46c81ecf..3f14b17b 100644 --- a/web/src/models/mod.rs +++ b/web/src/models/mod.rs @@ -28,7 +28,7 @@ pub use availabillity_assignment_state::AvailabillityAssignmentState; use chrono::NaiveTime; pub use event::Event; pub use event_changeset::{EventChangeset, EventContext}; -pub use function::Function; +pub use function::{Function, Functions}; pub use location::Location; pub use password_reset::{NoneToken, PasswordReset, Token}; pub use registration::Registration; diff --git a/web/src/models/user.rs b/web/src/models/user.rs index ad46e148..43732e9b 100644 --- a/web/src/models/user.rs +++ b/web/src/models/user.rs @@ -1,7 +1,7 @@ use chrono::{DateTime, Utc}; use sqlx::PgPool; -use super::{Area, Function, Result, Role, UserChangeset}; +use super::{function::Functions, Area, Function, Result, Role, UserChangeset}; #[derive(Clone, Debug)] pub struct User { @@ -11,7 +11,7 @@ pub struct User { pub password: Option, pub salt: Option, pub role: Role, - pub function: Function, + pub function: Functions, pub area_id: i32, pub area: Option, pub locked: bool, @@ -45,7 +45,7 @@ impl User { password: &str, salt: &str, role: Role, - function: Function, + function: &[Function], area_id: i32, ) -> Result { sqlx::query!( @@ -59,7 +59,7 @@ impl User { password, salt, role as Role, - function as Function, + function as &[Function], area_id ) .fetch_one(pool) @@ -76,7 +76,7 @@ impl User { password, salt, role AS "role: Role", - function AS "function: Function", + function AS "function: Functions", areaId, locked, lastLogin, @@ -116,7 +116,7 @@ impl User { password, salt, role AS "role: Role", - function AS "function: Function", + function AS "function: Functions", areaId, locked, lastLogin, @@ -156,7 +156,7 @@ impl User { password, salt, role AS "role: Role", - function AS "function: Function", + function AS "function: Functions", areaId, locked, lastLogin, @@ -176,7 +176,7 @@ impl User { password: record.password.clone(), salt: record.salt.clone(), role: record.role, - function: record.function, + function: record.function.clone(), area_id: record.areaid, area: None, locked: record.locked, @@ -198,7 +198,7 @@ impl User { user_.password, user_.salt, user_.role AS "role: Role", - user_.function AS "function: Function", + function AS "function: Functions", user_.areaId, user_.locked, user_.lastLogin, @@ -221,7 +221,7 @@ impl User { password: record.password.clone(), salt: record.salt.clone(), role: record.role, - function: record.function, + function: record.function.clone(), area_id: record.areaid, area: Some(Area { id: record.areaid, @@ -245,7 +245,7 @@ impl User { password, salt, role AS "role: Role", - function AS "function: Function", + function AS "function: Functions", areaId, locked, lastLogin, @@ -267,7 +267,7 @@ impl User { password: record.password.clone(), salt: record.salt.clone(), role: record.role, - function: record.function, + function: record.function.clone(), area_id: record.areaid, area: None, locked: record.locked, diff --git a/web/src/utils/manage_commands.rs b/web/src/utils/manage_commands.rs index 5aeec4cb..3e01a659 100644 --- a/web/src/utils/manage_commands.rs +++ b/web/src/utils/manage_commands.rs @@ -90,7 +90,7 @@ pub async fn handle_command( &hash, &salt, Role::Admin, - Function::Wachhabender, + &[Function::Posten, Function::Wachhabender, Function::Fuehrungsassistent], 1, ) .await?; diff --git a/web/src/utils/test_helper/test_requests.rs b/web/src/utils/test_helper/test_requests.rs index d54766a6..edcab4a9 100644 --- a/web/src/utils/test_helper/test_requests.rs +++ b/web/src/utils/test_helper/test_requests.rs @@ -16,7 +16,7 @@ use sqlx::{Pool, Postgres}; pub struct RequestConfig { pub uri: String, pub role: Role, - pub function: Function, + pub function: Vec, pub user_area: i32, } @@ -25,7 +25,7 @@ impl RequestConfig { Self { uri: uri.to_string(), role: Role::Staff, - function: Function::Posten, + function: vec![Function::Posten], user_area: 1, } } @@ -50,7 +50,7 @@ where &HASH, &SALT, config.role, - config.function, + &config.function, config.user_area, ) .await diff --git a/web/templates/events/plan_personal_table.html b/web/templates/events/plan_personal_table.html index e305371d..d3f08695 100644 --- a/web/templates/events/plan_personal_table.html +++ b/web/templates/events/plan_personal_table.html @@ -71,13 +71,13 @@ hx-post="/assignments/new?event={{ event.id }}&availabillity={{ availabillity.id }}&function=1" {% if !further_posten_required || status !=AvailabillityAssignmentState::Unassigned|ref %}disabled{% endif %}> als Posten planen - {% if u.function == Function::Wachhabender || u.function == Function::Fuehrungsassistent %} + {% if u.function.is_fuehrungsassistent() %} als Führungsassistent planen {% endif %} - {% if u.function == Function::Wachhabender %} + {% if u.function.is_fuehrungsassistent() %}
diff --git a/web/templates/user/overview.html b/web/templates/user/overview.html index f01c16fd..bf435e10 100644 --- a/web/templates/user/overview.html +++ b/web/templates/user/overview.html @@ -56,15 +56,7 @@ {% endmatch %} - {% match u.function %} - {% when Function::Posten %} - Posten - {% when Function::Fuehrungsassistent %} - Führungsassistent - {% when Function::Wachhabender %} - Wachhabender - {% else %} - {% endmatch %} + {{ u.function|show_tree|safe }} {% if user.role == Role::Admin %}