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

MG-1962 - Add single endpoint to change status of domain #2127

Closed
wants to merge 1 commit into from

Conversation

janael-pinheiro
Copy link

What type of PR is this?

This is a feature because it adds the following functionality: adds a single endpoint to change domain status and an endpoint to remove domain.

What does this do?

removes the /domains/{domainID}/enabled, /domains/{domainID}/disabled, and /domains/{domainID}/freezed endpoints. Adds the /domains/{domainID}/status (HTTP PUT) endpoint that concentrates domain status change operations. Additionally, it adds the /domains/{domainID} (HTTP DELETE) endpoint to remove a specific domain.

Which issue(s) does this PR fix/relate to?

Have you included tests for your changes?

Yes, I have included tests for my changes. I added tests to evaluate the behavior of the new endpoints ( /domains/{domainID}/status and /domains/{domainID}).

Did you document any new/modified feature?

Yes, I have updated the documentation for the new feature. Yes, I updated the api/openapi/auth.yml file

Notes

Copy link
Collaborator

@dborovcanin dborovcanin left a comment

Choose a reason for hiding this comment

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

Please sign-off your commits (check DCO report) and fix CI.

@WashingtonKK WashingtonKK changed the title MG-1962 - add single endpoint to change status of domain MG-1962 - Add single endpoint to change status of domain Mar 27, 2024
@drasko
Copy link
Contributor

drasko commented Mar 28, 2024

@dborovcanin and @arvindh123 please review this one

/domains/{domainID}/disable:
post:
summary: Disable a domain
/domains/{domainID}/status:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is important to have one endpoint? It looks more self-documenting to me that way, than having sing status endpoint - which usually prompt me that it is status indicator (i.e. something I would use with GET to fetch the current status), and not a control switch.

@@ -349,6 +349,25 @@ func (lm *loggingMiddleware) CreateDomain(ctx context.Context, token string, d a
return lm.svc.CreateDomain(ctx, token, d)
}

func (lm *loggingMiddleware) DeleteDomain(ctx context.Context, token string, d auth.Domain) (err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably deletion was avoided for now because of cascade consequences - @dborovcanin must confirm. But probably you'll need to remove all resources related to this domain (things, channels, ...) once you decide to remove a specific domain.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@drasko This is correct, it requires a careful analysis due to the cascade nature of removal.

@dborovcanin
Copy link
Collaborator

@arvindh123 Please review this one.

@dborovcanin dborovcanin force-pushed the MG-1962 branch 2 times, most recently from 9f58fc1 to 1cb281f Compare April 3, 2024 11:07
Signed-off-by: Janael Pinheiro <ajp@cesar.org.br>
@dborovcanin
Copy link
Collaborator

After this comment and an internal discussion between the maintainer and due to the inactivity of this pull request, we decided to close this PR and linked issue, since we will keep the current approach. Both approaches diverge from the usual REST principle, the current one (with 3 endpoints) being less prone to errors and a little more verbose. @janael-pinheiro Thanks for the contribution and effort you put into this pull request.

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.

Feature: Single endpoint to change status of domain
4 participants