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

Add updateTrustedDomain GraphQL API #276

Merged
merged 1 commit into from
Dec 15, 2024
Merged

Conversation

henry0715-dev
Copy link
Contributor

Closes #2

@henry0715-dev
Copy link
Contributor Author

The pr below should be merged first.
#258

src/graphql.rs Outdated
@@ -522,6 +522,9 @@ struct MockAgentManager {}
#[cfg(test)]
#[async_trait::async_trait]
impl AgentManager for MockAgentManager {
async fn broadcast_trusted_domains(&self) -> Result<(), anyhow::Error> {
Ok(())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The broadcast_trusted_domains function in MockAgentManager has been modified to return Ok(()) for the purpose of executing test code

@sophie-cluml sophie-cluml removed the request for review from sehkone August 22, 2024 09:36
@henry0715-dev henry0715-dev changed the title [DRAFT] Add updateTrustedDomain GraphQL API [Draft] Add updateTrustedDomain GraphQL API Aug 22, 2024
@henry0715-dev henry0715-dev changed the title [Draft] Add updateTrustedDomain GraphQL API Add updateTrustedDomain GraphQL API Aug 27, 2024
@henry0715-dev henry0715-dev marked this pull request as ready for review August 27, 2024 00:11
@sophie-cluml
Copy link
Contributor

Could you rebase please?

@henry0715-dev henry0715-dev force-pushed the henry/modify-trusted-domains branch from 428be1a to 63f58fa Compare August 27, 2024 04:23
Copy link

codecov bot commented Aug 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.19%. Comparing base (238fb77) to head (f6f98f9).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #276      +/-   ##
==========================================
- Coverage   70.26%   70.19%   -0.07%     
==========================================
  Files          67       67              
  Lines       14400    14831     +431     
==========================================
+ Hits        10118    10411     +293     
- Misses       4282     4420     +138     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@henry0715-dev henry0715-dev changed the title Add updateTrustedDomain GraphQL API [WIP]Add updateTrustedDomain GraphQL API Aug 29, 2024
@henry0715-dev henry0715-dev force-pushed the henry/modify-trusted-domains branch from 63f58fa to e15d2ae Compare November 27, 2024 05:35
@henry0715-dev henry0715-dev changed the title [WIP]Add updateTrustedDomain GraphQL API Add updateTrustedDomain GraphQL API Nov 27, 2024
@henry0715-dev henry0715-dev force-pushed the henry/modify-trusted-domains branch from e15d2ae to 15add15 Compare November 27, 2024 05:58
@henry0715-dev
Copy link
Contributor Author

Could you rebase please?

It's done.

Cargo.toml Outdated Show resolved Hide resolved
src/graphql/trusted_domain.rs Show resolved Hide resolved
src/graphql/trusted_domain.rs Outdated Show resolved Hide resolved
@henry0715-dev
Copy link
Contributor Author

@sophie-cluml
#276 (comment)
I agree with what you said.

@henry0715-dev henry0715-dev force-pushed the henry/modify-trusted-domains branch 2 times, most recently from 3011f55 to 4d2108c Compare November 28, 2024 00:43
sophie-cluml
sophie-cluml previously approved these changes Nov 28, 2024
@@ -62,6 +62,29 @@ impl TrustedDomainMutation {
Ok(name)
}

/// Update a trusted domain, returning the new value if it passes domain validation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this API does not run validation, I think the documentation comment needs to be modified.

CHANGELOG.md Outdated
Comment on lines 12 to 13
- Added the `updateTrustedDomain` GraphQL API to modify the list of trusted
domains.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you clarify the meaning of modify the list here please? My understanding of updateTrustedDomain GraphQL API is that the API allows updating a single trusted domain. So I think ... to modify a trusted domain. is rather straightforward. But it could be that you intended something else, so please let me know what you think.

@henry0715-dev henry0715-dev force-pushed the henry/modify-trusted-domains branch from 4d2108c to 9b07b68 Compare December 3, 2024 07:08
@henry0715-dev
Copy link
Contributor Author

The clippy error that occurred during the rust version update was corrected by another PR(#364).
I will apply it when other PR is merged.

Cargo.toml Outdated
@@ -43,6 +43,7 @@ tokio = "1"
tower-http = { version = "0.6", features = ["fs", "trace"] }
tracing = "0.1"
vinum = { git = "https://github.com/vinesystems/vinum.git", tag = "1.0.3" }
regex = "1"
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is no longer needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I finished editing it.

@henry0715-dev henry0715-dev force-pushed the henry/modify-trusted-domains branch from 9b07b68 to 8531245 Compare December 5, 2024 05:53
Comment on lines +75 to +82
let name = {
let store = crate::graphql::get_store(ctx).await?;
let map = store.trusted_domain_map();
let old = review_database::TrustedDomain::from(old);
let new = review_database::TrustedDomain::from(new);
map.update(&old, &new)?;
new.name
};
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that your style, where a variable is declared early and assigned a specific value later, is still being used. I believe this approach is not ideal. Moreover, in this context, the name variable doesn't appear to be essential.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you have any specific expectations for the return type of the GraphQL API?
It seems that Result<()> cannot be used.

42 | #[Object]
   | ^^^^^^^^^ the trait `OutputType` is not implemented for `()`

Are you considering declaring and using a custom scalar type like Void?

Copy link
Contributor

Choose a reason for hiding this comment

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

I apologize for my confusion. I thought this was similar to what you had done before, but it seems inevitable for the later asynchronous code. Once again, I’m sorry for my mistake in not catching the later part.

CHANGELOG.md Outdated
@@ -7,6 +7,11 @@ Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- Added the `updateTrustedDomain` GraphQL API, allowing you to modify a trusted
Copy link
Contributor

Choose a reason for hiding this comment

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

I think "users" sound better than just "you".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I finished editing it.
Thank you.

@@ -63,6 +63,29 @@ impl TrustedDomainMutation {
Ok(name)
}

/// Update a trusted domain, returning the new value.
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than the imperative form, the third-person singular form of the verb is preferred.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I finished editing it.
Thank you.

@henry0715-dev henry0715-dev force-pushed the henry/modify-trusted-domains branch from 8531245 to f6f98f9 Compare December 13, 2024 06:30
@sehkone sehkone merged commit 39cd053 into main Dec 15, 2024
9 of 10 checks passed
@sehkone sehkone deleted the henry/modify-trusted-domains branch December 15, 2024 23:45
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.

trusted domains목록을 수정할 수 있는 GraphQL API 구현
3 participants