changing profile id to schema in the whole project
This commit is contained in:
@@ -20,11 +20,11 @@ pub async fn get_table_structure(
|
||||
) -> Result<TableStructureResponse, Status> {
|
||||
let profile_name = request.profile_name;
|
||||
let table_name = request.table_name;
|
||||
let table_schema = "gen";
|
||||
let table_schema = &profile_name;
|
||||
|
||||
// 1. Validate Profile
|
||||
let profile = sqlx::query!(
|
||||
"SELECT id FROM profiles WHERE name = $1",
|
||||
let schema = sqlx::query!(
|
||||
"SELECT id FROM schemas WHERE name = $1",
|
||||
profile_name
|
||||
)
|
||||
.fetch_optional(db_pool)
|
||||
@@ -36,8 +36,8 @@ pub async fn get_table_structure(
|
||||
))
|
||||
})?;
|
||||
|
||||
let profile_id = match profile {
|
||||
Some(p) => p.id,
|
||||
let schema_id = match schema {
|
||||
Some(s) => s.id,
|
||||
None => {
|
||||
return Err(Status::not_found(format!(
|
||||
"Profile '{}' not found",
|
||||
@@ -48,8 +48,8 @@ pub async fn get_table_structure(
|
||||
|
||||
// 2. Validate Table within Profile
|
||||
sqlx::query!(
|
||||
"SELECT id FROM table_definitions WHERE profile_id = $1 AND table_name = $2",
|
||||
profile_id,
|
||||
"SELECT id FROM table_definitions WHERE schema_id = $1 AND table_name = $2",
|
||||
schema_id,
|
||||
table_name
|
||||
)
|
||||
.fetch_optional(db_pool)
|
||||
|
||||
Reference in New Issue
Block a user