lenra-io / lenra-io/server

[Task] Simplify controllers resource links

Open
#535 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Elixir
Stars
6
Forks
0
PR merge metrics
No merged PRs in 30d

Description

What should be done

In the current state of the server, we have to check in every controller that the resources in the path match (ex: /apps/:app_id/envs/:env_id have to check that the env id is corresponding to the app id).

In order to handle those checks easily, create a macro automate them in the controllers or as a router function.

Also automate corresponding checks in the unit tests.

Technical recommandation

I think that a plug in the router could be the best way to automate that.

Is this task linked with any other ?

Unit test checking that kind of things have been added to the next issue resolution:

https://github.com/lenra-io/server/issues/532#issuecomment-1902619605

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the server's controllers and router to identify where nested resource relationships are currently checked. Review the unit-test work referenced in issue 532, then define the router or controller automation and corresponding tests; done means mismatched resources are rejected consistently without repeating checks in each controller.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.