- pub fn update_ap_id(
- conn: &PgConnection,
- private_message_id: PrivateMessageId,
- apub_id: DbUrl,
- ) -> Result<PrivateMessage, Error> {
- use crate::schema::private_message::dsl::*;
-
- diesel::update(private_message.find(private_message_id))
- .set(ap_id.eq(apub_id))
- .get_result::<Self>(conn)
- }
-
- pub fn update_content(
- conn: &PgConnection,
- private_message_id: PrivateMessageId,
- new_content: &str,
- ) -> Result<PrivateMessage, Error> {
- use crate::schema::private_message::dsl::*;
- diesel::update(private_message.find(private_message_id))
- .set((content.eq(new_content), updated.eq(naive_now())))
- .get_result::<Self>(conn)
- }
-
- pub fn update_deleted(
- conn: &PgConnection,
- private_message_id: PrivateMessageId,
- new_deleted: bool,
- ) -> Result<PrivateMessage, Error> {
- use crate::schema::private_message::dsl::*;
- diesel::update(private_message.find(private_message_id))
- .set(deleted.eq(new_deleted))
- .get_result::<Self>(conn)
- }
-
- pub fn update_read(
- conn: &PgConnection,
- private_message_id: PrivateMessageId,
- new_read: bool,
- ) -> Result<PrivateMessage, Error> {
- use crate::schema::private_message::dsl::*;
- diesel::update(private_message.find(private_message_id))
- .set(read.eq(new_read))
- .get_result::<Self>(conn)
- }
-
- pub fn mark_all_as_read(
- conn: &PgConnection,