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

Database indexes #555

Merged
merged 9 commits into from
Dec 6, 2024
Merged

Database indexes #555

merged 9 commits into from
Dec 6, 2024

Conversation

pingu2k4
Copy link
Contributor

@pingu2k4 pingu2k4 commented Dec 6, 2024

Changes

  • Implemented List Indexes
  • Implemented Create Index
  • Implemented Delete index
  • Implemented Get Index

Issue

Categorise the PR

  • feature
  • bug
  • docs
  • security
  • meta
  • patch
  • minor
  • major

Description by Korbit AI

What change is being made?

Implement database indexing functionality, including listing, creating, getting, and deleting indexes, along with corresponding tests.

Why are these changes being made?

These changes are introduced to support enhanced database operations by adding index management functions, reducing query times, and improving performance. Prior functionality did not support index operations, so this enhancement addresses a gap in our database client capabilities. Comprehensive testing was added to ensure the robustness of the new features.

Is this description stale? Ask me to generate a new description by commenting /korbit-generate-pr-description

@pingu2k4 pingu2k4 self-assigned this Dec 6, 2024
Copy link

github-actions bot commented Dec 6, 2024

Code Coverage

Package Line Rate Branch Rate Complexity Health
PinguApps.Appwrite.Client 100% 100% 131
PinguApps.Appwrite.Server 100% 100% 145
PinguApps.Appwrite.Shared 100% 100% 1301
Summary 100% (3556 / 3557) 100% (635 / 637) 1577

Copy link

github-actions bot commented Dec 6, 2024

Test Results

3 602 tests  +13   3 602 ✅ +13   25s ⏱️ -1s
    3 suites ± 0       0 💤 ± 0 
    3 files   ± 0       0 ❌ ± 0 

Results for commit 2243fe7. ± Comparison against base commit 58bfc36.

This pull request removes 340 and adds 353 tests. Note that renamed tests count towards both.
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ CreateUserJwt_ShouldReturnSuccess_WhenApiCallSucceeds(request: CreateUserJwtRequest { Duration = 1800, SessionId = "67533f13001ddee22903", UserId = "67533f13001dd80bb251", ValidationContext = None })
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ CreateUserJwt_ShouldReturnSuccess_WhenApiCallSucceeds(request: CreateUserJwtRequest { Duration = null, SessionId = null, UserId = "67533f13001dd09f5658", ValidationContext = None })
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ ListUserLogs_ShouldReturnSuccess_WhenApiCallSucceeds(request: ListUserLogsRequest { Queries = null, UserId = "67533f13001deb03fc1d", ValidationContext = None })
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ ListUserLogs_ShouldReturnSuccess_WhenApiCallSucceeds(request: ListUserLogsRequest { Queries = null, UserId = "67533f13001deedafcb0", ValidationContext = None })
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ ListUserTargets_ShouldReturnSuccess_WhenApiCallSucceeds(request: ListUserTargetsRequest { Queries = null, UserId = "67533f13001de6d3e243", ValidationContext = None })
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ ListUserTargets_ShouldReturnSuccess_WhenApiCallSucceeds(request: ListUserTargetsRequest { Queries = null, UserId = "67533f13001deb758228", ValidationContext = None })
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ UpdateUserLabels_ShouldReturnSuccess_WhenApiCallSucceeds(request: UpdateUserLabelsRequest { Labels = ["label1", "label2"], UserId = "67533f13001de20a3f2c", ValidationContext = None })
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ UpdateUserLabels_ShouldReturnSuccess_WhenApiCallSucceeds(request: UpdateUserLabelsRequest { Labels = ["label3", "label4"], UserId = "67533f13001deabe6b84", ValidationContext = None })
PinguApps.Appwrite.Shared.Tests.Requests.Account.CreatePushTargetRequestTests ‑ IsValid_WithInvalidData_ReturnsFalse(request: CreatePushTargetRequest { Identifier = "", ProviderId = "provider123", TargetId = "67533f0c000918bca141", ValidationContext = None })
PinguApps.Appwrite.Shared.Tests.Requests.Account.CreatePushTargetRequestTests ‑ IsValid_WithInvalidData_ReturnsFalse(request: CreatePushTargetRequest { Identifier = null, ProviderId = "provider123", TargetId = "67533f0c00091a9ade24", ValidationContext = None })
…
PinguApps.Appwrite.Server.Tests.Clients.Databases.DatabasesClientTests ‑ CreateIndex_ShouldHandleException_WhenApiCallFails
PinguApps.Appwrite.Server.Tests.Clients.Databases.DatabasesClientTests ‑ CreateIndex_ShouldReturnErrorResponse_WhenExceptionOccurs
PinguApps.Appwrite.Server.Tests.Clients.Databases.DatabasesClientTests ‑ CreateIndex_ShouldReturnSuccess_WhenApiCallSucceeds
PinguApps.Appwrite.Server.Tests.Clients.Databases.DatabasesClientTests ‑ DeleteIndex_ShouldHandleException_WhenApiCallFails
PinguApps.Appwrite.Server.Tests.Clients.Databases.DatabasesClientTests ‑ DeleteIndex_ShouldReturnErrorResponse_WhenExceptionOccurs
PinguApps.Appwrite.Server.Tests.Clients.Databases.DatabasesClientTests ‑ DeleteIndex_ShouldReturnSuccess_WhenApiCallSucceeds
PinguApps.Appwrite.Server.Tests.Clients.Databases.DatabasesClientTests ‑ GetIndex_ShouldHandleException_WhenApiCallFails
PinguApps.Appwrite.Server.Tests.Clients.Databases.DatabasesClientTests ‑ GetIndex_ShouldReturnErrorResponse_WhenExceptionOccurs
PinguApps.Appwrite.Server.Tests.Clients.Databases.DatabasesClientTests ‑ GetIndex_ShouldReturnSuccess_WhenApiCallSucceeds
PinguApps.Appwrite.Server.Tests.Clients.Databases.DatabasesClientTests ‑ ListIndexes_ShouldHandleException_WhenApiCallFails
…

@pingu2k4 pingu2k4 merged commit ef242d4 into dev Dec 6, 2024
6 checks passed
@pingu2k4 pingu2k4 deleted the database-indexes branch December 6, 2024 18:49
Copy link

@korbit-ai korbit-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.

Review Summary by Korbit AI

Code Execution Comments

  • Ensure request validation includes specific error handling to prevent masking as generic exceptions.
Suppressed issues based on your team's Korbit activity
This issue Is similar to Because
lines 616:619:

Consider logging the exception before returning the exception response.

This will help in debugging and tracking issues. You can add a log statement like _logger.LogError(e, "Error occurred while listing indexes"); before returning the exception response.

Log exceptions before returning an exception response.

Similar issues were not addressed in the past

When you react to issues (for example, an upvote or downvote) or you fix them, Korbit will tune future reviews based on these signals.

Files scanned
File Path Reviewed
src/PinguApps.Appwrite.Server/Clients/DatabasesClient.cs
src/PinguApps.Appwrite.Server/Clients/IDatabasesClient.cs

Explore our documentation to understand the languages and file types we support and the files we ignore.

Need a new review? Comment /korbit-review on this PR and I'll review your latest changes.

Korbit Guide: Usage and Customization

Interacting with Korbit

  • You can manually ask Korbit to review your PR using the /korbit-review command in a comment at the root of your PR.
  • You can ask Korbit to generate a new PR description using the /korbit-generate-pr-description command in any comment on your PR.
  • Too many Korbit comments? I can resolve all my comment threads if you use the /korbit-resolve command in any comment on your PR.
  • Chat with Korbit on issues we post by tagging @korbit-ai in your reply.
  • Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.

Customizing Korbit

  • Check out our docs on how you can make Korbit work best for you and your team.
  • Customize Korbit for your organization through the Korbit Console.

Current Korbit Configuration

General Settings
Setting Value
Review Schedule Automatic excluding drafts
Max Issue Count 10
Automatic PR Descriptions
Issue Categories
Category Enabled
Naming
Database Operations
Documentation
Logging
Error Handling
Systems and Environment
Objects and Data Structures
Readability and Maintainability
Asynchronous Processing
Design Patterns
Third-Party Libraries
Performance
Security
Functionality

Feedback and Support

{
try
{
request.Validate(true);
Copy link

Choose a reason for hiding this comment

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

category Functionality

Validation Error Handling Not Specific

Tell me more

What is the issue?
The validation of requests is marked as required (true), but there's no error handling specific to validation failures, which could mask validation errors as generic exceptions.

Why this matters
When validation fails, it will be caught in the generic catch block, making it difficult to distinguish between validation errors and other types of exceptions. This affects error handling and debugging.

Chat with Korbit by mentioning @korbit-ai, and give a 👍 or 👎 to help Korbit improve your reviews.

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.

Delete Index Get Index Create Index List Indexes
1 participant