refactor(bill): 重构 bank card 路由删除逻辑以支持 ID 参数
- 修改 DELETE 路由以接收 ID 参数 - 移除了冗余的 HTTP 请求示例文件 - 将 bill 包从主应用中解耦为库模块 - 更新 Cargo.toml 依赖关系以包含 bill 模块 - 升级多个工作区依赖版本 - 移除了已弃用的 docker-watcher 包及相关测试代码 - 修正数据库执行语句引用方式 - 添加 EntityTrait 引用以支持模型操作
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
### 请求 card 数据
|
||||
GET http://localhost:8080/bank-card
|
||||
|
||||
### 添加 card 数据
|
||||
POST http://localhost:8080/bank-card
|
||||
|
||||
### 删除 card 数据
|
||||
DELETE http://localhost:8080/bank-card
|
||||
1
packages/bill/src/lib.rs
Normal file
1
packages/bill/src/lib.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod router;
|
||||
@@ -1,19 +0,0 @@
|
||||
mod router;
|
||||
|
||||
use actix_web::middleware::Logger;
|
||||
use actix_web::{App, HttpServer, main};
|
||||
use hutils::logger::init_logger;
|
||||
#[main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
init_logger();
|
||||
|
||||
HttpServer::new(move || {
|
||||
let app = App::new();
|
||||
let app = app.configure(router::router_register);
|
||||
let app = app.wrap(Logger::default());
|
||||
app
|
||||
})
|
||||
.bind("0.0.0.0:8080")?
|
||||
.run()
|
||||
.await
|
||||
}
|
||||
@@ -18,7 +18,7 @@ pub async fn post_bank_card() -> String {
|
||||
String::from("Bill Post")
|
||||
}
|
||||
|
||||
#[delete("/bank-card")]
|
||||
#[delete("/bank-card/{id}")]
|
||||
pub async fn delete_bank_card() -> String {
|
||||
info!("this is delete bank card");
|
||||
String::from("Bill Delete")
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
pub mod bank_card;
|
||||
use actix_web::web;
|
||||
|
||||
pub mod bank_card;
|
||||
|
||||
pub fn router_register(cfg: &mut web::ServiceConfig) {
|
||||
cfg.configure(bank_card::bank_card_router_configure);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user