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

implement use case for sending information to contacts #232

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

ChengShi-1
Copy link
Contributor

What this PR does / why we need it:

Implement the use case allowing users to send feedback to contacts of collection or dataset.

The use case should:

  • send the information contacts
  • receive back from the api with details as well

Which issue(s) this PR closes:

Related Dataverse PRs:

  • Depends on #

Special notes for your reviewer:

  • The contact function exists in both collection & dataset, so I create the folder outside of collection though we aim to implementing "Contact" button for collection for Q4 now.
  • It allows the users that didn't log in to send information as well, so no permission restriction applies.

Suggestions on how to test this:

visually inspect and run tests on it

Is there a release notes update needed for this change?:

Additional documentation:

@ChengShi-1 ChengShi-1 added Size: 3 A percentage of a sprint. 2.1 hours. GREI Re-arch GREI re-architecture-related Original size: 3 SPA.Q4.9 Collection Page: Contact FY25 Sprint 12 FY25 Sprint 12 (2024-12-04 - 2024-12-18) labels Dec 17, 2024
@ChengShi-1 ChengShi-1 linked an issue Dec 17, 2024 that may be closed by this pull request
Copy link
Contributor

@GPortas GPortas left a comment

Choose a reason for hiding this comment

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

The design, layering, and approach are correct, but we should use a different API endpoint for the reasons I mentioned in one of my comments. If there isn't an alternative endpoint in the API, we will need to implement one.

})

/* ... */
```
Copy link
Contributor

Choose a reason for hiding this comment

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

Typically, we add the phrase 'See use case definition.' right below the code. Please take a look at other examples. Additionally, it would be helpful to provide a high-level description of the DTO or at least mention the type of identifier (targetId) it handles (numeric database identifier vs persistent identifiers). I assume it uses the latter, since it is numeric and is the common one for all DV objects, but it would be good to clarify.

On the other hand, the syntax in the block is incorrect. You need to first create an instance of the test DTO and then pass it as a parameter. (contact: ContactDTO) is how the parameter is defined in the method, not how it is invoked.

src/contactInfo/domain/useCases/SubmitContactInfo.ts Outdated Show resolved Hide resolved
src/contactInfo/domain/useCases/SubmitContactInfo.ts Outdated Show resolved Hide resolved
src/contactInfo/domain/useCases/SubmitContactInfo.ts Outdated Show resolved Hide resolved

export class ContactRepository extends ApiRepository implements IContactRepository {
public async submitContactInfo(contactDTO: ContactDTO): Promise<Contact[]> {
return this.doPost(`/admin/feedback`, contactDTO)
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 we should use this API endpoint. It's an endpoint under the 'admin' basepath. These calls are restricted to administrators only, and AFAIK, they are limited to calls within the same host (they would fail if the consumer and the backend are not on the same host). Additionally, the call returns data that could be sensitive, such as the recipient's email address. Also, please take a look at the related comment in the endpoint definition https://github.com/IQSS/dataverse/blob/develop/src/main/java/edu/harvard/iq/dataverse/api/FeedbackApi.java#L33.

test/integration/contact/ContactRepository.test.ts Outdated Show resolved Hide resolved
test/unit/contact/SubmitContactInfo.test.ts Outdated Show resolved Hide resolved
@GPortas GPortas added the SPA.Q1 Not related to any specific Q1 feature label Jan 15, 2025
@cmbz cmbz added the FY25 Sprint 15 FY25 Sprint 15 (2025-01-15 - 2025-01-29) label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FY25 Sprint 12 FY25 Sprint 12 (2024-12-04 - 2024-12-18) FY25 Sprint 14 FY25 Sprint 14 (2025-01-02 - 2025-01-15) FY25 Sprint 15 FY25 Sprint 15 (2025-01-15 - 2025-01-29) GREI Re-arch GREI re-architecture-related Original size: 3 Size: 3 A percentage of a sprint. 2.1 hours. SPA.Q1 Not related to any specific Q1 feature SPA.Q4.9 Collection Page: Contact Waiting
Projects
Status: In Review 🔎
Development

Successfully merging this pull request may close these issues.

Implement use case for sending information to contacts
4 participants