Skip to content

feat: add hosts and postures endpoints with CRUD operations#8

Merged
jaxxstorm merged 1 commit intomainfrom
new_endpoints
Jan 19, 2025
Merged

feat: add hosts and postures endpoints with CRUD operations#8
jaxxstorm merged 1 commit intomainfrom
new_endpoints

Conversation

@jaxxstorm
Copy link
Copy Markdown
Member

@jaxxstorm jaxxstorm commented Jan 19, 2025

Important

Add /hosts and /postures endpoints with CRUD operations and default posture handling in main.go, hosts.go, and postures.go.

  • Behavior:
    • Adds /hosts and /postures endpoints in main.go for managing hosts and postures.
    • Supports CRUD operations for hosts and postures, including special handling for default postures.
  • Hosts:
    • Implements RegisterRoutes in hosts.go to handle /hosts endpoints.
    • Provides functions for listing, creating, updating, and deleting hosts.
  • Postures:
    • Implements RegisterRoutes in postures.go to handle /postures endpoints.
    • Provides functions for listing, creating, updating, and deleting postures, with special routes for default postures.

This description was created by Ellipsis for cb39868. It will automatically update as commits are pushed.

@ellipsis-dev ellipsis-dev bot changed the title ... feat: add hosts and postures endpoints with CRUD operations Jan 19, 2025
@jaxxstorm
Copy link
Copy Markdown
Member Author

Fixes #6
Fixes #7

@jaxxstorm jaxxstorm merged commit f631cd0 into main Jan 19, 2025
@jaxxstorm jaxxstorm deleted the new_endpoints branch January 19, 2025 19:00
Copy link
Copy Markdown

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to cb39868 in 40 seconds

More details
  • Looked at 617 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. pkg/acl/hosts/hosts.go:42
  • Draft comment:
    Consider using a URL parameter for the host name in the DELETE /hosts endpoint instead of expecting a JSON body. This aligns with RESTful conventions and is more consistent with the GET /hosts/:name endpoint.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    This is a reasonable suggestion about API design and consistency. The code would be more RESTful and consistent if DELETE used the same URL parameter pattern as GET. However, both approaches are valid and commonly used. The current implementation works fine, and changing it would be a style preference rather than fixing a clear bug or issue.
    The current implementation with JSON body is also valid and has advantages - it's more extensible if more fields need to be added later, and some argue it's more explicit. The change would be purely stylistic.
    While both approaches are valid, consistency within the same API is valuable for developers using the API. The suggestion would improve the API's coherence.
    While this is a reasonable suggestion for improving API consistency, it's more of a style preference than a critical issue. The current implementation is valid and functional.

Workflow ID: wflow_Qbo8sOH3KrWaWoqg


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

p.PUT("", func(c *gin.Context) {
updatePosture(c, state)
})
p.DELETE("", func(c *gin.Context) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Consider using a URL parameter for the posture name in the DELETE /postures endpoint instead of expecting a JSON body. This aligns with RESTful conventions and is more consistent with the GET /postures/:name endpoint.

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