Skip to content

Commit f2c4ab4

Browse files
feat: 添加kungal相关api (#45)
* refactor: split settings page * feat: add TauriHTTP logs * feat: add kungal * feat: improve metadata storage of kungal * fix: ts error * chore: disabled kungal data sync 暂时关闭kungal的数据同步,当前kungal在更改游玩状态时必须评分并编写短评 * refactor: remove unnecessary code logic and initially optimize the integration of kungal * refactor: remove kungal from mixed api * refactor: replace kungal with kun --------- Co-authored-by: huoshen80 <huoshen80@hotmail.com>
1 parent 9561be1 commit f2c4ab4

29 files changed

Lines changed: 1488 additions & 918 deletions

src-tauri/capabilities/default.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@
5959
},
6060
{
6161
"url": "https://api.vndb.org"
62+
},
63+
{
64+
"url": "https://www.kungal.com"
6265
}
6366
]
6467
}

src-tauri/migration/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ mod m20260104_000005_add_le_magpie_fields;
99
mod m20260131_000006_migrate_clear_to_play_status;
1010
mod m20260201_000007_clean_empty_strings;
1111
mod m20260318_000008_add_vndb_token_and_collection_sync;
12+
mod m20260331_000009_add_kungal_support;
1213

1314
pub struct Migrator;
1415

@@ -24,6 +25,7 @@ impl MigratorTrait for Migrator {
2425
Box::new(m20260131_000006_migrate_clear_to_play_status::Migration),
2526
Box::new(m20260201_000007_clean_empty_strings::Migration),
2627
Box::new(m20260318_000008_add_vndb_token_and_collection_sync::Migration),
28+
Box::new(m20260331_000009_add_kungal_support::Migration),
2729
]
2830
}
2931
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
use sea_orm_migration::prelude::*;
2+
3+
#[derive(DeriveMigrationName)]
4+
pub struct Migration;
5+
6+
#[async_trait::async_trait]
7+
impl MigrationTrait for Migration {
8+
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
9+
// 添加 kun_id 和 kun_data 列
10+
manager
11+
.alter_table(
12+
Table::alter()
13+
.table(Games::Table)
14+
.add_column_if_not_exists(
15+
ColumnDef::new(Games::KunId)
16+
.text()
17+
.null(),
18+
)
19+
.to_owned(),
20+
)
21+
.await?;
22+
23+
manager
24+
.alter_table(
25+
Table::alter()
26+
.table(Games::Table)
27+
.add_column_if_not_exists(
28+
ColumnDef::new(Games::KunData)
29+
.text()
30+
.null(),
31+
)
32+
.to_owned(),
33+
)
34+
.await?;
35+
36+
Ok(())
37+
}
38+
39+
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
40+
// Drop columns down if reverted
41+
manager
42+
.alter_table(
43+
Table::alter()
44+
.table(Games::Table)
45+
.drop_column(Games::KunId)
46+
.to_owned(),
47+
)
48+
.await?;
49+
50+
manager
51+
.alter_table(
52+
Table::alter()
53+
.table(Games::Table)
54+
.drop_column(Games::KunData)
55+
.to_owned(),
56+
)
57+
.await?;
58+
59+
Ok(())
60+
}
61+
}
62+
63+
/// 需要修改的表和列枚举
64+
#[derive(DeriveIden)]
65+
enum Games {
66+
Table,
67+
KunId,
68+
KunData,
69+
}

0 commit comments

Comments
 (0)