Skip to content

Commit

Permalink
Remove system_name.
Browse files Browse the repository at this point in the history
  • Loading branch information
duckonomy committed May 24, 2021
1 parent 695a8c8 commit 3038e1d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
1 change: 0 additions & 1 deletion geoapi/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class Project(Base):
id = Column(Integer, primary_key=True)
uuid = Column(UUID(as_uuid=True), default=uuid.uuid4, nullable=False)
tenant_id = Column(String, nullable=False)
system_name = Column(String, nullable=True)
system_id = Column(String, nullable=True)
system_path = Column(String, nullable=True)
system_file = Column(String, nullable=True)
Expand Down
3 changes: 1 addition & 2 deletions geoapi/routes/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
'description': fields.String(required=False),
'public': fields.Boolean(required=False),
'uuid': fields.String(),
'system_name': fields.String(),
'system_file': fields.String(),
'system_id': fields.String(),
'system_path': fields.String()
Expand Down Expand Up @@ -243,7 +242,7 @@ class ExportProject(Resource):
def put(self, projectId):
u = request.current_user
logger.info("Saving project to tapis for user {}: {}".format(u.username, api.payload))
return ProjectsService.export(u, api.payload, projectId)
return ProjectsService.export(u, api.payload, False, projectId)


@api.route('/<int:projectId>/users/')
Expand Down
8 changes: 7 additions & 1 deletion geoapi/routes/public_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
from geoapi.routes.projects import (ProjectsListing, ProjectResource,
ProjectFeaturesResource, ProjectFeatureResource,
ProjectOverlaysResource, ProjectPointCloudResource,
ProjectPointCloudsResource, ProjectTileServersResource)
ProjectPointCloudsResource, ProjectTileServersResource,
ExportProject)

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -59,6 +60,11 @@ class PublicProjectPointCloudsResource(ProjectPointCloudsResource, metaclass=Hid
pass


@api.route('/<int:projectId>/export/')
class PublicExportProject(ExportProject, metaclass=HideNonPublicMeta):
pass


@api.route('/<int:projectId>/point-cloud/<int:pointCloudId>/')
class PublicProjectPointCloudResource(ProjectPointCloudResource, metaclass=HideNonPublicMeta):
pass
Expand Down
12 changes: 3 additions & 9 deletions geoapi/services/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def create(data: dict, user: User) -> Project:
:param user: User
:return: Project
"""

project = Project(**data)
project.tenant_id = user.tenant_id
project.users.append(user)
Expand All @@ -57,7 +56,6 @@ def createRapidProject(data: dict, user: User) -> Project:
name=name,
description=system['description'],
tenant_id=user.tenant_id,
system_name=system['description'],
system_id=systemId
)

Expand Down Expand Up @@ -89,13 +87,15 @@ def createRapidProject(data: dict, user: User) -> Project:
'link': True,
'file_name': ''
},
True,
proj.id)

return proj

@staticmethod
def export(user: User,
data: dict,
observable: bool,
project_id: int) -> Project:
"""
Save a project UUID file to tapis
Expand All @@ -112,12 +112,6 @@ def export(user: User,
proj.system_file),
user.id])

if data['link']:
system = AgaveUtils(user.jwt).systemsGet(data['system_id'])
proj.system_name = system['description']
else:
proj.system_name = None

path = data['path']

if data['file_name'] == '':
Expand All @@ -128,7 +122,7 @@ def export(user: User,
file_name = '{}.{}'.format(file_prefix, 'hazmapper')

# if 'project' not in data['system_id'] and path == '/':
if 'project' not in data['system_id']:
if ('project' not in data['system_id'] and path == '/') or observable:
path = "/{}/{}".format(user.username, path)

proj.system_path = path
Expand Down

0 comments on commit 3038e1d

Please sign in to comment.