api_v1.4/hub_api/geometry.py

26 lines
889 B
Python

"""
Geometry
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Project Author name guillermo.gutierrezmorote@concordia.ca
Code contributors: Peter Yefi peteryefi@gmail.com
"""
from flask import make_response, send_file
from flask_restful import Resource
from pathlib import Path
from hub_api.helpers.auth import role_required
from persistence.models import UserRoles
class Geometry(Resource):
def __init__(self):
data_path = (Path(__file__).parent.parent / 'data').resolve()
self._gtlf_path = (Path(data_path / 'DomparkBuilding.gltf')).resolve()
@role_required([UserRoles.Admin.value, UserRoles.Hub_Reader.value])
def get(self):
response = make_response(send_file(self._gtlf_path,
as_attachment=True,
mimetype='model/gltf+json, model/gltf-binary'))
return response