Add /calendar
This commit is contained in:
parent
d20c5a49a4
commit
853895df79
5 changed files with 152 additions and 0 deletions
|
|
@ -30,6 +30,7 @@ pub async fn run(tx: mpsc::Sender<Command>, addr: String) -> anyhow::Result<()>
|
|||
.route("/image", post(post_image).fallback(get_static_file))
|
||||
.route("/photo", post(post_photo).fallback(get_static_file))
|
||||
.route("/chat_message", post(post_chat_message))
|
||||
.route("/calendar", post(post_calendar))
|
||||
.fallback(get(get_static_file))
|
||||
.layer(DefaultBodyLimit::max(32 * 1024 * 1024)) // 32 MiB
|
||||
.with_state(Server { tx });
|
||||
|
|
@ -124,3 +125,19 @@ async fn post_chat_message(server: State<Server>, request: Form<PostChatMessageF
|
|||
})
|
||||
.await;
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct PostCalendarForm {
|
||||
year: i32,
|
||||
month: u8,
|
||||
}
|
||||
|
||||
async fn post_calendar(server: State<Server>, request: Form<PostCalendarForm>) {
|
||||
let _ = server
|
||||
.tx
|
||||
.send(Command::Calendar {
|
||||
year: request.0.year,
|
||||
month: request.0.month,
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue