feat: 添加收藏功能 API
- models.rs: 添加 is_favorite 字段到 WeatherData 和 WeatherDataBrief - db.rs: 添加 get_favorites_list 和 set_weather_favorite 函数 - handlers/favorites.rs: 新建收藏 API 处理器 - handlers/mod.rs: 导出 favorites 模块 - main.rs: 注册收藏 API 路由
This commit is contained in:
@@ -113,6 +113,7 @@ pub struct WeatherDataBrief {
|
||||
|
||||
pub longitude: String,
|
||||
pub latitude: String,
|
||||
pub is_favorite: bool,
|
||||
}
|
||||
|
||||
// 在models.rs中添加(可放在WeatherDataBrief下方)
|
||||
@@ -264,6 +265,8 @@ pub struct WeatherData {
|
||||
#[serde(rename = "windSpeedSuitability")]
|
||||
#[sqlx(rename = "windspeedsuitability")]
|
||||
pub wind_speed_suitability: String,
|
||||
|
||||
pub is_favorite: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, FromRow)]
|
||||
|
||||
Reference in New Issue
Block a user