add: temporary CORS headers

add: better sql calls with JOIN
This commit is contained in:
Tobias Reisinger 2020-05-20 00:51:16 +02:00
parent 6050f1cc5f
commit 5a19e99627
7 changed files with 50 additions and 12 deletions

View file

@ -156,14 +156,10 @@ api_v1_schedules_STR_PUT(struct mg_connection *c, endpoint_args_t *args, struct
return;
}
int *relays = junction_relay_schedule_get_relays_ids(schedule->id);
for(int i = 0; relays[i] != 0; ++i)
relay_t **relays = relay_get_with_schedule(schedule->id);
for(int i = 0; relays[i] != NULL; ++i)
{
relay_t *relay = relay_get_by_id(relays[i]);
if(relay)
{
command_set_relay_schedule(relay);
}
command_set_relay_schedule(relays[i]);
}
cJSON *json_tag;