mirror of
https://github.com/amtoaer/bili-sync.git
synced 2026-09-05 23:49:53 +08:00
fix: 新订阅添加后应该默认启用 (#380)
This commit is contained in:
@@ -197,11 +197,11 @@ pub async fn insert_favorite(
|
|||||||
f_id: Set(favorite_info.id),
|
f_id: Set(favorite_info.id),
|
||||||
name: Set(favorite_info.title.clone()),
|
name: Set(favorite_info.title.clone()),
|
||||||
path: Set(request.path),
|
path: Set(request.path),
|
||||||
|
enabled: Set(true),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.exec(db.as_ref())
|
.exec(db.as_ref())
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
Ok(ApiResponse::ok(true))
|
Ok(ApiResponse::ok(true))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,13 +220,13 @@ pub async fn insert_collection(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
let collection_info = collection.get_info().await?;
|
let collection_info = collection.get_info().await?;
|
||||||
|
|
||||||
collection::Entity::insert(collection::ActiveModel {
|
collection::Entity::insert(collection::ActiveModel {
|
||||||
s_id: Set(collection_info.sid),
|
s_id: Set(collection_info.sid),
|
||||||
m_id: Set(collection_info.mid),
|
m_id: Set(collection_info.mid),
|
||||||
r#type: Set(collection_info.collection_type.into()),
|
r#type: Set(collection_info.collection_type.into()),
|
||||||
name: Set(collection_info.name.clone()),
|
name: Set(collection_info.name.clone()),
|
||||||
path: Set(request.path),
|
path: Set(request.path),
|
||||||
|
enabled: Set(true),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.exec(db.as_ref())
|
.exec(db.as_ref())
|
||||||
@@ -243,15 +243,14 @@ pub async fn insert_submission(
|
|||||||
) -> Result<ApiResponse<bool>, ApiError> {
|
) -> Result<ApiResponse<bool>, ApiError> {
|
||||||
let submission = Submission::new(bili_client.as_ref(), request.upper_id.to_string());
|
let submission = Submission::new(bili_client.as_ref(), request.upper_id.to_string());
|
||||||
let upper = submission.get_info().await?;
|
let upper = submission.get_info().await?;
|
||||||
|
|
||||||
submission::Entity::insert(submission::ActiveModel {
|
submission::Entity::insert(submission::ActiveModel {
|
||||||
upper_id: Set(upper.mid.parse()?),
|
upper_id: Set(upper.mid.parse()?),
|
||||||
upper_name: Set(upper.name),
|
upper_name: Set(upper.name),
|
||||||
path: Set(request.path),
|
path: Set(request.path),
|
||||||
|
enabled: Set(true),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.exec(db.as_ref())
|
.exec(db.as_ref())
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
Ok(ApiResponse::ok(true))
|
Ok(ApiResponse::ok(true))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user