WIP: 游戏共创(作品 Fork):共创授权与改编血缘、创作族谱、取件与改编闭环 #622

Draft
suzmii wants to merge 131 commits from feat/game-fork into master
3 changed files with 1033 additions and 73 deletions
Showing only changes of commit 861dc0a676 - Show all commits
File diff suppressed because it is too large Load Diff
@@ -24,15 +24,16 @@ pub mod game_distribution;
pub use game_distribution::{
GameDistributionAdminGameListRecordInput, GameDistributionAdminUserReviewListRecordInput,
GameDistributionApproveRecordInput, GameDistributionCancelVersionRecordInput,
GameDistributionConfirmPackageRecordInput, GameDistributionCreateGameRecordInput,
GameDistributionCreateVersionRecordInput, GameDistributionDeleteGameRecordInput,
GameDistributionFailUploadRecordInput, GameDistributionGetGameRecordInput,
GameDistributionOwnerGameListRecordInput, GameDistributionPlayCountIncrementRecordInput,
GameDistributionPublicGameListRecordInput, GameDistributionRejectRecordInput,
GameDistributionRestoreRecordInput, GameDistributionReviewGameListRecordInput,
GameDistributionReviewModerationRecordInput, GameDistributionSetForkAuthorizationRecordInput,
GameDistributionSubmitReviewRecordInput, GameDistributionSuspendRecordInput,
GameDistributionUnpublishRecordInput, GameDistributionUpdateMetadataRecordInput,
GameDistributionConfirmPackageRecordInput, GameDistributionConfirmProjectBundleRecordInput,
GameDistributionCreateGameRecordInput, GameDistributionCreateVersionRecordInput,
GameDistributionDeleteGameRecordInput, GameDistributionFailUploadRecordInput,
GameDistributionGetGameRecordInput, GameDistributionOwnerGameListRecordInput,
GameDistributionPlayCountIncrementRecordInput, GameDistributionPublicGameListRecordInput,
GameDistributionRejectRecordInput, GameDistributionRestoreRecordInput,
GameDistributionReviewGameListRecordInput, GameDistributionReviewModerationRecordInput,
GameDistributionSetForkAuthorizationRecordInput, GameDistributionSubmitReviewRecordInput,
GameDistributionSuspendRecordInput, GameDistributionUnpublishRecordInput,
GameDistributionUpdateMetadataRecordInput,
};
#[path = "active/external_generation.rs"]
pub mod external_generation;
@@ -323,6 +323,10 @@ pub struct GameDistributionDerivedGamesRecord {
/// `found == false` 表示游戏行不存在(api-server → 404);`available == false` 表示行存在但
/// 不可作为改编来源(已软删除 / 未公开 / 没有当前公开版本 → 409)。**不含对象键**:
/// 只带版本身份与摘要,下载路径由 api-server 拼同源相对路径。
///
/// `project_bundle_*` 是 M2b 的可选第二份资产:`project_bundle_bytes > 0 &&
/// project_bundle_sha256.is_some()` 才算「有工程源包」,api-server 据此在 `project` 与
/// `package` 之间选资产;字节数与摘要成对写入,缺一即按没有工程包处理。
#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct GameDistributionForkSourceRecord {
pub found: bool,
@@ -331,6 +335,10 @@ pub struct GameDistributionForkSourceRecord {
pub version_id: Option<String>,
pub package_sha256: Option<String>,
pub package_bytes: Option<u64>,
/// 工程源包整包 SHA-256;未上传为 `None`。
pub project_bundle_sha256: Option<String>,
/// 工程源包字节数;`0` 表示未上传。
pub project_bundle_bytes: u64,
}
fn map_game(
@@ -519,6 +527,9 @@ pub(crate) fn map_game_distribution_fork_source_result(
// SpacetimeDB 生成绑定把 `package_sha256` 折成 `package_sha_256`(与版本快照同约定)。
package_sha256: result.package_sha_256,
package_bytes: result.package_bytes,
// 同约定:`project_bundle_sha256` → `project_bundle_sha_256`。
project_bundle_sha256: result.project_bundle_sha_256,
project_bundle_bytes: result.project_bundle_bytes,
})
}