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

refactor namespace update route #3519

Merged
merged 2 commits into from
Feb 7, 2024
Merged

refactor namespace update route #3519

merged 2 commits into from
Feb 7, 2024

Conversation

heiytor
Copy link
Contributor

@heiytor heiytor commented Feb 6, 2024

Introducing a new method, NamespaceEdit, within the store to
facilitate the updating of a namespace's attributes. This new method
replaces the deprecated NamespaceRename and NamespaceSetSessionRecord.

Accompanying this change is the introduction of a new struct,
NamespaceChanges, designed to be a parameter for the NamespaceEdit
method. This struct consolidates all possible attributes that users can
modify. The use of the tag bson:"omitempty" helps avoid unnecessary
and undesirable if statements by handling empty values appropriately.

In the service layer, the method EditNamespace now calls the store
method with the specified changes. This method now takes the entire
request and determines its course of action (in this case, creating the
changes struct). The validation process within the service is removed
to centralize it in the router, streamlining code complexity.

As part of deprecating NamespaceRename, we're also renaming the
permission to Namespace.Update and NamespaceUpdate.

@heiytor heiytor self-assigned this Feb 6, 2024
@heiytor heiytor requested review from a team as code owners February 6, 2024 12:57
@heiytor heiytor force-pushed the refactor/namespace-edit branch 3 times, most recently from 9a92cf4 to e7faed6 Compare February 6, 2024 14:55
@heiytor heiytor force-pushed the refactor/namespace-edit branch 5 times, most recently from 900b5f2 to 0357a4f Compare February 7, 2024 13:54
Introducing a new method, `NamespaceEdit`, within the store to
facilitate the updating of a namespace's attributes. This new method
replaces the deprecated `NamespaceRename` and `NamespaceSetSessionRecord`.

Accompanying this change is the introduction of a new struct,
`NamespaceChanges`, designed to be a parameter for the `NamespaceEdit`
method. This struct consolidates all possible attributes that users can
modify. The use of the tag `bson:"omitempty"` helps avoid unnecessary
and undesirable `if` statements by handling empty values appropriately.

In the service layer, the method `EditNamespace` now calls the store
method with the specified changes. This method now takes the entire
request and determines its course of action (in this case, creating the
`changes` struct). The validation process within the service is removed
to centralize it in the router, streamlining code complexity.

As part of deprecating `NamespaceRename`, we're also renaming the
permission to `Namespace.Update` and `NamespaceUpdate`.
In response to commit 2bf4230, we're
removing the deprecated `NamespaceRename` method from the store. Now,
use `NamespaceEdit` instead.
@otavio otavio merged commit 1c13b91 into master Feb 7, 2024
8 checks passed
@otavio otavio deleted the refactor/namespace-edit branch February 7, 2024 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants