Release first version

This commit is contained in:
wjsjwr 2024-12-30 21:31:28 +08:00
parent 38e2285ad3
commit d8aa433055
5 changed files with 26 additions and 14 deletions

View File

@ -10,19 +10,18 @@
<cargoProject FILE="$PROJECT_DIR$/bookkeeper/Cargo.toml" />
</component>
<component name="ChangeListManager">
<list default="true" id="76b3b902-7a5c-4bcd-9c1b-8241d748fb44" name="更改" comment="Update some settings">
<change beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterDir="false" />
<list default="true" id="76b3b902-7a5c-4bcd-9c1b-8241d748fb44" name="更改" comment="Modify Tx and Delete Tx">
<change afterPath="$PROJECT_DIR$/bookkeeper/.cargo/config.toml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bookkeeper/src/main.rs" beforeDir="false" afterPath="$PROJECT_DIR$/bookkeeper/src/main.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bookkeeper/templates/index.html.j2" beforeDir="false" afterPath="$PROJECT_DIR$/bookkeeper/templates/index.html.j2" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bookkeeper/templates/tx.html.j2" beforeDir="false" afterPath="$PROJECT_DIR$/bookkeeper/templates/tx.html.j2" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bookkeeper/templates/base.html.j2" beforeDir="false" afterPath="$PROJECT_DIR$/bookkeeper/templates/base.html.j2" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="RsBuildProfile:dev" />
<component name="ExecutionTargetManager" SELECTED_TARGET="RsBuildProfile:release" />
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
@ -82,7 +81,7 @@
</component>
<component name="RunManager" selected="Cargo.Run bookkeeper">
<configuration name="Run bookkeeper" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<option name="buildProfileId" value="dev" />
<option name="buildProfileId" value="release" />
<option name="command" value="run --package bookkeeper --bin bookkeeper" />
<option name="workingDirectory" value="file://$PROJECT_DIR$/bookkeeper" />
<envs />
@ -151,7 +150,7 @@
<workItem from="1735392290940" duration="620000" />
<workItem from="1735392928494" duration="12910000" />
<workItem from="1735470376833" duration="16014000" />
<workItem from="1735553493290" duration="4033000" />
<workItem from="1735553493290" duration="6862000" />
</task>
<task id="LOCAL-00001" summary="Add bookkeeper">
<option name="closed" value="true" />
@ -209,7 +208,15 @@
<option name="project" value="LOCAL" />
<updated>1735486582714</updated>
</task>
<option name="localTasksCounter" value="8" />
<task id="LOCAL-00008" summary="Modify Tx and Delete Tx">
<option name="closed" value="true" />
<created>1735562546317</created>
<option name="number" value="00008" />
<option name="presentableId" value="LOCAL-00008" />
<option name="project" value="LOCAL" />
<updated>1735562546317</updated>
</task>
<option name="localTasksCounter" value="9" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -234,7 +241,8 @@
<MESSAGE value="Refine data structure and index page" />
<MESSAGE value="Implement add transaction" />
<MESSAGE value="Update some settings" />
<option name="LAST_COMMIT_MESSAGE" value="Update some settings" />
<MESSAGE value="Modify Tx and Delete Tx" />
<option name="LAST_COMMIT_MESSAGE" value="Modify Tx and Delete Tx" />
</component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />

View File

@ -0,0 +1,2 @@
[target.'cfg(all(windows, target_env = "msvc"))']
rustflags = ["-C", "target-feature=+crt-static"]

View File

@ -21,6 +21,7 @@ use std::str::FromStr;
use std::time::Duration;
use rocket::http::Status;
use serde::{Deserialize, Serialize};
use rocket::fs::FileServer;
#[derive(sea_orm_rocket::Database, Debug)]
#[database("bookkeeper")]
@ -118,10 +119,8 @@ async fn get_tx(conn: Connection<'_, Db>, id: i32) -> Result<Template, Status> {
#[post("/tx/<id>", data = "<data>")]
async fn post_tx(data: Form<TransModel<'_>>, conn: Connection<'_, Db>, id: i32) -> Result<Redirect, Status> {
dbg!(&data);
let mut record = translate(data);
record.id = Set(id);
dbg!(&record);
match record.update(conn.into_inner()).await {
Err(_) => { Err(Status::NotFound) },
Ok(_) => { Ok(Redirect::to("/")) },
@ -212,10 +211,10 @@ async fn run_migrations(rocket: Rocket<Build>) -> fairing::Result {
#[launch]
async fn rocket() -> _ {
println!("Loading templates from {:?}", std::env::current_dir().unwrap());
rocket::build()
.attach(Db::init())
.attach(AdHoc::try_on_ignite("Migrations", run_migrations))
.attach(Template::fairing())
.mount("/", routes![index, add, get_add, get_tx, post_tx, delete_tx])
}
.mount("/static", FileServer::from("static"))
}

3
bookkeeper/static/bulma.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Skeleton App{% endblock title %}</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.2/css/bulma.min.css">
<link rel="stylesheet" href="/static/bulma.min.css">
</head>
<body>
{% block content %}{% endblock content %}