feat: 加入重置单个视频状态的 API,视频接口返回下载状态 (#258)
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
use bili_sync_entity::*;
|
||||
use sea_orm::{DerivePartialModel, FromQueryResult};
|
||||
use sea_orm::FromQueryResult;
|
||||
use serde::Serialize;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
use crate::utils::status::{PageStatus, VideoStatus};
|
||||
|
||||
#[derive(Serialize, ToSchema)]
|
||||
pub struct VideoSourcesResponse {
|
||||
pub collection: Vec<VideoSource>,
|
||||
@@ -23,24 +24,53 @@ pub struct VideoResponse {
|
||||
pub pages: Vec<PageInfo>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, ToSchema)]
|
||||
pub struct ResetVideoResponse {
|
||||
pub resetted: bool,
|
||||
pub video: i32,
|
||||
pub pages: Vec<i32>,
|
||||
}
|
||||
|
||||
#[derive(FromQueryResult, Serialize, ToSchema)]
|
||||
pub struct VideoSource {
|
||||
id: i32,
|
||||
name: String,
|
||||
}
|
||||
|
||||
#[derive(DerivePartialModel, FromQueryResult, Serialize, ToSchema)]
|
||||
#[sea_orm(entity = "page::Entity")]
|
||||
#[derive(Serialize, ToSchema)]
|
||||
pub struct PageInfo {
|
||||
id: i32,
|
||||
pid: i32,
|
||||
name: String,
|
||||
pub id: i32,
|
||||
pub pid: i32,
|
||||
pub name: String,
|
||||
pub download_status: [u32; 5],
|
||||
}
|
||||
|
||||
#[derive(DerivePartialModel, FromQueryResult, Serialize, ToSchema)]
|
||||
#[sea_orm(entity = "video::Entity")]
|
||||
pub struct VideoInfo {
|
||||
id: i32,
|
||||
name: String,
|
||||
upper_name: String,
|
||||
impl From<(i32, i32, String, u32)> for PageInfo {
|
||||
fn from((id, pid, name, download_status): (i32, i32, String, u32)) -> Self {
|
||||
Self {
|
||||
id,
|
||||
pid,
|
||||
name,
|
||||
download_status: PageStatus::from(download_status).into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, ToSchema)]
|
||||
pub struct VideoInfo {
|
||||
pub id: i32,
|
||||
pub name: String,
|
||||
pub upper_name: String,
|
||||
pub download_status: [u32; 5],
|
||||
}
|
||||
|
||||
impl From<(i32, String, String, u32)> for VideoInfo {
|
||||
fn from((id, name, upper_name, download_status): (i32, String, String, u32)) -> Self {
|
||||
Self {
|
||||
id,
|
||||
name,
|
||||
upper_name,
|
||||
download_status: VideoStatus::from(download_status).into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user