mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-09-28 04:21:17 +00:00
User::save() should return QueryResult instead of bool
This commit is contained in:
parent
faec050a6d
commit
e985221b50
5 changed files with 47 additions and 37 deletions
|
@ -148,15 +148,11 @@ impl User {
|
|||
}
|
||||
|
||||
|
||||
pub fn save(&mut self, conn: &DbConn) -> bool {
|
||||
pub fn save(&mut self, conn: &DbConn) -> QueryResult<()> {
|
||||
self.updated_at = Utc::now().naive_utc();
|
||||
|
||||
match diesel::replace_into(users::table) // Insert or update
|
||||
.values(&*self)
|
||||
.execute(&**conn) {
|
||||
Ok(1) => true, // One row inserted
|
||||
_ => false,
|
||||
}
|
||||
diesel::replace_into(users::table) // Insert or update
|
||||
.values(&*self).execute(&**conn).and(Ok(()))
|
||||
}
|
||||
|
||||
pub fn delete(self, conn: &DbConn) -> QueryResult<()> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue