Commit 80194260 authored by jan.koester's avatar jan.koester
Browse files

test

parent 0828166f
Loading
Loading
Loading
Loading
Loading
+11 −3
Changes for src/api.cpp: 11 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -177,15 +177,20 @@ public:
                        }
                    }

                    json_object* respid = json_object_new_object();
                    json_object* value  = json_object_new_object();

                    if (name.empty() || desc.empty() || gpoid.empty()) {
                        json_object_object_add(value, gpoid.empty() ? "" : gpoid.c_str(),
                                               json_object_new_boolean(false));
                        json_object_object_add(respid, "gpoadd", value);
                        json_object_array_add(response, respid);
                        continue;
                    }

                    json_object* respid = json_object_new_object();
                    json_object* value  = json_object_new_object();

                    ::uuid::uuid id(gpoid.c_str());

                    try {
                        class GpoData gdat(id);
                        gdat.setName(name.c_str());
                        gdat.setDesc(desc.c_str());
@@ -201,6 +206,9 @@ public:
                        } else {
                            json_object_object_add(value, id.c_str(), json_object_new_boolean(false));
                        }
                    } catch (...) {
                        json_object_object_add(value, id.c_str(), json_object_new_boolean(false));
                    }

                    json_object_object_add(respid, "gpoadd", value);
                    json_object_array_add(response, respid);