Initial commit with Claude created service skeleton
This commit is contained in:
commit
09e538872d
13 changed files with 848 additions and 0 deletions
29
src/votes/handlers.rs
Normal file
29
src/votes/handlers.rs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use axum::{
|
||||
Router,
|
||||
extract::{Path, State},
|
||||
routing::{get, post},
|
||||
};
|
||||
|
||||
use super::{dto::CreateVoteRequest, service::VoteService};
|
||||
|
||||
pub fn router(service: Arc<VoteService>) -> Router {
|
||||
Router::new()
|
||||
.route("/votes", get(list))
|
||||
.route("/votes/{id}", get(get_by_id))
|
||||
.route("/votes", post(create))
|
||||
.with_state(service)
|
||||
}
|
||||
|
||||
async fn list(State(service): State<Arc<VoteService>>) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
async fn get_by_id(State(service): State<Arc<VoteService>>, Path(id): Path<u64>) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
async fn create(State(service): State<Arc<VoteService>>, body: axum::Json<CreateVoteRequest>) {
|
||||
todo!()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue