Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion server/mergin/sync/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

from .files import (
File,
UploadFile,
UploadChanges,
ChangesSchema,
ProjectFile,
Expand Down
4 changes: 2 additions & 2 deletions server/mergin/sync/public_api_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ def add_project(namespace): # noqa: E501

p = Project(**request.json, creator=current_user, workspace=workspace)
p.updated = datetime.utcnow()
db.session.add(p)
pa = ProjectAccess(p, public=request.json.get("public", False))

template_name = request.json.get("template", None)
Expand Down Expand Up @@ -228,7 +229,6 @@ def add_project(namespace): # noqa: E501
get_device_id(request),
)

db.session.add(p)
db.session.add(pa)
db.session.add(version)
db.session.commit()
Expand Down Expand Up @@ -1181,6 +1181,7 @@ def clone_project(namespace, project_name): # noqa: E501
workspace=ws,
)
p.updated = datetime.utcnow()
db.session.add(p)
pa = ProjectAccess(p, public=False)

try:
Expand All @@ -1206,7 +1207,6 @@ def clone_project(namespace, project_name): # noqa: E501
user_agent,
device_id,
)
db.session.add(p)
db.session.add(pa)
db.session.add(project_version)
db.session.commit()
Expand Down
2 changes: 1 addition & 1 deletion server/mergin/tests/test_project_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
ProjectFilePath,
)
from ..sync.files import ChangesSchema
from ..sync.schemas import ProjectListSchema, ProjectSchema
from ..sync.schemas import ProjectListSchema
from ..sync.utils import generate_checksum, is_versioned_file
from ..auth.models import User, UserProfile

Expand Down
2 changes: 1 addition & 1 deletion server/mergin/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def create_project(name, workspace, user, **kwargs):

p = Project(**project_params, **kwargs)
p.updated = datetime.utcnow()
db.session.add(p)
db.session.flush()

public = kwargs.get("public", False)
pa = ProjectAccess(p, public)
Expand Down