Got it working
This commit is contained in:
@@ -62,14 +62,17 @@ pub mod endpoint {
|
||||
} else {
|
||||
if can_schedule(&payload.scheduled) {
|
||||
let mut scheduled_message = textsender_models::message::scheduling::ScheduledMessage {
|
||||
user_id: payload.user_id,
|
||||
scheduled: payload.scheduled,
|
||||
status: payload.status,
|
||||
..Default::default()
|
||||
};
|
||||
match scheduling_repo::insert(&pool, &scheduled_message, &payload.user_id).await {
|
||||
Ok((id, created)) => {
|
||||
scheduled_message.id = id;
|
||||
scheduled_message.created = Some(created);
|
||||
scheduled_message.user_id = payload.user_id;
|
||||
response.message = String::from("Message scheduled");
|
||||
response.data.push(scheduled_message);
|
||||
(axum::http::StatusCode::CREATED, axum::Json(response))
|
||||
}
|
||||
Err(err) => {
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ pub mod endpoints {
|
||||
/// Constant for getting messages endpoint
|
||||
pub const GET_MESSAGE: &str = "/api/v1/message";
|
||||
/// Constant for scheduling message endpoint
|
||||
pub const SCHEDULE_MESSAGE: &str = "api/v1/schedule/message";
|
||||
pub const SCHEDULE_MESSAGE: &str = "/api/v1/schedule/message";
|
||||
}
|
||||
|
||||
pub mod response {
|
||||
|
||||
Reference in New Issue
Block a user