mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-26 07:19:22 +00:00
Can create countdown timers
This commit is contained in:
parent
9abe17415b
commit
3be1c7f203
@ -184,6 +184,16 @@ pub fn create_post(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
PostKind::POST_KIND_PDF(PostFile::new_from_created_file(&file)?)
|
||||
}
|
||||
|
||||
"countdown" => {
|
||||
let time_end = r.post_u64("time-end")?;
|
||||
|
||||
if time_end < time() {
|
||||
r.bad_request("You can not create countdown timer for past events!".to_string())?;
|
||||
}
|
||||
|
||||
PostKind::POST_KIND_COUNTDOWN(time_end)
|
||||
}
|
||||
|
||||
// TODO : add support for next types
|
||||
|
||||
_ => {
|
||||
|
@ -104,9 +104,13 @@ pub fn create(p: &Post) -> ResultBoxError<u64> {
|
||||
.add_opt_str("image_page", weblink.image.as_ref());
|
||||
}
|
||||
|
||||
// Countdown timer
|
||||
POST_KIND_COUNTDOWN(count_down) => {
|
||||
insert_query = insert_query.add_u64("time_end", *count_down);
|
||||
}
|
||||
|
||||
_ => unimplemented!()
|
||||
/*
|
||||
POST_KIND_COUNTDOWN(_) => {},
|
||||
POST_KIND_SURVEY => {},
|
||||
*/
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user