Implement template student portal #62

Merged
BobdaFett merged 21 commits from feat/value-display into main 2026-03-02 21:38:31 +00:00
3 changed files with 39 additions and 1 deletions
Showing only changes of commit 5cafc7e757 - Show all commits

No files matched your search

+10 -1
View File
@@ -102,6 +102,10 @@ pub fn FileDrop(
upload_files.run(files); upload_files.run(files);
}; };
// let on_click_file_delete = move |file_name, form_id| {
//
// };
view! { view! {
<label <label
node_ref=zone_ref node_ref=zone_ref
@@ -126,7 +130,12 @@ pub fn FileDrop(
/> />
</label> </label>
<For each=move || file_name_list.get() key=|file| file.clone() let:file> <For each=move || file_name_list.get() key=|file| file.clone() let:file>
<div>"File name: "{file}</div> <div class="flex flex-row relative">
<div>{file}</div>
<div class="text-gray-400 hover:text-red-700">
<Icon icon=icondata::FaTrashCanRegular />
</div>
</div>
</For> </For>
} }
} }
+26
View File
@@ -57,3 +57,29 @@ pub async fn upload_file(
.map(|_| ()) .map(|_| ())
.map_err(ServerFnError::from) .map_err(ServerFnError::from)
} }
#[server]
pub async fn delete_file(
access_token: String,
form_id: String,
file_name: String
) -> Result<(), ServerFnError> {
use crate::utils::server::create_aws_config;
use crate::pages::api::tokens::validate_and_get_token_info;
let user_claims = validate_and_get_token_info(access_token).await?;
let subject = user_claims.subject;
let key = format!("{form_id}/{subject}/{file_name}");
let client = aws_sdk_s3::Client::new(&create_aws_config().await);
client
.delete_object()
.bucket("leptos-scholarhips")
.key(key)
.send()
.await
.map(|_| ())
.map_err(ServerFnError::from)
}
+3
View File
@@ -28,3 +28,6 @@ pub static PROVIDER_CONTACT_TABLE: &str = "leptos-provider-contacts";
#[cfg(feature = "ssr")] #[cfg(feature = "ssr")]
pub static MAIN_TABLE_NAME: &str = "scholarships-main"; pub static MAIN_TABLE_NAME: &str = "scholarships-main";
#[cfg(feature = "ssr")]
pub static S3_BUCKET_NAME: &str = "leptos-scholarships";