From e508e0a916c08bd45a6ae94ce19aa66aa7e4996f Mon Sep 17 00:00:00 2001 From: Lucas Vas Date: Mon, 19 Jan 2026 12:44:51 -0500 Subject: [PATCH 1/4] chore: change to production tables This should be handled by environment variables in the future. --- src/main.rs | 4 ++++ src/pages/api/comparisons.rs | 2 +- src/pages/api/dates.rs | 7 +++++-- src/pages/api/scholarships.rs | 19 +++++++++---------- src/pages/scholarship_info.rs | 3 +-- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2900ec5..f24da6d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,7 @@ +use axum::extract::State; +use axum::routing::post; +use leptos_axum::handle_server_fns_with_context; + #[cfg(feature = "ssr")] #[tokio::main] async fn main() { diff --git a/src/pages/api/comparisons.rs b/src/pages/api/comparisons.rs index 9177955..1022b1c 100644 --- a/src/pages/api/comparisons.rs +++ b/src/pages/api/comparisons.rs @@ -16,7 +16,7 @@ use leptos::prelude::ServerFnError; use leptos::server; #[cfg(feature = "ssr")] -static COMPARISONS_TABLE: &str = "leptos-comparison-test"; +static COMPARISONS_TABLE: &str = "leptos-comparisons"; /// Helper function to create all sports comparisons. Only used to create initial /// comparison data, and should be removed upon completion of a comparison editor page. diff --git a/src/pages/api/dates.rs b/src/pages/api/dates.rs index 12d5cdf..ee3a6a7 100644 --- a/src/pages/api/dates.rs +++ b/src/pages/api/dates.rs @@ -12,13 +12,16 @@ use aws_sdk_dynamodb::{ Client as DynamoClient }; +#[cfg(feature = "ssr")] +use crate::utils::server::create_dynamo_client; + #[cfg(feature = "ssr")] use std::sync::Arc; #[server] pub async fn create_dates(dates: Vec) -> Result<(), ServerFnError> { // Serialize and put dates into the database. - let client = expect_context::>(); + let client = create_dynamo_client().await; log!("Creating dates: {:?}", dates); @@ -51,7 +54,7 @@ pub async fn create_dates(dates: Vec) -> Result<(), ServerFnError> { #[server] pub async fn get_important_dates() -> Result, ServerFnError> { - let client = expect_context::>(); + let client = create_dynamo_client().await; client .scan() diff --git a/src/pages/api/scholarships.rs b/src/pages/api/scholarships.rs index 6a8b345..5101af6 100644 --- a/src/pages/api/scholarships.rs +++ b/src/pages/api/scholarships.rs @@ -18,9 +18,9 @@ use leptos::prelude::ServerFnError; use leptos::server; #[cfg(feature = "ssr")] -static SCHOLARSHIPS_TABLE: &str = "leptos-scholarship-test"; +static SCHOLARSHIPS_TABLE: &str = "leptos-scholarships"; -#[server(GetScholarshipInfo, endpoint = "/scholarship/info/get")] +#[server(GetScholarshipInfo)] pub async fn get_scholarship_info(id: String) -> Result { let client = create_dynamo_client().await; @@ -50,7 +50,7 @@ pub async fn get_scholarship_info(id: String) -> Result Result<(), ServerFnError> { use aws_sdk_dynamodb::error::ProvideErrorMetadata; @@ -73,7 +73,7 @@ pub async fn create_scholarship_info(info: ExpandableInfo) -> Result<(), ServerF } } -#[server(GetAllScholarshipInfo, endpoint = "/scholarship/info/get-all")] +#[server(GetAllScholarshipInfo)] pub async fn get_all_scholarship_info() -> Result, ServerFnError> { let client = create_dynamo_client().await; log!("Getting all scholarship info"); @@ -98,7 +98,7 @@ pub async fn get_all_scholarship_info() -> Result, ServerFnE } /// Gets all scholarships that are associated with the given scholarship provider's ID. -#[server(GetProviderScholarships, "/providers/scholarships/get")] +#[server(GetProviderScholarships)] pub async fn get_provider_scholarships(provider_id: String) -> Result, ServerFnError> { let client = create_dynamo_client().await; @@ -127,16 +127,15 @@ pub async fn get_provider_scholarships(provider_id: String) -> Result Result { +#[server(RegisterScholarship)] +pub async fn register_scholarship(provider_id: String) -> Result { let client = create_dynamo_client().await; log!("Creating scholarship for provider with ID {:?}", provider_id); - let mut current_uuid = "testing".to_string(); + let mut current_uuid = Uuid::new_v4().to_string(); let mut item = ExpandableInfo::new(current_uuid.clone()); item.data.insert("provider_id".to_string(), ValueType::String(Some(provider_id))); - item.data.insert("scholarship_name".to_string(), ValueType::String(Some(scholarship_name))); loop { let ser_item = serde_dynamo::to_item(&item)?; match client @@ -172,7 +171,7 @@ pub async fn register_scholarship(provider_id: String, scholarship_name: String) } /// Deletes a provider's scholarship given their provider ID and scholarship ID. -#[server(DeleteProviderScholarship, "/providers/scholarships/delete")] +#[server(DeleteProviderScholarship)] pub async fn delete_provider_scholarship(provider_id: String, scholarship_id: String) -> Result<(), ServerFnError> { let client = create_dynamo_client().await; diff --git a/src/pages/scholarship_info.rs b/src/pages/scholarship_info.rs index df793b4..7d561a4 100644 --- a/src/pages/scholarship_info.rs +++ b/src/pages/scholarship_info.rs @@ -128,8 +128,7 @@ fn ScholarshipList( // Button handlers let create_on_click = move |_| { create_action.dispatch(RegisterScholarship { - provider_id: provider_id.get().unwrap(), - scholarship_name: "Testing Scholarship".to_string() + provider_id: provider_id.get().unwrap() }); }; -- 2.54.0 From c0d3288e28325443d5658493483db9f867304af9 Mon Sep 17 00:00:00 2001 From: Lucas Vas Date: Mon, 19 Jan 2026 13:04:28 -0500 Subject: [PATCH 2/4] chore: simplify test page --- src/pages/test_page.rs | 102 +++++++++++++++++++++++++++-------------- 1 file changed, 67 insertions(+), 35 deletions(-) diff --git a/src/pages/test_page.rs b/src/pages/test_page.rs index 18b15af..37918d3 100644 --- a/src/pages/test_page.rs +++ b/src/pages/test_page.rs @@ -1,43 +1,75 @@ -use crate::components::DashboardButton; +use chrono::DateTime; +use crate::components::ActionButton; use leptos::prelude::*; +use crate::common::{DateInfo, DateRange}; +use crate::pages::api::{CreateDates, CreateTestComparisons}; + +fn get_important_dates() -> Vec { + vec! [ + DateInfo { + id: uuid::Uuid::new_v4().to_string(), + title: "Provider Forms Open".to_string(), + date: DateRange::Range( + DateTime::parse_from_rfc3339("2026-01-20T07:15:00-05:00").unwrap(), + DateTime::parse_from_rfc3339("2026-03-03T23:59:00-05:00").unwrap() + ), + description: "".to_string(), + }, + DateInfo { + id: uuid::Uuid::new_v4().to_string(), + title: "Student Forms Open".to_string(), + date: DateRange::Range( + DateTime::parse_from_rfc3339("2026-03-03T07:15:00-05:00").unwrap(), + DateTime::parse_from_rfc3339("2026-03-27T14:05:00-05:00").unwrap() + ), + description: "".to_string(), + }, + DateInfo { + id: uuid::Uuid::new_v4().to_string(), + title: "Scholarship Decision Window".to_string(), + date: DateRange::Range( + DateTime::parse_from_rfc3339("2026-04-10T07:15:00-05:00").unwrap(), + DateTime::parse_from_rfc3339("2026-05-01T23:59:00-05:00").unwrap() + ), + description: "Start date may change if available sooner.".to_string(), + }, + DateInfo { + id: uuid::Uuid::new_v4().to_string(), + title: "PHS Scholarship Committee".to_string(), + date: DateRange::Single( + DateTime::parse_from_rfc3339("2026-05-18T00:00:00-05:00").unwrap(), + ), + description: "Time TBD".to_string(), + }, + DateInfo { + id: uuid::Uuid::new_v4().to_string(), + title: "Scholarship and Awards Night".to_string(), + date: DateRange::Single( + DateTime::parse_from_rfc3339("2026-06-09T00:00:00-05:00").unwrap(), + ), + description: "Time TBD".to_string(), + }, + ] +} #[component] -pub fn TestPage() -> impl IntoView { +pub fn TestPage() -> impl IntoView { + let create_comparisons = ServerAction::::new(); + let create_dates = ServerAction::::new(); + + let on_click_comparisons = move |_| { + create_comparisons.dispatch(CreateTestComparisons{}); + }; + + let on_click_dates = move |_| { + create_dates.dispatch(CreateDates{dates: get_important_dates()}); + }; + view! {
-
-
-
- - - -
-
-
-
-

Important Dates

-
-
-
-
-
-
-
+
+ "Create Comparisons" + "Create Dates"
}.into_any() -- 2.54.0 From 354875186fca6e451bb44a3befb430fd9d7af4f5 Mon Sep 17 00:00:00 2001 From: Lucas Vas Date: Mon, 19 Jan 2026 13:04:50 -0500 Subject: [PATCH 3/4] chore: remove unused imports --- src/main.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index f24da6d..2900ec5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,3 @@ -use axum::extract::State; -use axum::routing::post; -use leptos_axum::handle_server_fns_with_context; - #[cfg(feature = "ssr")] #[tokio::main] async fn main() { -- 2.54.0 From 11012bb567fb86343993f143c2976d85b307496a Mon Sep 17 00:00:00 2001 From: Lucas Vas Date: Mon, 19 Jan 2026 13:14:09 -0500 Subject: [PATCH 4/4] feat: add applicants page fallback --- src/app.rs | 5 +++-- src/pages/mod.rs | 3 ++- src/pages/provider_applicants.rs | 15 +++++++++++++++ src/pages/provider_portal.rs | 2 +- 4 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 src/pages/provider_applicants.rs diff --git a/src/app.rs b/src/app.rs index 958bb1a..15af1a2 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,4 +1,4 @@ -use crate::pages::{ProviderPortal, ScholarshipInfoPage, ProviderContactPage, LoanerShell, LoanerFallback, LoanerBorrowForm, LoanerReturnForm, AuthCallbackPage}; +use crate::pages::{ProviderPortal, ScholarshipInfoPage, ProviderContactPage, LoanerShell, LoanerFallback, LoanerBorrowForm, LoanerReturnForm, AuthCallbackPage, ApplicantsPageFallback}; use leptos::prelude::*; use leptos_meta::{MetaTags, Stylesheet, Title, provide_meta_context}; use leptos_oidc::AuthSignal; @@ -73,8 +73,9 @@ pub fn AppWithRoutes() -> impl IntoView { fn ProviderRoutes() -> impl MatchNestedRoutes + Clone { view! { - + + diff --git a/src/pages/mod.rs b/src/pages/mod.rs index 6b76373..4cdf400 100644 --- a/src/pages/mod.rs +++ b/src/pages/mod.rs @@ -9,9 +9,10 @@ mod test_page; mod unauthenticated_page; mod provider_contact; mod auth_callback; +mod provider_applicants; pub use self::{ about_page::*, comparison_test::*, home_page::*, loaner_page::*, provider_portal::*, test_page::*, unauthenticated_page::*, scholarship_info::*, provider_contact::*, - auth_callback::*, + auth_callback::*, provider_applicants::* }; diff --git a/src/pages/provider_applicants.rs b/src/pages/provider_applicants.rs new file mode 100644 index 0000000..644750b --- /dev/null +++ b/src/pages/provider_applicants.rs @@ -0,0 +1,15 @@ +use leptos::prelude::*; +use crate::components::Banner; + +#[component] +pub fn ApplicantsPageFallback() -> impl IntoView { + view! { + +
+

"Applicants Page"

+ +

"This page is under construction! It will show all the students that are eligible for your scholarship(s)."

+

"Come back soon!"

+
+ } +} \ No newline at end of file diff --git a/src/pages/provider_portal.rs b/src/pages/provider_portal.rs index c160455..3f8103c 100644 --- a/src/pages/provider_portal.rs +++ b/src/pages/provider_portal.rs @@ -43,7 +43,7 @@ pub fn ProviderPortal() -> impl IntoView { title="Applicants" description="View Scholarship Applicants" icon="/Form_Black.png" - path="/" + path="/providers/applicants" />
-- 2.54.0