auto-decrypt/src/orm/structures.rs
2025-09-05 14:49:30 +02:00

41 lines
1.1 KiB
Rust

use clap::builder::Str;
use diesel::{
deserialize::FromSql,
serialize::{Output, ToSql},
sql_types::Text,
Queryable,
Selectable,
Insertable,
sqlite::{Sqlite, SqliteValue},
AsExpression, FromSqlRow,
};
use std::fmt;
use super::types::{RecordStates, AuthMethod};
#[derive(Debug)]
#[derive(Queryable, Selectable, Insertable)]
#[diesel(table_name = super::schema::providers_records)]
#[diesel(check_for_backend(diesel::sqlite::Sqlite))]
pub(crate) struct ProviderRecord{
pub(crate) service_name: String,
pub(crate) expires_at: Option<i64>, // Unix timestamp
pub(crate) auth_methode: AuthMethod,
pub(crate) has_notifyed: bool,
pub(crate) state: RecordStates,
pub(crate) awnsered_by: Option<String>,
}
#[derive(Debug)]
#[derive(Insertable)]
#[diesel(table_name = super::schema::beggars_records)]
#[diesel(check_for_backend(diesel::sqlite::Sqlite))]
pub(crate) struct BeggarsRecord{
//request_time: String, // automatically set by sqlite
service_name: String,
http_result: i32,
note: Option<String>,
awnsered_by: Option<String>,
}