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

get database #550

Merged
merged 3 commits into from
Nov 28, 2024
Merged

get database #550

merged 3 commits into from
Nov 28, 2024

Conversation

pingu2k4
Copy link
Contributor

@pingu2k4 pingu2k4 commented Nov 28, 2024

Changes

  • Implemented Get Database

Issue

#347

Categorise the PR

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

Description by Korbit AI

What change is being made?

Implement the GetDatabase method in the DatabasesClient class to fetch database metadata using its unique ID, update the corresponding interface, and add comprehensive tests to ensure its functionality.

Why are these changes being made?

The GetDatabase feature is necessary to allow retrieval of database information from the server, aligning with the function's API documentation outlined in Appwrite. Previous implementations did not support this endpoint, and these changes facilitate interaction with database metadata, increase server support, and ensure robust functionality through new test cases.

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

@pingu2k4 pingu2k4 self-assigned this Nov 28, 2024
@pingu2k4 pingu2k4 linked an issue Nov 28, 2024 that may be closed by this pull request
Copy link

Code Coverage

Package Line Rate Branch Rate Complexity Health
PinguApps.Appwrite.Client 100% 100% 131
PinguApps.Appwrite.Server 100% 100% 112
PinguApps.Appwrite.Shared 100% 100% 1317
Summary 100% (3391 / 3392) 100% (651 / 653) 1560

Copy link

Test Results

3 500 tests  +3   3 500 ✅ +3   22s ⏱️ -1s
    3 suites ±0       0 💤 ±0 
    3 files   ±0       0 ❌ ±0 

Results for commit 5995bae. ± Comparison against base commit d4db0d1.

This pull request removes 340 and adds 343 tests. Note that renamed tests count towards both.
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ CreateUserJwt_ShouldReturnSuccess_WhenApiCallSucceeds(request: CreateUserJwtRequest { Duration = 1800, SessionId = "6748b64f002ed89cf957", UserId = "6748b64f002ed9eff394", ValidationContext = None })
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ CreateUserJwt_ShouldReturnSuccess_WhenApiCallSucceeds(request: CreateUserJwtRequest { Duration = null, SessionId = null, UserId = "6748b64f002ecaa58c1a", ValidationContext = None })
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ ListUserLogs_ShouldReturnSuccess_WhenApiCallSucceeds(request: ListUserLogsRequest { Queries = null, UserId = "6748b64f002ed4e3964c", ValidationContext = None })
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ ListUserLogs_ShouldReturnSuccess_WhenApiCallSucceeds(request: ListUserLogsRequest { Queries = null, UserId = "6748b64f002edae6f922", ValidationContext = None })
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ ListUserTargets_ShouldReturnSuccess_WhenApiCallSucceeds(request: ListUserTargetsRequest { Queries = null, UserId = "6748b64f002ee7d3e1b9", ValidationContext = None })
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ ListUserTargets_ShouldReturnSuccess_WhenApiCallSucceeds(request: ListUserTargetsRequest { Queries = null, UserId = "6748b64f002ee7e75232", ValidationContext = None })
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ UpdateUserLabels_ShouldReturnSuccess_WhenApiCallSucceeds(request: UpdateUserLabelsRequest { Labels = ["label1", "label2"], UserId = "6748b64f002eea4e6b3f", ValidationContext = None })
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ UpdateUserLabels_ShouldReturnSuccess_WhenApiCallSucceeds(request: UpdateUserLabelsRequest { Labels = ["label3", "label4"], UserId = "6748b64f002ee3a0d31a", ValidationContext = None })
PinguApps.Appwrite.Shared.Tests.Requests.Account.CreatePushTargetRequestTests ‑ IsValid_WithInvalidData_ReturnsFalse(request: CreatePushTargetRequest { Identifier = "", ProviderId = "provider123", TargetId = "6748b648003c3443a837", ValidationContext = None })
PinguApps.Appwrite.Shared.Tests.Requests.Account.CreatePushTargetRequestTests ‑ IsValid_WithInvalidData_ReturnsFalse(request: CreatePushTargetRequest { Identifier = null, ProviderId = "provider123", TargetId = "6748b648003c3022a386", ValidationContext = None })
…
PinguApps.Appwrite.Server.Tests.Clients.Databases.DatabasesClientTests ‑ GetDatabase_ShouldHandleException_WhenApiCallFails
PinguApps.Appwrite.Server.Tests.Clients.Databases.DatabasesClientTests ‑ GetDatabase_ShouldReturnErrorResponse_WhenExceptionOccurs
PinguApps.Appwrite.Server.Tests.Clients.Databases.DatabasesClientTests ‑ GetDatabase_ShouldReturnSuccess_WhenApiCallSucceeds
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ CreateUserJwt_ShouldReturnSuccess_WhenApiCallSucceeds(request: CreateUserJwtRequest { Duration = 1800, SessionId = "6748b77600234af28044", UserId = "6748b77600234c8248d3", ValidationContext = None })
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ CreateUserJwt_ShouldReturnSuccess_WhenApiCallSucceeds(request: CreateUserJwtRequest { Duration = null, SessionId = null, UserId = "6748b77600233332ffd1", ValidationContext = None })
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ ListUserLogs_ShouldReturnSuccess_WhenApiCallSucceeds(request: ListUserLogsRequest { Queries = null, UserId = "6748b776002350b137bc", ValidationContext = None })
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ ListUserLogs_ShouldReturnSuccess_WhenApiCallSucceeds(request: ListUserLogsRequest { Queries = null, UserId = "6748b77600235a3acbf2", ValidationContext = None })
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ ListUserTargets_ShouldReturnSuccess_WhenApiCallSucceeds(request: ListUserTargetsRequest { Queries = null, UserId = "6748b776002352de1fab", ValidationContext = None })
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ ListUserTargets_ShouldReturnSuccess_WhenApiCallSucceeds(request: ListUserTargetsRequest { Queries = null, UserId = "6748b776002354444227", ValidationContext = None })
PinguApps.Appwrite.Server.Tests.Clients.Users.UsersClientTests ‑ UpdateUserLabels_ShouldReturnSuccess_WhenApiCallSucceeds(request: UpdateUserLabelsRequest { Labels = ["label1", "label2"], UserId = "6748b77600235a0209e7", ValidationContext = None })
…

@pingu2k4 pingu2k4 merged commit 663a9ff into dev Nov 28, 2024
6 checks passed
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

  • Add logging for exceptions and differentiate expected API exceptions from unexpected runtime errors to improve debugging.
Files scanned
File Path Reviewed
src/PinguApps.Appwrite.Server/Clients/IDatabasesClient.cs
src/PinguApps.Appwrite.Server/Clients/DatabasesClient.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

Comment on lines +86 to +89
catch (Exception e)
{
return e.GetExceptionResponse<Database>();
}
Copy link

Choose a reason for hiding this comment

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

category Error Handling severity potentially major

Log exception before returning the exception response.

Tell me more

Consider logging the exception before returning the exception response. This will help with debugging and monitoring the application. You can add a logging statement like _logger.LogError(e, "Error occurred while getting database"); before returning the exception response.

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

Comment on lines +86 to +89
catch (Exception e)
{
return e.GetExceptionResponse<Database>();
}
Copy link

Choose a reason for hiding this comment

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

category Functionality severity potentially major

Overly broad exception handling

Tell me more

What is the issue?
The catch block catches all exceptions without distinguishing between expected API exceptions and unexpected runtime exceptions.

Why this matters
In a database retrieval operation, different types of failures (e.g., database not found vs network error) should be handled differently to provide appropriate error responses.

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

@pingu2k4 pingu2k4 deleted the 347-get-database branch December 6, 2024 17:50
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.

Get Database
1 participant