Compare commits
2
Commits
4fc1c2eeb8
...
12c618f8dd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12c618f8dd | ||
|
|
92fdb87cf0 |
@@ -5,6 +5,6 @@ CREATE TABLE IF NOT EXISTS tickets (
|
|||||||
description TEXT,
|
description TEXT,
|
||||||
room SMALLINT,
|
room SMALLINT,
|
||||||
status VARCHAR(15) NOT NULL DEFAULT 'ToDo',
|
status VARCHAR(15) NOT NULL DEFAULT 'ToDo',
|
||||||
date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
date TIMESTAMP WITH TIME ZONE DEFAULT now(),
|
||||||
user_id SMALLINT DEFAULT 1
|
user_id SMALLINT DEFAULT 1
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,7 +2,10 @@ CREATE TABLE users (
|
|||||||
id SMALLINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
id SMALLINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||||
last_name VARCHAR(30),
|
last_name VARCHAR(30),
|
||||||
first_name VARCHAR(30),
|
first_name VARCHAR(30),
|
||||||
username VARCHAR(30),
|
username VARCHAR(30) UNIQUE,
|
||||||
pwd TEXT,
|
pwd TEXT,
|
||||||
is_admin BOOLEAN NOT NULL DEFAULT false
|
is_admin BOOLEAN NOT NULL DEFAULT false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
INSERT INTO users(last_name, first_name, username, pwd, is_admin) VALUES ('Raffauf', 'Silas', 'raffaufsil',
|
||||||
|
'$argon2id$v=19$m=19456,t=2,p=1$urV91vY49mehWQoShkm6pw$1AGLuMDuFnY1CKuQU9ed89s1u9kvuszQjX+eIXmCBKI', true);
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ pub async fn get_users(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_user_by_id(
|
pub async fn get_user_by_id(
|
||||||
Path(id): Path<i32>,
|
Path(id): Path<i16>,
|
||||||
State(data): State<Arc<AppState>>,
|
State(data): State<Arc<AppState>>,
|
||||||
) -> Result<impl IntoResponse, (StatusCode, Json<serde_json::Value>)> {
|
) -> Result<impl IntoResponse, (StatusCode, Json<serde_json::Value>)> {
|
||||||
let query = sqlx::query_as::<_, User>(r#"SELECT * FROM users WHERE id = $1"#)
|
let query = sqlx::query_as::<_, User>(r#"SELECT * FROM users WHERE id = $1"#)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ pub struct Ticket {
|
|||||||
pub description: String,
|
pub description: String,
|
||||||
pub room: i16,
|
pub room: i16,
|
||||||
pub status: String,
|
pub status: String,
|
||||||
pub date: chrono::NaiveDateTime,
|
pub date: chrono::DateTime<chrono::Utc>,
|
||||||
pub user_id: i16,
|
pub user_id: i16,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ pub struct TicketResponse {
|
|||||||
pub description: String,
|
pub description: String,
|
||||||
pub room: i16,
|
pub room: i16,
|
||||||
pub status: String,
|
pub status: String,
|
||||||
pub date: chrono::NaiveDateTime,
|
pub date: chrono::DateTime<chrono::Utc>,
|
||||||
pub user_id: i16,
|
pub user_id: i16,
|
||||||
pub user_first_name: String,
|
pub user_first_name: String,
|
||||||
pub user_last_name: String,
|
pub user_last_name: String,
|
||||||
|
|||||||
Generated
+35
@@ -68,6 +68,16 @@ dependencies = [
|
|||||||
"windows-link",
|
"windows-link",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "chrono-tz"
|
||||||
|
version = "0.10.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a6139a8597ed92cf816dfb33f5dd6cf0bb93a6adc938f11039f371bc5bcd26c3"
|
||||||
|
dependencies = [
|
||||||
|
"chrono",
|
||||||
|
"phf",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "console_error_panic_hook"
|
name = "console_error_panic_hook"
|
||||||
version = "0.1.7"
|
version = "0.1.7"
|
||||||
@@ -116,6 +126,7 @@ name = "frontend"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
|
"chrono-tz",
|
||||||
"gloo 0.12.0",
|
"gloo 0.12.0",
|
||||||
"gloo-net 0.7.0",
|
"gloo-net 0.7.0",
|
||||||
"serde",
|
"serde",
|
||||||
@@ -735,6 +746,24 @@ version = "2.3.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
|
checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "phf"
|
||||||
|
version = "0.12.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "913273894cec178f401a31ec4b656318d95473527be05c0752cc41cdc32be8b7"
|
||||||
|
dependencies = [
|
||||||
|
"phf_shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "phf_shared"
|
||||||
|
version = "0.12.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "06005508882fb681fd97892ecff4b7fd0fee13ef1aa569f8695dae7ab9099981"
|
||||||
|
dependencies = [
|
||||||
|
"siphasher",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pin-project"
|
name = "pin-project"
|
||||||
version = "1.1.11"
|
version = "1.1.11"
|
||||||
@@ -933,6 +962,12 @@ version = "1.3.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "siphasher"
|
||||||
|
version = "1.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "slab"
|
name = "slab"
|
||||||
version = "0.4.12"
|
version = "0.4.12"
|
||||||
|
|||||||
@@ -24,3 +24,4 @@ yew-router = "0.20.0"
|
|||||||
serde_json = "1.0.149"
|
serde_json = "1.0.149"
|
||||||
gloo = "0.12.0"
|
gloo = "0.12.0"
|
||||||
chrono = { version = "0.4.44", features = ["serde"] }
|
chrono = { version = "0.4.44", features = ["serde"] }
|
||||||
|
chrono-tz = "0.10.4"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
use chrono_tz::Europe::Berlin;
|
||||||
use gloo_net::http::Request;
|
use gloo_net::http::Request;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use wasm_bindgen::JsCast;
|
use wasm_bindgen::JsCast;
|
||||||
@@ -26,7 +27,7 @@ pub struct Ticket {
|
|||||||
pub description: String,
|
pub description: String,
|
||||||
pub room: i16,
|
pub room: i16,
|
||||||
pub status: String,
|
pub status: String,
|
||||||
pub date: chrono::NaiveDateTime,
|
pub date: chrono::DateTime<chrono::Utc>,
|
||||||
pub user_id: i16,
|
pub user_id: i16,
|
||||||
pub user_first_name: String,
|
pub user_first_name: String,
|
||||||
pub user_last_name: String,
|
pub user_last_name: String,
|
||||||
@@ -310,7 +311,9 @@ pub fn ticket_by_id_component(props: &TicketProps) -> Html {
|
|||||||
<p><strong>{ "Betreff: " }</strong>{ &t.betreff }</p>
|
<p><strong>{ "Betreff: " }</strong>{ &t.betreff }</p>
|
||||||
<p><strong>{ "Beschreibung: " }</strong>{ &t.description }</p>
|
<p><strong>{ "Beschreibung: " }</strong>{ &t.description }</p>
|
||||||
<p><strong>{ "Raum: " }</strong>{ t.room }</p>
|
<p><strong>{ "Raum: " }</strong>{ t.room }</p>
|
||||||
<p><strong>{ "Datum: " }</strong>{ &t.date }</p>
|
<p><strong>{ "Datum: " }</strong>{
|
||||||
|
t.date.with_timezone(&Berlin).format("%d.%m.%Y %H:%M:%S").to_string()
|
||||||
|
}</p>
|
||||||
<p><strong>{ "Status: "}</strong>{ match t.status.as_str() {
|
<p><strong>{ "Status: "}</strong>{ match t.status.as_str() {
|
||||||
"ToDo" => "Zu tun",
|
"ToDo" => "Zu tun",
|
||||||
"InProgress" => "In Bearbeitung",
|
"InProgress" => "In Bearbeitung",
|
||||||
|
|||||||
Reference in New Issue
Block a user