fix: use only necessary fields
This commit is contained in:
parent
abaed389f9
commit
38c5b85220
4 changed files with 18 additions and 10 deletions
9
packages/backend-rs/index.d.ts
vendored
9
packages/backend-rs/index.d.ts
vendored
|
@ -241,7 +241,6 @@ export interface ImageSize {
|
|||
height: number
|
||||
}
|
||||
export function getImageSizeFromUrl(url: string): Promise<ImageSize>
|
||||
/** TODO: handle name collisions better */
|
||||
export interface NoteLikeForAllTexts {
|
||||
fileIds: Array<string>
|
||||
userId: string
|
||||
|
@ -257,7 +256,13 @@ export interface NoteLikeForGetNoteSummary {
|
|||
hasPoll: boolean
|
||||
}
|
||||
export function getNoteSummary(note: NoteLikeForGetNoteSummary): string
|
||||
export function isQuote(note: Note): boolean
|
||||
export interface NoteLikeForIsQuote {
|
||||
renoteId: string | null
|
||||
text: string | null
|
||||
hasPoll: boolean
|
||||
fileIds: Array<string>
|
||||
}
|
||||
export function isQuote(note: NoteLikeForIsQuote): boolean
|
||||
export function isSafeUrl(url: string): boolean
|
||||
export function latestVersion(): Promise<string>
|
||||
export function fetchMeta(useCache: boolean): Promise<Meta>
|
||||
|
|
|
@ -2,7 +2,7 @@ use crate::database::db_conn;
|
|||
use crate::model::entity::{drive_file, note};
|
||||
use sea_orm::{prelude::*, QuerySelect};
|
||||
|
||||
/// TODO: handle name collisions better
|
||||
// TODO?: handle name collisions
|
||||
#[crate::export(object, js_name = "NoteLikeForAllTexts")]
|
||||
pub struct NoteLike {
|
||||
pub file_ids: Vec<String>,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
// TODO: handle name collisions in a better way
|
||||
// TODO?: handle name collisions
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[crate::export(object, js_name = "NoteLikeForGetNoteSummary")]
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
use crate::model::entity::note;
|
||||
|
||||
// for napi export
|
||||
// https://github.com/napi-rs/napi-rs/issues/2060
|
||||
type Note = note::Model;
|
||||
// TODO?: handle name collisions
|
||||
#[crate::export(object, js_name = "NoteLikeForIsQuote")]
|
||||
pub struct NoteLike {
|
||||
pub renote_id: Option<String>,
|
||||
pub text: Option<String>,
|
||||
pub has_poll: bool,
|
||||
pub file_ids: Vec<String>,
|
||||
}
|
||||
|
||||
#[crate::export]
|
||||
pub fn is_quote(note: Note) -> bool {
|
||||
pub fn is_quote(note: &NoteLike) -> bool {
|
||||
note.renote_id.is_some() && (note.text.is_some() || note.has_poll || !note.file_ids.is_empty())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue