aboutsummaryrefslogtreecommitdiffstats
path: root/rust/src/editing.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-10 21:39:45 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-01-10 21:39:45 -0800
commitfb80d1dbe88614a53b7fd4e61b08b5e1cd296c7e (patch)
tree192f669a4cd0f2370aff9837954f64936d8cc5d6 /rust/src/editing.rs
parent9a83067d04c9648416b92fc8d7b8a542b0b9aa96 (diff)
downloadfatcat-fb80d1dbe88614a53b7fd4e61b08b5e1cd296c7e.tar.gz
fatcat-fb80d1dbe88614a53b7fd4e61b08b5e1cd296c7e.zip
WIP on annotations and changes
Diffstat (limited to 'rust/src/editing.rs')
-rw-r--r--rust/src/editing.rs60
1 files changed, 21 insertions, 39 deletions
diff --git a/rust/src/editing.rs b/rust/src/editing.rs
index 4fca30d6..2feff837 100644
--- a/rust/src/editing.rs
+++ b/rust/src/editing.rs
@@ -60,45 +60,6 @@ pub fn make_edit_context(
})
}
-pub fn create_editor(
- conn: &DbConn,
- username: String,
- is_admin: bool,
- is_bot: bool,
-) -> Result<EditorRow> {
- check_username(&username)?;
- let ed: EditorRow = diesel::insert_into(editor::table)
- .values((
- editor::username.eq(username),
- editor::is_admin.eq(is_admin),
- editor::is_bot.eq(is_bot),
- ))
- .get_result(conn)?;
- Ok(ed)
-}
-
-pub fn update_editor_username(
- conn: &DbConn,
- editor_id: FatcatId,
- username: String,
-) -> Result<EditorRow> {
- check_username(&username)?;
- diesel::update(editor::table.find(editor_id.to_uuid()))
- .set(editor::username.eq(username))
- .execute(conn)?;
- let editor: EditorRow = editor::table.find(editor_id.to_uuid()).get_result(conn)?;
- Ok(editor)
-}
-
-/// This function should always be run within a transaction
-pub fn create_editgroup(conn: &DbConn, editor_id: Uuid) -> Result<Uuid> {
- // need to insert and update
- let eg_row: EditgroupRow = diesel::insert_into(editgroup::table)
- .values((editgroup::editor_id.eq(editor_id),))
- .get_result(conn)?;
- Ok(eg_row.id)
-}
-
/// This function should always be run within a transaction
pub fn accept_editgroup(conn: &DbConn, editgroup_id: FatcatId) -> Result<ChangelogRow> {
// check that we haven't accepted already (in changelog)
@@ -128,3 +89,24 @@ pub fn accept_editgroup(conn: &DbConn, editgroup_id: FatcatId) -> Result<Changel
Ok(entry)
}
+
+pub fn create_editgroup(conn: &DbConn, editor_id: Uuid) -> Result<Uuid> {
+ unimplemented!()
+}
+
+pub fn create_editor(
+ conn: &DbConn,
+ username: String,
+ is_admin: bool,
+ is_bot: bool,
+) -> Result<EditorRow> {
+ unimplemented!()
+}
+
+pub fn update_editor_username(
+ conn: &DbConn,
+ editor_id: FatcatId,
+ username: String,
+) -> Result<EditorRow> {
+ unimplemented!()
+}