Fix follow IDs (#455)
* Generate valid IDs for Follow Fixes #449 * Use the new post-insert hook for all the models * Fix plume-cli build
This commit is contained in:
@@ -235,13 +235,19 @@ macro_rules! get {
|
||||
/// ```
|
||||
macro_rules! insert {
|
||||
($table:ident, $from:ident) => {
|
||||
insert!($table, $from, |x, _conn| { Ok(x) });
|
||||
};
|
||||
($table:ident, $from:ident, |$val:ident, $conn:ident | $after:block) => {
|
||||
last!($table);
|
||||
|
||||
pub fn insert(conn: &crate::Connection, new: $from) -> Result<Self> {
|
||||
diesel::insert_into($table::table)
|
||||
.values(new)
|
||||
.execute(conn)?;
|
||||
Self::last(conn)
|
||||
#[allow(unused_mut)]
|
||||
let mut $val = Self::last(conn)?;
|
||||
let $conn = conn;
|
||||
$after
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user