Skip to content

chore: Adjust all required and optional fields in API#4261

Merged
Rockyy174 merged 2 commits intooperately:mainfrom
Rockyy174:fix-endpoints
Mar 20, 2026
Merged

chore: Adjust all required and optional fields in API#4261
Rockyy174 merged 2 commits intooperately:mainfrom
Rockyy174:fix-endpoints

Conversation

@Rockyy174
Copy link
Copy Markdown
Collaborator

No description provided.

Signed-off-by: Adriano Lazzaretti <lazzaretti136@gmail.com>
Signed-off-by: Adriano Lazzaretti <lazzaretti136@gmail.com>
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In OperatelyWeb.Api.Goals.update_target/2, the repeated update_attrs = if attrs[:...], do: ... blocks could be simplified using something like attrs |> Map.take([:name, :start_value, :target_value, :unit]) |> Enum.reduce(%{}, ...) or by composing a mapping function, which would be easier to extend and less error-prone.
  • Now that the goal and project *_access_level inputs are required integers in both the API schema and TS types, consider introducing a shared enum or dedicated type for access levels instead of plain number/:integer to avoid magic values and make incorrect usage harder at compile time.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `OperatelyWeb.Api.Goals.update_target/2`, the repeated `update_attrs = if attrs[:...], do: ...` blocks could be simplified using something like `attrs |> Map.take([:name, :start_value, :target_value, :unit]) |> Enum.reduce(%{}, ...)` or by composing a mapping function, which would be easier to extend and less error-prone.
- Now that the goal and project `*_access_level` inputs are required integers in both the API schema and TS types, consider introducing a shared enum or dedicated type for access levels instead of plain `number`/`:integer` to avoid magic values and make incorrect usage harder at compile time.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Rockyy174 Rockyy174 merged commit 391d611 into operately:main Mar 20, 2026
3 checks passed
@Rockyy174 Rockyy174 deleted the fix-endpoints branch March 20, 2026 18:06
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.

1 participant