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