From 4b0f963579548f476fefa75cd0b0f8e7a8749c87 Mon Sep 17 00:00:00 2001 From: Franklin Date: Tue, 25 Apr 2023 09:22:21 -0400 Subject: [PATCH] Fixed actix routing the new agent id req to the shortcode route --- sql/agent/get_with_id.sql | 2 +- sqlx-data.json | 124 +++++++++++++++++++------------------- src/routes/read.rs | 4 +- 3 files changed, 65 insertions(+), 65 deletions(-) diff --git a/sql/agent/get_with_id.sql b/sql/agent/get_with_id.sql index 8f9e53b..c26f225 100644 --- a/sql/agent/get_with_id.sql +++ b/sql/agent/get_with_id.sql @@ -7,4 +7,4 @@ SELECT profile_picture_url, time_created, last_updated -FROM agent WHERE id = $1 \ No newline at end of file +FROM agent WHERE id = $1; \ No newline at end of file diff --git a/sqlx-data.json b/sqlx-data.json index 03ae859..98792d5 100644 --- a/sqlx-data.json +++ b/sqlx-data.json @@ -694,6 +694,68 @@ }, "query": "UPDATE agent SET\n full_name = $1,\n shortcode = $2,\n credential = $3,\n credential_type = $4,\n profile_picture_url = $5,\n last_updated = $6\nWHERE id = $7\nRETURNING \n id,\n shortcode,\n full_name,\n credential,\n credential_type as \"credential_type: _\",\n profile_picture_url,\n time_created,\n last_updated;" }, + "971799e74ce858ded9f6b5206c7e7b38cc2817c0bed4be889546028b30b74e3d": { + "describe": { + "columns": [ + { + "name": "id", + "ordinal": 0, + "type_info": "Uuid" + }, + { + "name": "shortcode", + "ordinal": 1, + "type_info": "Varchar" + }, + { + "name": "full_name", + "ordinal": 2, + "type_info": "Varchar" + }, + { + "name": "credential", + "ordinal": 3, + "type_info": "Varchar" + }, + { + "name": "credential_type: _", + "ordinal": 4, + "type_info": "Varchar" + }, + { + "name": "profile_picture_url", + "ordinal": 5, + "type_info": "Varchar" + }, + { + "name": "time_created", + "ordinal": 6, + "type_info": "Timestamptz" + }, + { + "name": "last_updated", + "ordinal": 7, + "type_info": "Timestamptz" + } + ], + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false + ], + "parameters": { + "Left": [ + "Uuid" + ] + } + }, + "query": "SELECT \n id,\n shortcode,\n full_name,\n credential,\n credential_type as \"credential_type: _\",\n profile_picture_url,\n time_created,\n last_updated\nFROM agent WHERE id = $1;" + }, "a6f20728a46711e230dd31f5489a620554cea3e4093a3a4c727f91301811ffea": { "describe": { "columns": [ @@ -1242,68 +1304,6 @@ }, "query": "SELECT \nid,\nproject_state as \"project_state: _\",\nproject_type as \"project_type: _\",\nproject_condition as \"project_condition: _\",\nagent_id,\nlocation_id,\ntitle,\ndescription,\nadmin_tag,\nfinish_date,\nfloors,\nmedia as \"media: _\",\ntime_created,\nlast_updated\nFROM project WHERE id = ANY($1);" }, - "d65a90a10c18f22d7e9a266fa45b6ec2622b1a039cea6b9b65c48f441a3781e4": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Uuid" - }, - { - "name": "shortcode", - "ordinal": 1, - "type_info": "Varchar" - }, - { - "name": "full_name", - "ordinal": 2, - "type_info": "Varchar" - }, - { - "name": "credential", - "ordinal": 3, - "type_info": "Varchar" - }, - { - "name": "credential_type: _", - "ordinal": 4, - "type_info": "Varchar" - }, - { - "name": "profile_picture_url", - "ordinal": 5, - "type_info": "Varchar" - }, - { - "name": "time_created", - "ordinal": 6, - "type_info": "Timestamptz" - }, - { - "name": "last_updated", - "ordinal": 7, - "type_info": "Timestamptz" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Uuid" - ] - } - }, - "query": "SELECT \n id,\n shortcode,\n full_name,\n credential,\n credential_type as \"credential_type: _\",\n profile_picture_url,\n time_created,\n last_updated\nFROM agent WHERE id = $1" - }, "e15c1255cfa5d8075536949f04cb5bc5cc03336dee8cc417297ba02e7c8bff77": { "describe": { "columns": [], diff --git a/src/routes/read.rs b/src/routes/read.rs index d8d9ad2..2131bb6 100644 --- a/src/routes/read.rs +++ b/src/routes/read.rs @@ -31,8 +31,8 @@ pub async fn get_all_agents(db_conn: web::Data>) -> TypedHttpRespons services::read::get_all_agents(&db_conn).await } -#[get("/agent/{id}")] -pub async fn get_agent_with_id(db_conn: web::Data>, id: Path) -> TypedHttpResponse { +#[get("/agent/uid/{id}")] +pub async fn get_agent_with_id(db_conn: web::Data>, id: web::Path) -> TypedHttpResponse { services::read::get_agent_with_id(&db_conn, &id).await }