mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 09:10:08 +00:00
fix previous auth records cleanup, update error enums
This commit is contained in:
parent
cadefe3f1d
commit
3191ff0ff0
@ -45,12 +45,10 @@ impl Auth {
|
||||
// Get all records match request
|
||||
match self.database.records(Some(url)) {
|
||||
Ok(records) => {
|
||||
// Cleanup records match `profile_identity_gemini_id` (unauth)
|
||||
// Cleanup records match `url` (unauth)
|
||||
for record in records {
|
||||
if record.profile_identity_gemini_id == profile_identity_gemini_id {
|
||||
if self.database.delete(record.id).is_err() {
|
||||
return Err(Error::DatabaseRecordDelete(record.id));
|
||||
}
|
||||
if let Err(reason) = self.database.delete(record.id) {
|
||||
return Err(Error::DatabaseRecordDelete(record.id, reason));
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,10 +56,11 @@ impl Auth {
|
||||
let profile_identity_gemini_auth_id =
|
||||
match self.database.add(profile_identity_gemini_id, url) {
|
||||
Ok(id) => id,
|
||||
Err(_) => {
|
||||
Err(reason) => {
|
||||
return Err(Error::DatabaseRecordCreate(
|
||||
profile_identity_gemini_id,
|
||||
url.to_string(),
|
||||
reason,
|
||||
))
|
||||
}
|
||||
};
|
||||
|
@ -1,8 +1,8 @@
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
DatabaseIndex,
|
||||
DatabaseRecordCreate(i64, String),
|
||||
DatabaseRecordDelete(i64),
|
||||
DatabaseRecordCreate(i64, String, sqlite::Error),
|
||||
DatabaseRecordDelete(i64, sqlite::Error),
|
||||
DatabaseRecordsRead(String),
|
||||
MemoryIndex(super::memory::Error),
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user