Skip to content

Commit

Permalink
Improve project create flask command
Browse files Browse the repository at this point in the history
  • Loading branch information
harminius committed Nov 20, 2024
1 parent 3d8612d commit c824498
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions server/mergin/sync/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,21 @@ def project():
@project.command()
@click.argument("name")
@click.argument("namespace")
@click.argument("user")
def create(name, namespace, user): # pylint: disable=W0612
@click.argument("username")
def create(name, namespace, username): # pylint: disable=W0612
"""Create blank project"""
workspace = current_app.ws_handler.get_by_name(namespace)
user = User.query.get(int(user))
if not workspace:
print("ERROR: Workspace not found")
return
user = User.query.filter_by(username=username).first()
if not user:
print("ERROR: User not found")
return
p = Project.query.filter_by(name=name, workspace_id=workspace.id).first()
if p:
print("ERROR: Project name already exists")
return
project_params = dict(
creator=user,
name=name,
Expand Down

0 comments on commit c824498

Please sign in to comment.