Skip to content
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

Feat/core create post #234

Merged
merged 30 commits into from
Dec 20, 2024
Merged

Feat/core create post #234

merged 30 commits into from
Dec 20, 2024

Conversation

juanzeen
Copy link
Contributor

@juanzeen juanzeen commented Oct 25, 2024

Descrição

PR para realizar a criação dos posts utilizando Ecto.multi e Ecto.transaction.

Pontos para atenção

  • Progressão nas execuções do multi;
  • Criação de tags via insert_all (upserts) funcionando corretamente, contudo é necesário passar todos os dados necessários para a criação/atualização da tag no mapa de cada tag;
  • Ainda tendo dificuldades para finalizar a criação, atualmente estou tendo problemas com o campo :user_id. Não consegui encontrar nenhum ID de usuário existente, além disso nem mesmo copiando uma struct %Usuario{} do seeder tive sucesso.

Possui novas configurações?

  • Alteração na função de criar post.

Chamadas de função usadass como teste

Post.create_post(%{usuario_id: "YlSUyZTP", titulo: "Teste", conteudo: "Testando a criação", link_imagem_capa: "umlinkqualquerdeteste", blog_tags: [%{nome: "noticia", id: "um", inserted_at: DateTime.utc_now(), updated_at: DateTime.utc_now}, %{nome: "teste", id: "dois", inserted_at: DateTime.utc_now(), updated_at: DateTime.utc_now}, %{nome: "backend", id: "tres", inserted_at: DateTime.utc_now(), updated_at: DateTime.utc_now}, %{nome: "funcionaporfavor", id: "quatro", inserted_at: DateTime.utc_now, updated_at: DateTime.utc_now}]})

@juanzeen juanzeen marked this pull request as draft October 25, 2024 21:06
@juanzeen juanzeen self-assigned this Oct 25, 2024
@juanzeen juanzeen force-pushed the feat/core-create-post branch from 2c10763 to 3ef2629 Compare December 9, 2024 21:28
@juanzeen juanzeen marked this pull request as ready for review December 10, 2024 02:11
@juanzeen juanzeen requested a review from zoedsoupe December 10, 2024 02:11
Copy link
Member

@zoedsoupe zoedsoupe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boa!

lib/pescarte/blog/post.ex Outdated Show resolved Hide resolved
lib/pescarte/blog/entity/tag.ex Outdated Show resolved Hide resolved
@zoedsoupe zoedsoupe enabled auto-merge (squash) December 20, 2024 10:16
@zoedsoupe zoedsoupe merged commit 8cb6b44 into main Dec 20, 2024
4 checks passed
@zoedsoupe zoedsoupe deleted the feat/core-create-post branch December 20, 2024 10:16
zoedsoupe added a commit that referenced this pull request Dec 20, 2024
zoedsoupe added a commit that referenced this pull request Dec 20, 2024
zoedsoupe added a commit that referenced this pull request Dec 20, 2024
zoedsoupe added a commit that referenced this pull request Dec 20, 2024
* Revert "Revert "Feat/core create post (#234)" (#245)"

This reverts commit 30beabd.

* correctly renames blog_posts column

* formatter

* minor fixes to migrations

* Update post.ex

* correctly rename N-N posts_tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants