Skip to content

Conversation

@hoegertn
Copy link
Member

@hoegertn hoegertn commented Nov 4, 2025

  • Added additionalContacts, email, and resultServiceEmail fields to the Club type in the GraphQL schema.
  • Updated input types SaveClubInput and ModifyClubInput to include additionalContactIds, email, and resultServiceEmail.

Summary by CodeRabbit

  • New Features

    • Added email and result service email fields to club profiles.
    • Added support for managing additional contacts per club.
    • Introduced stricter email format validation for clubs, persons, and associations.
  • Documentation

    • Updated docs to reflect new club properties and input fields.
    • Added documentation page for the email validation pattern.
  • Tests

    • Added validation tests for invalid and valid club email and result service email formats.

- Added `additionalContacts`, `email`, and `resultServiceEmail` fields to the Club type in the GraphQL schema.
- Updated input types `SaveClubInput` and `ModifyClubInput` to include `additionalContactIds`, `email`, and `resultServiceEmail`.
@amazon-inspector-frankfurt
Copy link

⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done

@github-actions github-actions bot requested a review from hoegerma November 4, 2025 11:12
@taimos-projen taimos-projen bot enabled auto-merge November 4, 2025 11:12
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 4, 2025

Walkthrough

Adds optional fields (additionalContacts/additionalContactIds, email, resultServiceEmail) to Club and related inputs in the GraphQL schema; updates generated docs and doc asset payloads; introduces exported REGEX_EMAIL_FORMAT and uses it to validate emails in validation logic; adds unit tests for club email validation.

Changes

Cohort / File(s) Change Summary
Schema Updates
schema.graphql
Added additionalContacts: [Person], email: AWSEmail, and resultServiceEmail: AWSEmail to Club; added additionalContactIds: [ID], email: AWSEmail, and resultServiceEmail: AWSEmail to SaveClubInput and ModifyClubInput.
Type Documentation
docs/types/Club.html, docs/types/ModifyClubInput.html, docs/types/SaveClubInput.html
Generated docs updated to include new properties and index/navigation entries for additionalContacts/additionalContactIds, email, and resultServiceEmail.
Validation Logic
src/validation.ts
Added exported REGEX_EMAIL_FORMAT: RegExp and replaced inline email checks with it; added email/resultServiceEmail validation for clubs and applied regex checks in person/association validations.
Tests
test/validation.test.ts
Added club email validation tests: invalid email and resultServiceEmail throw "Ungültiges E‑Mail‑Format"; valid and undefined emails accepted.
Search / Navigation Assets
Search data
docs/assets/search.js, Navigation data
docs/assets/navigation.js
Replaced base64-encoded payload strings assigned to window.searchData and window.navigationData with updated versions (data swap only).
New Docs Variable
docs/variables/REGEX_EMAIL_FORMAT.html
Added documentation page for the new REGEX_EMAIL_FORMAT RegExp variable.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Validation as ValidationModule
  participant Schema

  Client->>Validation: submit Club payload (email?, resultServiceEmail?, ...)
  Validation->>Validation: validate fields using REGEX_EMAIL_FORMAT
  alt valid
    Validation-->>Schema: forward validated payload
    Schema-->>Client: success / saved
  else invalid
    Validation-->>Client: "Ungültiges E-Mail-Format" error
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Focus review on: src/validation.ts (regex correctness and application sites), schema.graphql (field types and nullability), and test/validation.test.ts (coverage and localized messages).
  • Optionally verify that updated doc asset base64 blobs correspond to regenerated docs.

Suggested reviewers

  • hoegerma

Poem

🐰 I hopped through schema, regex in paw,

Tiny fields added without a flaw.
Emails now checked with tidy care,
Docs and tests humming, fresh and fair.
🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete. It lacks critical template sections including what kind of change (feature/bugfix), current behavior context, explicit new behavior details, and breaking change assessment. Complete the PR description using the template: specify this is a feature, explain the rationale, describe the new behavior in detail, and clarify if there are breaking changes for API consumers.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding contact-related fields to the Club schema, which aligns with all modifications across schema, input types, and documentation.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch club-contacts

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 03a0449 and 8724511.

📒 Files selected for processing (1)
  • test/validation.test.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/validation.test.ts

Comment @coderabbitai help to get the list of available commands and usage tips.

@amazon-inspector-frankfurt
Copy link

✅ I finished the code review, and didn't find any security or code quality issues.

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
schema.graphql (1)

76-78: Add validation for new Club email and contact fields in validation.ts

Three new optional fields added to Club type and inputs. The generated TypeScript types are correct, but the validation layer is incomplete:

Current checkClub() function (lines 129-173) validates name, shortName, website, and address, but does not validate the new fields:

  • email and resultServiceEmail (AWSEmail scalar) should be validated for proper email format
  • additionalContactIds array should validate that IDs are non-null strings

Add email format validation for both email fields and array validation for additionalContactIds:

// Email validation
if (club.email) {
  if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(club.email)) {
    result.addError('email', 'Ungültige E-Mail-Adresse');
  }
}

if (club.resultServiceEmail) {
  if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(club.resultServiceEmail)) {
    result.addError('resultServiceEmail', 'Ungültige E-Mail-Adresse');
  }
}

// Additional contacts validation
if (club.additionalContactIds && club.additionalContactIds.length === 0) {
  result.addWarning('additionalContactIds', 'Leeres Array für zusätzliche Kontakte');
}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 14a5517 and 7ac88fa.

⛔ Files ignored due to path filters (1)
  • src/generated/graphql.model.generated.ts is excluded by !**/generated/**
📒 Files selected for processing (5)
  • docs/assets/search.js (1 hunks)
  • docs/types/Club.html (1 hunks)
  • docs/types/ModifyClubInput.html (1 hunks)
  • docs/types/SaveClubInput.html (1 hunks)
  • schema.graphql (3 hunks)
🔇 Additional comments (6)
docs/assets/search.js (1)

1-1: Auto-generated search index updated.

This file is auto-generated documentation artifact (search index) that has been updated to reflect the new schema fields. No review needed.

docs/types/Club.html (1)

1-13: Auto-generated documentation updated correctly.

This TypeDoc-generated HTML documentation correctly reflects the three new Club fields (additionalContacts, email, resultServiceEmail) added in schema.graphql. The documentation structure and navigation have been properly updated.

schema.graphql (2)

266-268: SaveClubInput correctly uses IDs for input.

The input type correctly uses additionalContactIds: [ID] (array of IDs) rather than full Person objects. This follows GraphQL best practices where:

  • Input types accept IDs
  • Output types return full objects

The email fields use AWSEmail scalar which provides validation.


279-281: ModifyClubInput correctly mirrors SaveClubInput.

The ModifyClubInput includes the same three new optional fields as SaveClubInput, maintaining consistency for create and update operations. All fields are optional, allowing partial updates.

docs/types/SaveClubInput.html (1)

1-10: Auto-generated documentation for SaveClubInput updated correctly.

TypeDoc-generated documentation properly reflects the new optional input fields (additionalContactIds, email, resultServiceEmail) with correct types and navigation entries.

docs/types/ModifyClubInput.html (1)

1-10: Auto-generated documentation for ModifyClubInput updated correctly.

TypeDoc-generated documentation properly reflects the new optional input fields, consistent with SaveClubInput and the schema changes.

hoegertn and others added 2 commits November 4, 2025 12:57
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
test/validation.test.ts (2)

301-309: Consider adding positive test cases for email validation.

The test correctly verifies that invalid email formats are rejected. Consider adding test cases for valid email formats and edge cases (e.g., valid emails, undefined/null values) to ensure the validation behaves correctly across all scenarios.

Example:

  describe('email validation', () => {
+   it('should accept valid email format', () => {
+     const club = {
+       ...clubTemplateLong,
+       email: 'contact@example.com',
+     };
+     expect(() => validateClub(club)).not.toThrow();
+   });
+
+   it('should accept undefined email', () => {
+     const club = {
+       ...clubTemplateLong,
+       email: undefined,
+     };
+     expect(() => validateClub(club)).not.toThrow();
+   });
+
    it('should throw error for invalid email format', () => {
      const club = {
        ...clubTemplateLong,
        email: 'joasdohi',
      };
      expect(() => validateClub(club)).toThrow('Ungültiges E-Mail-Format');
    });
  });

310-318: Consider adding positive test cases for result service email validation.

Similar to the email validation tests, consider adding test cases for valid email formats and edge cases to ensure comprehensive coverage of the resultServiceEmail field validation.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7ac88fa and 03a0449.

📒 Files selected for processing (5)
  • docs/assets/navigation.js (1 hunks)
  • docs/assets/search.js (1 hunks)
  • docs/variables/REGEX_EMAIL_FORMAT.html (1 hunks)
  • src/validation.ts (4 hunks)
  • test/validation.test.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs/variables/REGEX_EMAIL_FORMAT.html
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/assets/search.js
🧰 Additional context used
🧬 Code graph analysis (1)
test/validation.test.ts (1)
src/validation.ts (1)
  • validateClub (184-187)
🔇 Additional comments (5)
docs/assets/navigation.js (1)

1-1: Auto-generated documentation asset.

This file contains base64-encoded navigation data that is auto-generated by the documentation tool. No review needed.

src/validation.ts (4)

3-4: LGTM! Good refactor to centralize email validation.

Exporting REGEX_EMAIL_FORMAT promotes consistency and maintainability across different validation functions. The regex pattern is appropriately permissive for general email validation without being overly complex.


160-167: LGTM! Email validation correctly implemented for new Club fields.

The validation logic correctly:

  • Treats email fields as optional (only validates if truthy)
  • Uses the centralized REGEX_EMAIL_FORMAT for consistency
  • Provides field-specific error messages
  • Follows the established validation pattern

324-324: LGTM! Good refactor to use centralized email regex.

Replacing the inline email regex with REGEX_EMAIL_FORMAT improves consistency and maintainability.


383-383: LGTM! Consistent use of centralized email validation.

Good refactor to use REGEX_EMAIL_FORMAT for association email validation, maintaining consistency across the codebase.

@taimos-projen taimos-projen bot added this pull request to the merge queue Nov 6, 2025
Merged via the queue into main with commit a479333 Nov 6, 2025
6 checks passed
@taimos-projen taimos-projen bot deleted the club-contacts branch November 6, 2025 21:33
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.

3 participants