Skip to content

Commit

Permalink
fix: add check and reorder based on schema before PUT request
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepanshKhurana committed Aug 9, 2024
1 parent 2ce64f5 commit 3d72a2c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/logic/api_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ put_row <- function(
is_update = FALSE
) {
endpoint <- ifelse(is_update, "update", "create")

table_schema <- get_schema(
table_name
)$classes |>
names()

input_list <- c(...)
input_list <- input_list[order(table_schema)]

request(make_endpoint(endpoint)) |>
req_headers(
accept = "*/*",
Expand All @@ -132,7 +141,7 @@ put_row <- function(
req_method("PUT") |>
req_url_query(
"table_name" = table_name,
"input_list" = c(...),
"input_list" = input_list,
"show_old" = tolower(show_old),
.multi = "explode"
) |>
Expand Down

0 comments on commit 3d72a2c

Please sign in to comment.