migrate from ts-rs to tauri-specta
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ts_rs::TS;
|
||||
use specta::Type;
|
||||
|
||||
use crate::models::{dolls::DollDto, friends::FriendshipResponseDto, user::UserProfile};
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, TS)]
|
||||
#[ts(export)]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, Type)]
|
||||
pub struct DisplayData {
|
||||
pub screen_width: i32,
|
||||
pub screen_height: i32,
|
||||
@@ -21,8 +20,7 @@ impl Default for DisplayData {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, TS)]
|
||||
#[ts(export)]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, Type)]
|
||||
pub struct SceneData {
|
||||
pub display: DisplayData,
|
||||
pub grid_size: i32,
|
||||
@@ -37,8 +35,7 @@ impl Default for SceneData {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)]
|
||||
#[ts(export)]
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, Type)]
|
||||
pub struct UserData {
|
||||
pub user: Option<UserProfile>,
|
||||
pub friends: Option<Vec<FriendshipResponseDto>>,
|
||||
|
||||
@@ -1,40 +1,35 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ts_rs::TS;
|
||||
use specta::Type;
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)]
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct DollColorSchemeDto {
|
||||
pub outline: String,
|
||||
pub body: String,
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)]
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct DollConfigurationDto {
|
||||
pub color_scheme: DollColorSchemeDto,
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)]
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct CreateDollDto {
|
||||
pub name: String,
|
||||
pub configuration: Option<DollConfigurationDto>,
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)]
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct UpdateDollDto {
|
||||
pub name: Option<String>,
|
||||
pub configuration: Option<DollConfigurationDto>,
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)]
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct DollDto {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
|
||||
@@ -1,79 +1,70 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ts_rs::TS;
|
||||
use specta::Type;
|
||||
|
||||
use super::dolls::DollDto;
|
||||
use super::friends::UserBasicDto;
|
||||
use crate::services::presence_modules::models::PresenceStatus;
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, TS)]
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, Type)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
#[ts(export)]
|
||||
pub enum UserStatusState {
|
||||
Idle,
|
||||
Resting,
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, TS)]
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct UserStatusPayload {
|
||||
pub presence_status: PresenceStatus,
|
||||
pub state: UserStatusState,
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, TS)]
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct FriendUserStatusPayload {
|
||||
pub user_id: String,
|
||||
pub status: UserStatusPayload,
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, TS)]
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct FriendDisconnectedPayload {
|
||||
pub user_id: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, TS)]
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct FriendActiveDollChangedPayload {
|
||||
pub friend_id: String,
|
||||
pub doll: Option<DollDto>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, TS)]
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct FriendRequestReceivedPayload {
|
||||
pub id: String,
|
||||
pub sender: UserBasicDto,
|
||||
pub created_at: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, TS)]
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct FriendRequestAcceptedPayload {
|
||||
pub id: String,
|
||||
pub friend: UserBasicDto,
|
||||
pub accepted_at: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, TS)]
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct FriendRequestDeniedPayload {
|
||||
pub id: String,
|
||||
pub denier: UserBasicDto,
|
||||
pub denied_at: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, TS)]
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct UnfriendedPayload {
|
||||
pub friend_id: String,
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ts_rs::TS;
|
||||
use specta::Type;
|
||||
|
||||
use super::dolls::DollDto;
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)]
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct UserBasicDto {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
@@ -13,25 +12,22 @@ pub struct UserBasicDto {
|
||||
pub active_doll: Option<DollDto>,
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)]
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct FriendshipResponseDto {
|
||||
pub id: String,
|
||||
pub friend: Option<UserBasicDto>,
|
||||
pub created_at: String,
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)]
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct SendFriendRequestDto {
|
||||
pub receiver_id: String,
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)]
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct FriendRequestResponseDto {
|
||||
pub id: String,
|
||||
pub sender: UserBasicDto,
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
use reqwest::StatusCode;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specta::Type;
|
||||
use thiserror::Error;
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)]
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct HealthResponseDto {
|
||||
pub status: String,
|
||||
pub version: String,
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ts_rs::TS;
|
||||
use specta::Type;
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, TS)]
|
||||
#[ts(export)]
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SendInteractionDto {
|
||||
pub recipient_user_id: String,
|
||||
@@ -11,8 +10,7 @@ pub struct SendInteractionDto {
|
||||
pub type_: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, TS)]
|
||||
#[ts(export)]
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct InteractionPayloadDto {
|
||||
pub sender_user_id: String,
|
||||
@@ -23,8 +21,7 @@ pub struct InteractionPayloadDto {
|
||||
pub timestamp: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, TS)]
|
||||
#[ts(export)]
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct InteractionDeliveryFailedDto {
|
||||
pub recipient_user_id: String,
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ts_rs::TS;
|
||||
use specta::Type;
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, TS)]
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export)]
|
||||
pub struct UserProfile {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
|
||||
Reference in New Issue
Block a user