mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
fix previous auth records cleanup, update error enums
This commit is contained in:
parent
cadefe3f1d
commit
3191ff0ff0
2 changed files with 7 additions and 8 deletions
|
|
@ -45,12 +45,10 @@ impl Auth {
|
||||||
// Get all records match request
|
// Get all records match request
|
||||||
match self.database.records(Some(url)) {
|
match self.database.records(Some(url)) {
|
||||||
Ok(records) => {
|
Ok(records) => {
|
||||||
// Cleanup records match `profile_identity_gemini_id` (unauth)
|
// Cleanup records match `url` (unauth)
|
||||||
for record in records {
|
for record in records {
|
||||||
if record.profile_identity_gemini_id == profile_identity_gemini_id {
|
if let Err(reason) = self.database.delete(record.id) {
|
||||||
if self.database.delete(record.id).is_err() {
|
return Err(Error::DatabaseRecordDelete(record.id, reason));
|
||||||
return Err(Error::DatabaseRecordDelete(record.id));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -58,10 +56,11 @@ impl Auth {
|
||||||
let profile_identity_gemini_auth_id =
|
let profile_identity_gemini_auth_id =
|
||||||
match self.database.add(profile_identity_gemini_id, url) {
|
match self.database.add(profile_identity_gemini_id, url) {
|
||||||
Ok(id) => id,
|
Ok(id) => id,
|
||||||
Err(_) => {
|
Err(reason) => {
|
||||||
return Err(Error::DatabaseRecordCreate(
|
return Err(Error::DatabaseRecordCreate(
|
||||||
profile_identity_gemini_id,
|
profile_identity_gemini_id,
|
||||||
url.to_string(),
|
url.to_string(),
|
||||||
|
reason,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
DatabaseIndex,
|
DatabaseIndex,
|
||||||
DatabaseRecordCreate(i64, String),
|
DatabaseRecordCreate(i64, String, sqlite::Error),
|
||||||
DatabaseRecordDelete(i64),
|
DatabaseRecordDelete(i64, sqlite::Error),
|
||||||
DatabaseRecordsRead(String),
|
DatabaseRecordsRead(String),
|
||||||
MemoryIndex(super::memory::Error),
|
MemoryIndex(super::memory::Error),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue