Add a route to get a single inbox entry
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use crate::connections::db_connection::db;
|
||||
use crate::controllers::server_controller::ServerConstraints;
|
||||
use crate::models::files::FileID;
|
||||
use crate::models::inbox::{InboxEntry, InboxID, NewInboxEntry};
|
||||
use crate::models::inbox::{InboxEntry, InboxEntryID, NewInboxEntry};
|
||||
use crate::models::movements::MovementID;
|
||||
use crate::models::users::UserID;
|
||||
use crate::schema::inbox;
|
||||
@@ -77,7 +77,7 @@ pub async fn create(user_id: UserID, query: &UpdateInboxEntryQuery) -> anyhow::R
|
||||
}
|
||||
|
||||
/// Update a inbox entry
|
||||
pub async fn update(id: InboxID, q: &UpdateInboxEntryQuery) -> anyhow::Result<()> {
|
||||
pub async fn update(id: InboxEntryID, q: &UpdateInboxEntryQuery) -> anyhow::Result<()> {
|
||||
diesel::update(inbox::dsl::inbox.filter(inbox::dsl::id.eq(id.0)))
|
||||
.set((
|
||||
inbox::dsl::time_update.eq(time() as i64),
|
||||
@@ -98,3 +98,10 @@ pub async fn get_list_user(user_id: UserID) -> anyhow::Result<Vec<InboxEntry>> {
|
||||
.filter(inbox::dsl::user_id.eq(user_id.0))
|
||||
.get_results(&mut db()?)?)
|
||||
}
|
||||
|
||||
/// Get a single inbox entry by its ID
|
||||
pub async fn get_by_id(entry_id: InboxEntryID) -> anyhow::Result<InboxEntry> {
|
||||
Ok(inbox::table
|
||||
.filter(inbox::dsl::id.eq(entry_id.0))
|
||||
.get_result(&mut db()?)?)
|
||||
}
|
||||
|
Reference in New Issue
Block a user