Skip to content

Commit

Permalink
Flush to DB right after project is created
Browse files Browse the repository at this point in the history
  • Loading branch information
harminius committed Nov 11, 2024
1 parent 489e8b0 commit 0f6ce55
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 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.flush()
pa = ProjectAccess(p, public=request.json.get("public", False))

template_name = request.json.get("template", None)
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

0 comments on commit 0f6ce55

Please sign in to comment.