Dolls (UI WIP)

This commit is contained in:
2025-12-20 01:21:05 +08:00
parent ab2beaffa4
commit 1c7b518e73
9 changed files with 535 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ use crate::{
FriendRemote, FriendRequestResponseDto, FriendshipResponseDto, SendFriendRequestDto,
UserBasicDto,
},
remotes::dolls::{DollsRemote, CreateDollDto, UpdateDollDto, DollDto},
services::cursor::start_cursor_tracking,
state::{init_app_data, FDOLL},
};
@@ -159,6 +160,38 @@ async fn unfriend(friend_id: String) -> Result<(), String> {
.map_err(|e| e.to_string())
}
#[tauri::command]
async fn get_dolls() -> Result<Vec<DollDto>, String> {
DollsRemote::new()
.get_dolls()
.await
.map_err(|e| e.to_string())
}
#[tauri::command]
async fn create_doll(dto: CreateDollDto) -> Result<DollDto, String> {
DollsRemote::new()
.create_doll(dto)
.await
.map_err(|e| e.to_string())
}
#[tauri::command]
async fn update_doll(id: String, dto: UpdateDollDto) -> Result<DollDto, String> {
DollsRemote::new()
.update_doll(&id, dto)
.await
.map_err(|e| e.to_string())
}
#[tauri::command]
async fn delete_doll(id: String) -> Result<(), String> {
DollsRemote::new()
.delete_doll(&id)
.await
.map_err(|e| e.to_string())
}
#[tauri::command]
fn quit_app() -> Result<(), String> {
let app_handle = get_app_handle();
@@ -184,6 +217,10 @@ pub fn run() {
accept_friend_request,
deny_friend_request,
unfriend,
get_dolls,
create_doll,
update_doll,
delete_doll,
quit_app
])
.setup(|app| {