properly generating clean urls with auto-guards
This commit is contained in:
parent
9ae95b4e93
commit
55a2ee1bfb
2 changed files with 5 additions and 8 deletions
|
@ -42,6 +42,7 @@ pub fn id_db_to_public(id: i32) -> String {
|
|||
|
||||
/// A cleaner way to handle on-the-fly in-URL parameter format validation for IDs
|
||||
/// TODO: check and remove all other usages
|
||||
#[derive(UriDisplayPath)]
|
||||
pub struct PublicId(pub i32);
|
||||
|
||||
impl<'a> FromParam<'a> for PublicId {
|
||||
|
@ -56,14 +57,6 @@ impl<'a> FromParam<'a> for PublicId {
|
|||
}
|
||||
}
|
||||
|
||||
impl<P: Part, 'a> FromUriParam<P, &'a str> for PublicId {
|
||||
type Target = PublicId;
|
||||
|
||||
fn from_uri_param(param: T) -> Self::Target {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<i32> for PublicId {
|
||||
fn into(self) -> i32 {
|
||||
self.0
|
||||
|
|
|
@ -157,6 +157,10 @@ pub async fn handle_in_page_forms(
|
|||
#[get("/tag-handover/<id>/<username>")]
|
||||
pub async fn show_confirm_tag_handover(id: PublicId, username: &str) -> &'static str {
|
||||
println!("woof id: {}, username: {}", id.0, username);
|
||||
println!(
|
||||
"woof generated url: {}",
|
||||
uri!("/admin", show_confirm_tag_handover(id, username))
|
||||
);
|
||||
|
||||
"blep"
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue