feat(activity): S4 — Action ReactWith + DTO (#543) - #561
Merged
Merged
Conversation
Encapsula criar/toggle-off/trocar reação num único ponto de domínio, espelhando o padrão de Timeline/Actions/CreatePost.
Clintonrocha98
requested changes
Sep 14, 2026
…#561 Substitui o where()+first()/create() manual por firstOrCreate(), evitando a race entre o SELECT e o INSERT ao criar a primeira reação — sugestão do review do Clintonrocha98 na PR.
hefeus
dismissed stale reviews from BrunaDomingues and GabrielFVDev
via
September 14, 2026 21:09
580aa21
hefeus
requested review from
BrunaDomingues,
Clintonrocha98 and
GabrielFVDev
September 14, 2026 21:12
Clintonrocha98
approved these changes
Sep 15, 2026
BrunaDomingues
approved these changes
Sep 15, 2026
7 tasks
gvieira18
approved these changes
Sep 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contexto
Fatia S4 do subsistema de reações da timeline web (#539). A S3 (#542) entregou o model
UserReaction+ factory + relação emTimeline; esta fatia encapsula a regra de negócio de reagir num único ponto de domínio testável, espelhando o padrão deTimeline/Actions/CreatePost.Sem essa Action, criar/trocar/remover uma reação ficaria espalhado em quem chama (Livewire, controller, etc.), com risco de duplicar linha para o mesmo
(user_id, timeline_id)ou deixar a mutação fora de uma transação.Alterações
Reaction/DTOs/ReactWithDTO.php—readonly,userId,timelineId,reaction: TimelineReactionReaction/Actions/ReactWith.php—handle()dentro deDB::transaction, com os 3 caminhos:nullReactWithTest.php): os 4 cenários do BDD da issue + isolamento entre usuários no mesmo timeline + isolamento entre timelines do mesmo usuário + garantia de que a troca de reação fazUPDATEna mesma linha (não delete+insert)Plano de Testes
make check(oucomposer check)php vendor/bin/pest --compact app-modules/activity/tests/Unit/Reaction/ReactWithTest.phpnullid) e retorna a nova(user_id, timeline_id), mesmo entre usuários/timelines diferentesIssues Relacionadas
Closes #543
Related to #539