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:
12
src/main.rs
12
src/main.rs
@@ -17,10 +17,11 @@ use auth::jwt_middleware;
|
||||
use config::AppConfig;
|
||||
use db::create_pool;
|
||||
use handlers::{
|
||||
admin_get_user, admin_update_user_payment, create_order, delete_weather,
|
||||
generate_temp_token_handler, get_current_user_profile, get_user_quota,
|
||||
get_weather_brief, get_weather_details, health_check, login,
|
||||
mock_confirm, post_weather_data, save_user_profile, serve_static_files,
|
||||
admin_get_user, admin_update_user_payment, add_favorite, create_order,
|
||||
delete_weather, generate_temp_token_handler, get_current_user_profile,
|
||||
get_favorites, get_user_quota, get_weather_brief, get_weather_details,
|
||||
health_check, login, mock_confirm, post_weather_data, remove_favorite,
|
||||
save_user_profile, serve_static_files,
|
||||
};
|
||||
use models::AppState;
|
||||
|
||||
@@ -78,6 +79,9 @@ fn create_server_config(
|
||||
.service(create_order) // #[post("/api/payment/create-order")]
|
||||
.service(mock_confirm) // #[post("/api/payment/mock-confirm")]
|
||||
.service(get_user_quota) // #[get("/api/user/quota")]
|
||||
.service(get_favorites) // #[get("/api/favorites")]
|
||||
.service(add_favorite) // #[post("/api/favorites/{id}")]
|
||||
.service(remove_favorite) // #[delete("/api/favorites/{id}")]
|
||||
)
|
||||
// 健康检查
|
||||
.service(health_check)
|
||||
|
||||
Reference in New Issue
Block a user