fixed errors
This commit is contained in:
@@ -37,6 +37,11 @@ struct GetFollowData {
|
||||
account_id: i32,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Type)]
|
||||
struct GetFollowPubkeyData {
|
||||
pubkey: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Type)]
|
||||
struct CreateFollowData {
|
||||
pubkey: String,
|
||||
@@ -105,6 +110,19 @@ async fn get_follows(db: DbState<'_>, data: GetFollowData) -> Result<Vec<follow:
|
||||
.map_err(|_| ())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
async fn get_follow_by_pubkey(
|
||||
db: DbState<'_>,
|
||||
data: GetFollowPubkeyData,
|
||||
) -> Result<Option<follow::Data>, ()> {
|
||||
db.follow()
|
||||
.find_first(vec![follow::pubkey::equals(data.pubkey)])
|
||||
.exec()
|
||||
.await
|
||||
.map_err(|_| ())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
async fn create_follow(db: DbState<'_>, data: CreateFollowData) -> Result<follow::Data, ()> {
|
||||
@@ -198,6 +216,7 @@ async fn main() {
|
||||
get_accounts,
|
||||
create_account,
|
||||
get_follows,
|
||||
get_follow_by_pubkey,
|
||||
create_follow,
|
||||
create_note,
|
||||
get_notes,
|
||||
@@ -238,6 +257,7 @@ async fn main() {
|
||||
get_accounts,
|
||||
create_account,
|
||||
get_follows,
|
||||
get_follow_by_pubkey,
|
||||
create_follow,
|
||||
create_note,
|
||||
get_notes,
|
||||
|
||||
Reference in New Issue
Block a user