feat(corp/rih): add UUIDs to records from frontend
This UUID stays the same even if a user submits the form multiple times (unless they edit it manually in local storage, of course). Change-Id: I4190fbfeb1027ce8a8d87bc283099539e8722b39 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8733 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
This commit is contained in:
parent
d925ec34cd
commit
a970de3365
4 changed files with 22 additions and 2 deletions
|
@ -94,7 +94,7 @@ resource "yandex_serverless_container" "rih_backend" {
|
||||||
service_account_id = yandex_iam_service_account.rih_backend.id
|
service_account_id = yandex_iam_service_account.rih_backend.id
|
||||||
|
|
||||||
image {
|
image {
|
||||||
url = "cr.yandex/crpkcq65tn6bhq6puq2o/rih-backend:a4sdm3gn9l41xv3lyr5642mpd9m0fdhg"
|
url = "cr.yandex/crpkcq65tn6bhq6puq2o/rih-backend:9cwnx8jvwjw2ckpqg970p4y7cf74z28j"
|
||||||
}
|
}
|
||||||
|
|
||||||
secrets {
|
secrets {
|
||||||
|
|
11
corp/rih/frontend/Cargo.lock
generated
11
corp/rih/frontend/Cargo.lock
generated
|
@ -1092,6 +1092,7 @@ dependencies = [
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_urlencoded",
|
"serde_urlencoded",
|
||||||
"static_markdown",
|
"static_markdown",
|
||||||
|
"uuid",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"wasm-bindgen-futures",
|
"wasm-bindgen-futures",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
|
@ -1465,6 +1466,16 @@ version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "uuid"
|
||||||
|
version = "1.3.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "345444e32442451b267fc254ae85a209c64be56d2890e601a0c37ff0c3c5ecd2"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "version_check"
|
name = "version_check"
|
||||||
version = "0.9.4"
|
version = "0.9.4"
|
||||||
|
|
|
@ -20,6 +20,7 @@ wasm-bindgen-futures = "0.4"
|
||||||
|
|
||||||
# needs to be in sync with nixpkgs
|
# needs to be in sync with nixpkgs
|
||||||
wasm-bindgen = "= 0.2.84"
|
wasm-bindgen = "= 0.2.84"
|
||||||
|
uuid = { version = "1.3.3", features = ["v4", "serde"] }
|
||||||
|
|
||||||
[dependencies.serde]
|
[dependencies.serde]
|
||||||
version = "*" # pinned by yew
|
version = "*" # pinned by yew
|
||||||
|
|
|
@ -10,6 +10,7 @@ use rand::thread_rng;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use static_markdown::markdown;
|
use static_markdown::markdown;
|
||||||
use std::collections::BTreeSet;
|
use std::collections::BTreeSet;
|
||||||
|
use uuid::Uuid;
|
||||||
use wasm_bindgen::closure::Closure;
|
use wasm_bindgen::closure::Closure;
|
||||||
use wasm_bindgen::{JsCast, JsValue};
|
use wasm_bindgen::{JsCast, JsValue};
|
||||||
use web_sys::{HtmlInputElement, HtmlTextAreaElement, KeyboardEvent};
|
use web_sys::{HtmlInputElement, HtmlTextAreaElement, KeyboardEvent};
|
||||||
|
@ -94,6 +95,9 @@ enum Route {
|
||||||
/// primary data structure we want to populate and persist somewhere.
|
/// primary data structure we want to populate and persist somewhere.
|
||||||
#[derive(Clone, Default, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Default, Debug, Deserialize, Serialize)]
|
||||||
struct Record {
|
struct Record {
|
||||||
|
// Record-specific metadata
|
||||||
|
uuid: Uuid,
|
||||||
|
|
||||||
// Personal information
|
// Personal information
|
||||||
name: String,
|
name: String,
|
||||||
email: String,
|
email: String,
|
||||||
|
@ -362,7 +366,11 @@ impl Component for App {
|
||||||
|
|
||||||
fn create(ctx: &Context<Self>) -> Self {
|
fn create(ctx: &Context<Self>) -> Self {
|
||||||
App {
|
App {
|
||||||
record: LocalStorage::get("record").unwrap_or_default(),
|
record: LocalStorage::get("record").unwrap_or_else(|_| {
|
||||||
|
let mut new_record = Record::default();
|
||||||
|
new_record.uuid = Uuid::new_v4();
|
||||||
|
new_record
|
||||||
|
}),
|
||||||
citizenship_focus: false,
|
citizenship_focus: false,
|
||||||
citizenship_query: String::default(),
|
citizenship_query: String::default(),
|
||||||
history: BrowserHistory::default(),
|
history: BrowserHistory::default(),
|
||||||
|
|
Loading…
Reference in a new issue