-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/1012 tabs and storages #1028
base: develop
Are you sure you want to change the base?
Conversation
…e' into feature/1012-tabs
…t-page-auto-create-storage
core/systems/project/_assembly.ex
Outdated
end | ||
else | ||
{:error, "Project creation failed"} | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
Next thing is to make the "storage creation" part of the transaction to prevent any project to exist without storage:
Multi.new()
|> Multi.insert(:project, project)
|> Multi.insert(:storage, fn %{project: inserted_project} -> prepare_storage(inserted_project) end))
|> EctoHelper.run(:auth, &update_auth/2)
|> Repo.transaction()
The idea is that you can capture the just inserted project from the transaction and use this one. Now the storage will not be created if the project failed to be created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check out the new version of this, and confirm this is what you were looking for.
@AdrienneMendrik de vertalingskeys staan hierin |
ik krijg het nog niet voor elkaar om te testen of de flash messages goed werken @mellelieuwes
|
{:ok, | ||
put_flash( | ||
socket, | ||
:info, | ||
dgettext("eyra-project", "node.data.empty.create-storage-success") | ||
)} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mellelieuwes deze :ok lijkt niet correct te zijn, maar als ik er :reply/:noreply van maak werkt het niet meer. Weet jij wat ik hier zou moeten teruggeven
endpoint | ||
) | ||
|> Ecto.Changeset.put_assoc(:node, project.root) | ||
end) | ||
|> EctoHelper.run(:auth, &update_auth/2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this line necessary here?
{:ok, Repo.preload(project, :root)} | ||
end) | ||
|> Multi.insert(:storage_endpoint, fn %{project: project} -> | ||
key = "project_node=#{project.root.id}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider this naming rule to be centralized somewhere, possibly in the Project.Private module.
No description provided.