Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

GO-4459: REST API Docs & Refinement #2073

Draft
wants to merge 38 commits into
base: main
Choose a base branch
from
Draft

Conversation

jmetrikat
Copy link
Member

@jmetrikat jmetrikat commented Feb 2, 2025

  • Add comments for swagger data models
  • Fix mapping of errors originating from middleware functions
  • Add last_modified sort criterion as fallback for last_opened sort
  • Add endpoint GET /spaces/:space_id
  • Add endpoint GET /spaces/:space_id/members/:member_id
  • Add endpoints for lists (collections)
    • GET /spaces/:space_id/lists/:list_id/objects
    • POST /spaces/:space_id/lists/:list_id/objects
    • DELETE /spaces/:space_id/lists/:list_id/objects
  • Return 404 for deleted object from GET /spaces/:space_id/objects/:object_id
  • Add relation format type to detail entries and change value keys:
    {
      "id": "last_modified_date",
      "details": {
        "type": "date",
        "date": "2024-02-14T12:34:56Z"
      }
    }
    
  • Return custom relations in details of object response
  • Add make swagger for generation and format
  • Add more detailed endpoint descriptions

Copy link

github-actions bot commented Feb 2, 2025

New Coverage 50.6% of statements
Patch Coverage 25.4% of changed statements (104/410)

Coverage provided by https://github.com/seriousben/go-patch-cover-action

@jmetrikat jmetrikat changed the title GO-4459: REST API Documentation GO-4459: REST API Docs & Refinement Feb 12, 2025
Copy link

Testomat.io Report 🟢 SMOKE-TEST PASSED
Tests ✔️ 8 tests run
Summary 🟢 8 passed; 🟡 0 skipped
Duration 🕐 12 minutes, 57 seconds
Testomat.io Report 📊 Run #6cda6f75
Job 🗂️ Smoke Tests / smoke-test
Operating System 🖥️ Linux X64

✅ Passed Tests (8)

  • Revoking an invite link (3 minutes, 7 seconds)
  • User cancels their join request (1 minute, 20 seconds)
  • User deletes the space and rejoins later (1 minute, 38 seconds)
  • Owner changes the rights of a user from Viewer to Editor (1 minute, 48 seconds)
  • Owner approves a join request with Editor permissions (1 minute, 33 seconds)
  • Owner declines a join request (1 minute, 4 seconds)
  • Owner removes a participant from the space (1 minute, 20 seconds)
  • Sync on staging nodes (1 minute, 4 seconds)

@jmetrikat jmetrikat requested a review from Copilot February 26, 2025 17:43
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 33 out of 33 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

core/api/internal/search/service.go:123

  • Accessing the first element of 'sorts' in the Search function without confirming its existence may cause a runtime error. Ensure that 'sorts' is non-empty before accessing its first element.
dateToSortAfter := sorts[0].RelationKey

Comment on lines +80 to +83
func (s *ListService) RemoveObjectFromList(ctx context.Context, spaceId string, listId string, objectId string) error {
resp := s.mw.ObjectCollectionRemove(ctx, &pb.RpcObjectCollectionRemoveRequest{
ContextId: spaceId,
ObjectIds: []string{objectId},
Copy link
Preview

Copilot AI Feb 26, 2025

Choose a reason for hiding this comment

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

The implementation of RemoveObjectFromList accepts a single objectId, but the Service interface expects a slice of objectIds. Update the method signature (or the interface) so they match.

Suggested change
func (s *ListService) RemoveObjectFromList(ctx context.Context, spaceId string, listId string, objectId string) error {
resp := s.mw.ObjectCollectionRemove(ctx, &pb.RpcObjectCollectionRemoveRequest{
ContextId: spaceId,
ObjectIds: []string{objectId},
func (s *ListService) RemoveObjectFromList(ctx context.Context, spaceId string, listId string, objectIds []string) error {
resp := s.mw.ObjectCollectionRemove(ctx, &pb.RpcObjectCollectionRemoveRequest{
ContextId: spaceId,
ObjectIds: objectIds,

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@@ -48,18 +48,19 @@ func (s *SearchService) GlobalSearch(ctx context.Context, request SearchRequest,
baseFilters := s.prepareBaseFilters()
queryFilters := s.prepareQueryFilter(request.Query)
sorts := s.prepareSorts(request.Sort)
Copy link
Preview

Copilot AI Feb 26, 2025

Choose a reason for hiding this comment

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

Accessing the first element of 'sorts' without validating that the slice is non-empty could lead to a panic. Consider adding a check before using sorts[0].

Suggested change
sorts := s.prepareSorts(request.Sort)
sorts := s.prepareSorts(request.Sort)
if len(sorts) == 0 {
return nil, 0, false, errors.New("no sorts provided")
}

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant