RFC: Further reduction of controller boilerplate (Phase 2 of removing ja_resource)
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 45/100
Rechercherichtung
Beginne damit, den def controller-Quote-Block, router.ex und die Controller-Deklarationen für action_fallback, DataToAttributes und IdsToIntegers des CodeCorpsWeb-Moduls zu lesen. Verfolge, wie sich die API- und Webhook-Schnittstellen derzeit unterscheiden. Als abgeschlossen gilt die Aufgabe, wenn eine Entscheidung zu den drei vorgeschlagenen Schritten erreicht und dokumentiert wurde, ohne Verhalten zu verbergen oder die falschen Plugs auf Webhooks anzuwenden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
We could do the following 3 items to further reduce boilerplate in controllers.
However, while boilerplate is reduced, all 3 of these actions also hide behavior which we may not want to hide.
Remove action_fallback CodeCorpsWeb.FallbackController from all controllers and instead move it into the CodeCorpsWeb module into the def controller quote block
This makes sense at first glance, but it does also put all of our controllers into basically the same basket, regardless of them being actual API controllers, or just webhook handlers, or something else entirely.
Unfortunately, it is not currently possible to specify multiple action fallbacks for the same controller, which would be an argument for doing this, since it would allow simultaneously specifying global and group-specific fallbacks.
Remove plug CodeCorpsWeb.Plug.DataToAttributes from all controllers and move it into router.ex into the :api pipeline.
We would have to separate our general api pipeline and the part of the pipeline that handles github and sprite webhooks, since we don't want this plug in that part, but it would make sense to do so anyway, since they are, in fact, different parts of the "interface".
Remove plug CodeCorpsWeb.Plug.IdsToIntegers from all controllers and move it into router.ex into the :api pipeline.
Basically same argument as above.
Really, these two plugs should be considered one pipeline, since their intention is to prepare and make sense of the data sent by our client.
@JoshSmith
What do you think? Overall, this would not take much time, maybe an hour, but I'm not really sure if it would help or hurt us.
- Vorherrschende Sprache
- Elixir
- Sterne
- 234
- Forks
- 82
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus code-corps/code-corps-api
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 15/100
code-corps/code-corps-api#1385 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 25/100
code-corps/code-corps-api#1384 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
code-corps/code-corps-api#1383 · 2 Kommentare ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
code-corps/code-corps-api#1382 · 2 Kommentare ·
-
Difficulty: Medium Skill: Elixir Time: 4 hours
code-corps/code-corps-api#1372 · 3 Kommentare · 1 zugewiesene Person ·
Alle Issues in code-corps/code-corps-api
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
phoenixframework/phoenix#6847 ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
-
moderation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
beyond-all-reason/teiserver#1584 · 1 Kommentar ·