mirror of https://git.48k.eu/ogserver
rest: use integer for repository ID
ID is integer, fix inconsistency in dc68d0f
('rest: add POST /client/repo')
master
parent
4567bce90b
commit
568d709361
14
src/rest.c
14
src/rest.c
|
@ -1896,16 +1896,15 @@ static int og_cmd_get_client_setup(json_t *element,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int og_dbi_update_client_repo(struct og_dbi *dbi,
|
||||
const char *mac,
|
||||
const char *repo_id)
|
||||
static int og_dbi_update_client_repo(struct og_dbi *dbi, const char *mac,
|
||||
uint32_t repo_id)
|
||||
{
|
||||
const char *msglog;
|
||||
dbi_result result;
|
||||
|
||||
result = dbi_conn_queryf(dbi->conn,
|
||||
"UPDATE ordenadores SET idrepositorio=%s "
|
||||
"WHERE mac='%s'",
|
||||
"UPDATE ordenadores SET idrepositorio=%u "
|
||||
"WHERE mac='%u'",
|
||||
repo_id, mac);
|
||||
|
||||
if (!result) {
|
||||
|
@ -1928,6 +1927,7 @@ static int og_cmd_post_client_repo(json_t *element,
|
|||
int ips_str_len = 0;
|
||||
struct og_dbi *dbi;
|
||||
dbi_result result;
|
||||
uint32_t repo_id;
|
||||
int err = 0, i;
|
||||
json_t *value;
|
||||
|
||||
|
@ -1935,7 +1935,7 @@ static int og_cmd_post_client_repo(json_t *element,
|
|||
if (!strcmp(key, "clients")) {
|
||||
err = og_json_parse_clients(value, params);
|
||||
} else if (!strcmp(key, "id")) {
|
||||
err = og_json_parse_string(value, ¶ms->id);
|
||||
err = og_json_parse_uint(value, &repo_id);
|
||||
params->flags |= OG_REST_PARAM_ID;
|
||||
}
|
||||
|
||||
|
@ -1974,7 +1974,7 @@ static int og_cmd_post_client_repo(json_t *element,
|
|||
|
||||
while (dbi_result_next_row(result)) {
|
||||
mac = dbi_result_get_string(result, "mac");
|
||||
err = og_dbi_update_client_repo(dbi, mac, params->id);
|
||||
err = og_dbi_update_client_repo(dbi, mac, repo_id);
|
||||
if (err != 0) {
|
||||
dbi_result_free(result);
|
||||
og_dbi_close(dbi);
|
||||
|
|
Loading…
Reference in New Issue