mirror of
https://github.com/zzzzDev4/ias-tea-axum.git
synced 2025-04-21 07:41:21 +02:00
fix: naming convention
This commit is contained in:
parent
79c245f5c8
commit
b77cde24e1
2 changed files with 4 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
||||||
CREATE TABLE IF NOT EXISTS teas (
|
CREATE TABLE IF NOT EXISTS tea (
|
||||||
id serial PRIMARY KEY,
|
id serial PRIMARY KEY,
|
||||||
teaname TEXT NOT NULL
|
teaname TEXT NOT NULL
|
||||||
);
|
);
|
|
@ -17,7 +17,7 @@ async fn retrieve(
|
||||||
State(state): State<MyState>,
|
State(state): State<MyState>,
|
||||||
) -> Result<impl IntoResponse, impl IntoResponse> {
|
) -> Result<impl IntoResponse, impl IntoResponse> {
|
||||||
println!("retrieve");
|
println!("retrieve");
|
||||||
match sqlx::query_as::<_, Tea>("SELECT * FROM teas WHERE id = $1")
|
match sqlx::query_as::<_, Tea>("SELECT * FROM tea WHERE id = $1")
|
||||||
.bind(id)
|
.bind(id)
|
||||||
.fetch_one(&state.pool)
|
.fetch_one(&state.pool)
|
||||||
.await
|
.await
|
||||||
|
@ -31,7 +31,7 @@ async fn retrieve_all(
|
||||||
State(state): State<MyState>,
|
State(state): State<MyState>,
|
||||||
) -> Result<impl IntoResponse, impl IntoResponse> {
|
) -> Result<impl IntoResponse, impl IntoResponse> {
|
||||||
println!("retrieve all");
|
println!("retrieve all");
|
||||||
match sqlx::query_as::<_, Tea>("SELECT * FROM teas LIMIT 100")
|
match sqlx::query_as::<_, Tea>("SELECT * FROM tea LIMIT 100")
|
||||||
.fetch_all(&state.pool)
|
.fetch_all(&state.pool)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ async fn add(
|
||||||
Json(data): Json<TeaNew>,
|
Json(data): Json<TeaNew>,
|
||||||
) -> Result<impl IntoResponse, impl IntoResponse> {
|
) -> Result<impl IntoResponse, impl IntoResponse> {
|
||||||
println!("add");
|
println!("add");
|
||||||
match sqlx::query_as::<_, Tea>("INSERT INTO teas (teaname) VALUES ($1) RETURNING id, teaname")
|
match sqlx::query_as::<_, Tea>("INSERT INTO tea (teaname) VALUES ($1) RETURNING id, teaname")
|
||||||
.bind(&data.teaname)
|
.bind(&data.teaname)
|
||||||
.fetch_one(&state.pool)
|
.fetch_one(&state.pool)
|
||||||
.await
|
.await
|
||||||
|
|
Loading…
Add table
Reference in a new issue