Skip to content

Commit 1634179

Browse files
committed
fix(createpoint): Fix create point function
1 parent c811fc3 commit 1634179

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/opengeodeweb_back/routes/blueprint_routes.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,23 +283,42 @@ def save_viewable_file():
283283
def create_point():
284284
utils_functions.validate_request(flask.request, create_point_json)
285285
DATA_FOLDER_PATH = flask.current_app.config["DATA_FOLDER_PATH"]
286+
title = flask.request.json["title"]
286287
x = flask.request.json["x"]
287288
y = flask.request.json["y"]
288289
z = flask.request.json["z"]
289290
class_ = geode_functions.geode_object_class("PointSet3D")
290291
PointSet3D = class_.create()
291292
builder = geode_functions.create_builder("PointSet3D", PointSet3D)
292293
builder.create_point(opengeode.Point3D([x, y, z]))
293-
294+
builder.set_name(title)
295+
print(PointSet3D.name(), flush=True)
296+
name = PointSet3D.name()
294297
generated_id = str(uuid.uuid4()).replace("-", "")
298+
object_type = geode_functions.get_object_type("PointSet3D")
299+
saved_native_file_path = geode_functions.save(
300+
"PointSet3D", PointSet3D, DATA_FOLDER_PATH, generated_id + ".og_pts3d"
301+
)
295302
saved_viewable_file_path = geode_functions.save_viewable(
296303
"PointSet3D", PointSet3D, DATA_FOLDER_PATH, generated_id
297304
)
305+
print(saved_native_file_path, flush=True)
306+
307+
native_file_name = os.path.basename(saved_native_file_path[0])
308+
viewable_file_name = os.path.basename(saved_viewable_file_path)
309+
310+
print(f"{native_file_name=}", flush=True)
311+
print(f"{viewable_file_name=}", flush=True)
298312

299313
return flask.make_response(
300314
{
301315
"viewable_file_name": os.path.basename(saved_viewable_file_path),
302316
"id": generated_id,
317+
"name": name,
318+
"native_file_name": native_file_name,
319+
"viewable_file_name": viewable_file_name,
320+
"object_type": object_type,
321+
"geode_object": "PointSet3D",
303322
},
304323
200,
305324
)

0 commit comments

Comments
 (0)