remove logging statements
Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
parent
f925d90d6b
commit
ee85c53354
6 changed files with 260 additions and 75 deletions
|
|
@ -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) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue