1
0
Fork 0
mirror of https://gitlab.com/msrd0/gotham-restful.git synced 2025-04-20 06:54:46 +00:00

add put requests

This commit is contained in:
Dominic 2019-09-27 21:33:24 +02:00
parent d13155c90a
commit 6751f840da
Signed by: msrd0
GPG key ID: DCC8C247452E98F9
4 changed files with 93 additions and 1 deletions

View file

@ -54,6 +54,24 @@ impl CreateResource<User, Success<()>> for Users
}
}
impl ChangeAllResource<Vec<User>, Success<()>> for Users
{
fn change_all(_state : &mut State, body : Vec<User>) -> Success<()>
{
info!("Changing all Users to {:?}", body.into_iter().map(|u| u.username).collect::<Vec<String>>());
().into()
}
}
impl ChangeResource<u64, User, Success<()>> for Users
{
fn change(_state : &mut State, id : u64, body : User) -> Success<()>
{
info!("Change User {} to {}", id, body.username);
().into()
}
}
impl Resource for Users
{
fn setup<D : DrawResourceRoutes>(mut route : D)
@ -61,6 +79,8 @@ impl Resource for Users
route.index::<_, Self>();
route.get::<_, _, Self>();
route.create::<_, _, Self>();
route.change_all::<_, _, Self>();
route.change::<_, _, _, Self>();
}
}