remove logging statements

Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
folling 2023-12-28 23:42:43 +01:00 committed by Folling
parent f925d90d6b
commit ee85c53354
Signed by: folling
SSH key fingerprint: SHA256:S9qEx5WCFFLK49tE/LKnKuJYM5sw+++Dn6qJbbyxnCY
6 changed files with 260 additions and 75 deletions

View file

@ -2,20 +2,36 @@
#include <cppbase/strings.hpp>
#include <objects/blueprint.hpp>
#include <objects/util.hpp>
#include <persistence/function_context.hpp>
#include <persistence/project.hpp>
IkarusEntity * ikarus_entity_create(struct IkarusProject * project, char const * name) {
LOG_INFO("creating new entity");
LOG_DEBUG("project={}; name={}", project->get_path().c_str(), name);
auto * ctx = project->get_function_context();
if (cppbase::is_empty_or_blank(name)) {
ctx->set_error("name is empty or blank", true, IkarusErrorInfo_Source_Client, IkarusErrorInfo_Type_Client_Input);
return nullptr;
}
// TODO
return ikarus::util::insert_object(
project,
IkarusObjectType_Entity,
name,
[](auto * db, IkarusId id) { return db->execute("INSERT INTO `entities`(`id`) VALUES(?)", id); },
[project](IkarusId id) { return project->get_entity(id); }
).unwrap_value_or(nullptr);
}
void ikarus_entity_delete(IkarusEntity * entity) {
ikarus::util::delete_object(entity);
}
bool ikarus_entity_is_linked_to_blueprint(IkarusEntity const * entity, struct IkarusBlueprint const * blueprint) {
return ikarus::util::check_exists(
entity,
ikarus::util::ExistsQueryData<IkarusId>{
.table_name = "entity_blueprint_links",
.where_field_name = "blueprint",
.where_field_value = blueprint->id,
.relation_desc = "linked blueprints"
}
)
.unwrap_value_or(false);
}
bool ikarus_entity_link_to_blueprint(IkarusEntity * entity, struct IkarusBlueprint * blueprint) {}