🚑️ invest sub prj
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
JMARyA 2025-02-23 05:01:02 +01:00
parent 453e195a7a
commit c279ee24f2
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
2 changed files with 6 additions and 3 deletions

View file

@ -4,6 +4,8 @@ use based::get_pg;
use rocket::{form::Form, post, response::Redirect, FromForm};
use sqlx::prelude::FromRow;
use crate::PathSegment;
#[derive(Debug, Clone, FromRow)]
pub struct Investment {
pub id: i64,
@ -84,8 +86,9 @@ pub struct NewInvestForm {
description: String,
}
#[post("/prj/<root>/invest", data = "<form>")]
pub async fn post_new_invest(root: String, form: Form<NewInvestForm>) -> Redirect {
#[post("/invest/<path..>", data = "<form>")]
pub async fn post_new_invest(path: PathSegment, form: Form<NewInvestForm>) -> Redirect {
let root = path.to_str();
Investment::new_investment(
&root,
form.amount.parse().unwrap(),

View file

@ -151,7 +151,7 @@ pub fn build_invest_timeline(investments: &[Investment]) -> PreEscaped<String> {
pub async fn invest_tab(prj: &Project, root: &str) -> PreEscaped<String> {
let (add_invest_id, add_invest_modal) = Modal(
"Add Investment",
Form::new(&format!("/prj/{root}invest"))
Form::new(&format!("/invest/{root}"))
.id("new_invest")
.add_input(TextInput("title").required().placeholder("Title"))
.add_input(