summaryrefslogtreecommitdiffstats
path: root/server/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/lib.rs')
-rw-r--r--server/src/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/server/src/lib.rs b/server/src/lib.rs
index 3390dbdc..31c1af7c 100644
--- a/server/src/lib.rs
+++ b/server/src/lib.rs
@@ -55,6 +55,16 @@ pub trait Bannable<T> {
fn unban(conn: &PgConnection, form: &T) -> Result<usize, Error> where Self: Sized;
}
+pub trait Saveable<T> {
+ fn save(conn: &PgConnection, form: &T) -> Result<Self, Error> where Self: Sized;
+ fn unsave(conn: &PgConnection, form: &T) -> Result<usize, Error> where Self: Sized;
+}
+
+pub trait Readable<T> {
+ fn mark_as_read(conn: &PgConnection, form: &T) -> Result<Self, Error> where Self: Sized;
+ fn mark_as_unread(conn: &PgConnection, form: &T) -> Result<usize, Error> where Self: Sized;
+}
+
pub fn establish_connection() -> PgConnection {
let db_url = Settings::get().db_url;
PgConnection::establish(&db_url)