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

Feat/con/link mentoring session to parent match #991

Merged

Conversation

ericbolikowski
Copy link
Contributor

@ericbolikowski ericbolikowski commented Oct 28, 2024

What Github issue does this PR relate to? Insert link.

#949

What should the reviewer know?

This PR makes use of the new Mentorship_Match__c field on Mentoring Session records in Salesforce when sessions are logged.

When a mentoring session is logged, it's always been linked to a Mentor and a Mentee. With this PR, sessions will also be linked to a parent Mentorship Match.

The query that loads mentoring sessions and display them on the "Mentorship Dashboard" page, as seen here ...

CleanShot 2024-10-28 at 22 32 53

... was not updated, since it lets the mentor and mentee see their entire history of logged sessions, even if they have more than one match (e.g. a completed one and a currently active one.

The other tasks that are part of #949 will be taken care of on deployment to production:

  • Run this APEX script to ensure all Mentoring Sessions are linked to a Mentorship Match
// Query all Mentoring_Session__c records
List<Mentoring_Session__c> sessionsToUpdate = [SELECT Id, Mentee__c, Mentor__c FROM Mentoring_Session__c];

// Create a list to hold the records that need to be updated
List<Mentoring_Session__c> recordsToUpdate = new List<Mentoring_Session__c>();

// Create a list to log cases where no Mentorship_Match__c is found
List<String> noMatchFoundLogs = new List<String>();

// Create a map to store Mentorship_Match__c records by Mentee__c and Mentor__c
Map<String, Mentorship_Match__c> mentorshipMatchMap = new Map<String, Mentorship_Match__c>();

// Build a set of keys to query the Mentorship_Match__c records
Set<String> sessionKeys = new Set<String>();
Set<String> allMentorIds = new Set<String>();
Set<String> allMenteeIds = new Set<String>();
for (Mentoring_Session__c session : sessionsToUpdate) {
//    String key = session.Mentee__c + '-' + session.Mentor__c; // abc-def Mentee-Mentor
//    sessionKeys.add(key);

        allMentorIds.add(session.Mentor__c);
        allMenteeIds.add(session.Mentee__c);
}

// Query all Mentorship_Match__c records that match the session keys
List<Mentorship_Match__c> allMatches = [SELECT Id, Mentee__c, Mentor__c FROM Mentorship_Match__c WHERE Mentee__c IN :allMenteeIds AND Mentor__c IN :allMentorIds];
for (Mentorship_Match__c match : allMatches) {
    String key = match.Mentee__c + '-' + match.Mentor__c;
    mentorshipMatchMap.put(key, match);
}

// Iterate over each mentoring session record
for (Mentoring_Session__c session : sessionsToUpdate) {
    String key = session.Mentee__c + '-' + session.Mentor__c;
    if (mentorshipMatchMap.containsKey(key)) {
        // Update the Mentorship_Match__c field with the found match's ID
        session.Mentorship_Match__c = mentorshipMatchMap.get(key).Id;
        recordsToUpdate.add(session);
    } else {
        // Log the case where no match is found
        noMatchFoundLogs.add('No match found for Mentoring Session ID: ' + session.Id + ' with Mentee__c: ' + session.Mentee__c + ' and Mentor__c: ' + session.Mentor__c);
    }
}

// Update the records in the database
if (!recordsToUpdate.isEmpty()) {
    update recordsToUpdate;
}

// Log all cases of no Mentorship_Match__c found
for (String log : noMatchFoundLogs) {
    System.debug(log);
}
  • Update Mentoring Session object to have a Master-Detail relationship to Mentorship Math object, on production, contpdemo, and partialsbx

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced mentorshipMatchId to enhance the data flow in mentoring sessions, linking them directly to mentorship matches.
    • Updated forms and components to include the new mentorshipMatchId property during session creation.
  • Bug Fixes

    • Improved data handling for mentorship session creation by incorporating the Mentorship_Match__c field.
  • Documentation

    • Updated GraphQL schema to reflect the addition of mentorshipMatchId in relevant types and input structures.

Copy link

coderabbitai bot commented Oct 28, 2024

Walkthrough

This pull request introduces several modifications across multiple files to incorporate a new property, mentorshipMatchId, into various components and data structures related to mentoring sessions. The changes include updates to service classes, interfaces, input types, and GraphQL schemas to ensure that the mentorship match ID is consistently handled throughout the application, enhancing the connection between mentoring sessions and their respective mentorship matches.

Changes

File Change Summary
apps/nestjs-api/src/salesforce-api/sf-api-con-mentoring-sessions.service.ts Added Mentorship_Match__c to the create method's properties in SfApiConMentoringSessionsService.
apps/redi-connect/src/components/organisms/modules/MSessions.tsx Updated MSessions interface and component to include mentorshipMatchId. Modified submitForm to use this ID.
apps/redi-connect/src/pages/app/mentorship/Mentorship.tsx Added mentorshipMatchId prop to MSessions, sourced from route parameters.
libs/common-types/src/lib/con-mentoring-session/con-mentoring-session.entityprops.ts Added mentorshipMatchId property to ConMentoringSessionEntityProps.
libs/common-types/src/lib/con-mentoring-session/con-mentoring-session.mapper.ts Updated fromPersistence and toPersistence methods to include mentorshipMatchId and Mentorship_Match__c.
libs/common-types/src/lib/con-mentoring-session/con-mentoring-session.record.ts Added Mentorship_Match__c to SALESFORCE_OBJECT_FIELDS in ConMentoringSessionRecord.
libs/common-types/src/lib/con-mentoring-session/con-mentoring-session.recordprops.ts Added Mentorship_Match__c: string to ConMentoringSessionRecordProps.
libs/common-types/src/lib/con-mentoring-session/entity-dtos/create-con-mentoring-session.entityinput.ts Updated CreateConMentoringSessionInput to include mentorshipMatchId.
libs/data-access/src/lib/types/types.ts Added mentorshipMatchId to ConMentoringSession and CreateConMentoringSessionInput types.
schema.graphql Updated ConMentoringSession and CreateConMentoringSessionInput types to include mentorshipMatchId.

Possibly related issues

Possibly related PRs

Suggested reviewers

  • astkhikatredi
  • katamatata

🐰 "In the meadow where mentors play,
A match was made to light the way.
With mentorshipMatchId now in sight,
Sessions bloom, oh what a delight!
Hops of joy, we celebrate,
New connections that we create!" 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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: 1

🧹 Outside diff range and nitpick comments (6)
libs/common-types/src/lib/con-mentoring-session/con-mentoring-session.recordprops.ts (1)

13-13: Consider adding validation for Master-Detail relationship.

The addition of Mentorship_Match__c aligns with the PR objectives. However, since this will be a Master-Detail relationship in Salesforce, consider adding validation to ensure this field is always populated.

Consider using class-validator to enforce the required field:

+import { IsNotEmpty } from 'class-validator'

 export class ConMentoringSessionRecordProps implements RecordProps {
   // ...
+  @IsNotEmpty({ message: 'Mentorship Match is required' })
   Mentorship_Match__c: string
   // ...
 }
libs/common-types/src/lib/con-mentoring-session/con-mentoring-session.entityprops.ts (1)

18-19: Consider adding JSDoc documentation.

To improve code maintainability, consider adding JSDoc documentation to describe the relationship between the mentoring session and its parent match.

+  /** ID of the parent Mentorship Match this session belongs to */
   @Field((type) => ID)
   mentorshipMatchId: string
libs/common-types/src/lib/con-mentoring-session/con-mentoring-session.record.ts (1)

Line range hint 16-29: Consider documenting field requirements in metadata.

Since this represents a significant relationship change, consider enhancing the metadata documentation to indicate whether this is a required field and its relationship type (lookup vs master-detail).

Example enhancement:

 public static metadata: RecordMetadata = {
   SALESFORCE_OBJECT_NAME: 'Mentoring_Session__c',
   SALESFORCE_OBJECT_FIELDS: [
     'Id',
     'Date__c',
     'Durations_in_Minutes__c',
     'Mentee__c',
     'Mentor__c',
     'Mentorship_Match__c',
     'CreatedDate',
     'LastModifiedDate',
   ],
   SALESFORCE_ORDER_BY: ['Date__c', 'ASC'],
+  FIELD_REQUIREMENTS: {
+    'Mentorship_Match__c': {
+      required: false, // Update based on actual requirement
+      relationship: 'Master-Detail',
+      description: 'Links mentoring session to parent Mentorship Match'
+    }
+  }
 }
apps/nestjs-api/src/salesforce-api/sf-api-con-mentoring-sessions.service.ts (1)

Validation for mentorship match is recommended

Based on the codebase analysis:

  1. The ConMentoringSessionRecordProps shows that Mentorship_Match__c is typed as a required string field
  2. The repository layer (SfApiRepository) provides methods to query Salesforce objects
  3. No existing validation is implemented for the mentorship match relationship

Recommended implementation in sf-api-con-mentoring-sessions.service.ts:

async create(record: ConMentoringSessionRecord) {
  // Verify mentorship match exists and matches mentor/mentee
  const matchRecord = await this.repository.findRecordsOfObject({
    objectName: 'Mentorship_Match__c',
    objectFields: ['Id', 'Mentor__c', 'Mentee__c'],
    filter: { Id: record.props.Mentorship_Match__c }
  });

  if (!matchRecord.length) {
    throw new Error('Mentorship match not found');
  }
  if (matchRecord[0].Mentor__c !== record.props.Mentor__c || 
      matchRecord[0].Mentee__c !== record.props.Mentee__c) {
    throw new Error('Mentor/Mentee mismatch with the mentorship match');
  }

  // Existing creation logic...
  const cleanProps = pick(record.props, [
    'Date__c',
    'Durations_in_Minutes__c',
    'Mentor__c',
    'Mentee__c',
    'Mentorship_Match__c',
  ]);

  return this.repository.createRecord(
    ConMentoringSessionRecord.metadata.SALESFORCE_OBJECT_NAME,
    cleanProps
  );
}
🔗 Analysis chain

Line range hint 34-42: Consider adding validation for mentorship match.

To ensure data integrity, consider adding validation to:

  1. Verify that the mentorship match ID is provided
  2. Confirm that the mentor and mentee in the session match those in the referenced mentorship match

Let's verify the type safety in the record props:

Consider implementing these validations:

async create(record: ConMentoringSessionRecord) {
  // Validate mentorship match exists and contains the same mentor/mentee
  const match = await this.repository.findRecordsOfObject({
    objectName: 'Mentorship_Match__c',
    objectFields: ['Id', 'Mentor__c', 'Mentee__c'],
    filter: { Id: record.props.Mentorship_Match__c }
  });
  
  if (!match.length || 
      match[0].Mentor__c !== record.props.Mentor__c || 
      match[0].Mentee__c !== record.props.Mentee__c) {
    throw new Error('Invalid mentorship match');
  }

  // Rest of the existing code...
}
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if Mentorship_Match__c is properly typed in ConMentoringSessionRecord
ast-grep --pattern 'class ConMentoringSessionRecord {
  $$$
  Mentorship_Match__c: $_
  $$$
}'

# Check if there are any existing validations
rg -A 5 "Mentorship_Match__c.*validate" 

Length of output: 138


Script:

#!/bin/bash
# Let's first find the ConMentoringSessionRecord class definition
fd ConMentoringSessionRecord --exec cat {}

# Check for any existing validation logic in the service
fd sf-api-con-mentoring-sessions.service --exec cat {}

# Look for any validation patterns in similar services
rg -A 5 "validate.*Mentorship_Match" 

Length of output: 1645


Script:

#!/bin/bash
# Let's check the common-types for ConMentoringSessionRecord definition
rg -A 10 "class ConMentoringSessionRecord" 

# Check if there's any validation in the repository layer
fd sf-api.repository --exec cat {}

# Look for any existing validation patterns in similar services
rg -A 5 "validate.*Match"

Length of output: 13189

apps/redi-connect/src/pages/app/mentorship/Mentorship.tsx (1)

Line range hint 1-124: Consider implementing session filtering by match.

While the PR objectives mention keeping the existing query unchanged to show all sessions, consider adding an optional filter capability to MSessions. This would allow users to toggle between viewing all sessions or only those related to the current match.

Would you like me to propose a design for implementing this filtering capability?

apps/redi-connect/src/components/organisms/modules/MSessions.tsx (1)

Line range hint 94-98: Consider implementing a more robust caching strategy.

The TODO comment raises a valid concern about query invalidation. While the current approach works, implementing a normalized cache (like Apollo) would provide more intelligent cache invalidation and better data consistency.

Options to consider:

  1. Migrate to Apollo Client for automatic cache normalization
  2. Implement a custom cache normalization layer with React Query
  3. Use React Query's built-in cache manipulation utilities for more granular control
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4d71252 and 552d94c.

📒 Files selected for processing (10)
  • apps/nestjs-api/src/salesforce-api/sf-api-con-mentoring-sessions.service.ts (1 hunks)
  • apps/redi-connect/src/components/organisms/modules/MSessions.tsx (2 hunks)
  • apps/redi-connect/src/pages/app/mentorship/Mentorship.tsx (1 hunks)
  • libs/common-types/src/lib/con-mentoring-session/con-mentoring-session.entityprops.ts (1 hunks)
  • libs/common-types/src/lib/con-mentoring-session/con-mentoring-session.mapper.ts (2 hunks)
  • libs/common-types/src/lib/con-mentoring-session/con-mentoring-session.record.ts (1 hunks)
  • libs/common-types/src/lib/con-mentoring-session/con-mentoring-session.recordprops.ts (1 hunks)
  • libs/common-types/src/lib/con-mentoring-session/entity-dtos/create-con-mentoring-session.entityinput.ts (2 hunks)
  • libs/data-access/src/lib/types/types.ts (2 hunks)
  • schema.graphql (2 hunks)
🔇 Additional comments (16)
libs/common-types/src/lib/con-mentoring-session/entity-dtos/create-con-mentoring-session.entityinput.ts (2)

1-1: LGTM! Clean import statement.

The import statement has been simplified by removing unused imports, improving code cleanliness.


8-11: Verify GraphQL clients for breaking change.

Adding mentorshipMatchId as a required field in the input type is a breaking change that could affect existing GraphQL clients. This aligns with the PR objective of linking sessions to matches, but requires careful deployment.

Let's verify the impact:

libs/common-types/src/lib/con-mentoring-session/con-mentoring-session.recordprops.ts (1)

Line range hint 20-22: Verify data transformation handling.

The create method uses plainToClass for transformation. Let's verify that other components properly handle the new field during record creation.

✅ Verification successful

Based on the results, I can generate the final response as we have sufficient information about how the field is handled in the codebase.

Field transformation is properly handled across components

The verification shows that:

  • The Mentorship_Match__c field is correctly mapped in both directions in ConMentoringSessionMapper:
    • From raw to entity: props.mentorshipMatchId = raw.props.Mentorship_Match__c
    • From entity to record: props.Mentorship_Match__c = srcProps.mentorshipMatchId
  • The create method chain is consistent:
    1. ConMentoringSessionRecordProps.create() transforms raw data
    2. ConMentoringSessionRecord.create() uses the transformed props
    3. ConMentoringSessionMapper handles the field mapping properly
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the new field is properly handled in related services and mappers

# Look for related service implementations
rg -l "ConMentoringSessionRecordProps" | xargs rg -A 5 "create.*Mentoring.*Session"

# Check for field mapping in related mappers
rg -l "ConMentoringSession.*Mapper" | xargs rg -A 5 "Mentorship_Match__c"

Length of output: 2187

libs/common-types/src/lib/con-mentoring-session/con-mentoring-session.entityprops.ts (1)

18-19: Implementation looks good, but verify deployment sequence.

The addition of mentorshipMatchId as a required field aligns with the PR objectives. However, since this field will be populated by an APEX script for existing records, we should ensure proper deployment sequencing.

Let's verify if there are any existing sessions that might be affected:

✅ Verification successful

Let me gather more specific information about the GraphQL mutations and input types related to creating mentoring sessions.


Let me try a different approach to find the input type and mutation definitions using ripgrep.


No deployment sequencing concerns - field already required in mutations

Based on the evidence from the codebase:

  1. The mentorshipMatchId field is already a required field in the CreateConMentoringSessionInput type as shown in the schema
  2. The mutation createConMentoringSession is the only way to create new sessions and it already requires this field
  3. Existing sessions will be handled by the APEX script as planned

Therefore, making the field required in con-mentoring-session.entityprops.ts aligns with the existing GraphQL schema and won't affect the application's functionality.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any GraphQL queries or mutations that might fail 
# due to the new required field before the APEX script runs

# Look for GraphQL operations involving ConMentoringSession
rg -l "ConMentoringSession" | xargs rg "query|mutation" -A 5

Length of output: 12025


Script:

#!/bin/bash
# Check the CreateConMentoringSessionInput type definition and usage
ast-grep --pattern 'input CreateConMentoringSessionInput {
  $$$
}'

# Also check for any existing session creation mutations in the resolver
ast-grep --pattern '@Mutation()
  $$$createConMentoringSession$$$'

Length of output: 138


Script:

#!/bin/bash
# Search for CreateConMentoringSessionInput definition
rg "CreateConMentoringSessionInput" -A 5

# Search for createConMentoringSession mutation implementation
rg "createConMentoringSession" -A 5 "apps/nestjs-api"

Length of output: 8782

libs/common-types/src/lib/con-mentoring-session/con-mentoring-session.record.ts (1)

24-24: Verify Salesforce field configuration.

The addition of 'Mentorship_Match__c' aligns with the PR objective to link mentoring sessions with their parent match.

Let's verify the field configuration across the codebase:

✅ Verification successful

Field mapping and usage is consistent across the codebase

The verification shows that:

  • The field Mentorship_Match__c is properly mapped to mentorshipMatchId in the entity layer
  • The field is consistently used in record props, mappers, and services
  • The field is part of the core data model as evidenced by its inclusion in ConMentoringSessionRecordProps
  • The field is actively used in mentorship-related operations (accept, decline, complete)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistent usage of Mentorship_Match__c field
# Expected: Field should be referenced consistently in related files

# Check for field references in TypeScript/JavaScript files
rg -t ts -t js "Mentorship_Match__c"

# Check for potential schema definitions
fd -e schema.graphql -x cat {} \; | rg -A 5 "MentoringSession|MentorshipMatch"

Length of output: 978


Script:

#!/bin/bash
# Let's verify the field mapping and usage consistency

# Check for mentorshipMatchId in TypeScript files
rg -t ts "mentorshipMatchId" -A 2

# Check the complete ConMentoringSession record definition
fd -e ts "con-mentoring-session.recordprops.ts" -x cat {}

# Check for any validation or required field definitions
rg -t ts "required.*Mentorship_Match__c|Mentorship_Match__c.*required"

# Check GraphQL type definitions for MentoringSession
fd -g "*.graphql" -x cat {} | rg -A 5 "type.*MentoringSession"

Length of output: 12190

apps/nestjs-api/src/salesforce-api/sf-api-con-mentoring-sessions.service.ts (1)

34-34: LGTM! The implementation aligns with PR objectives.

The addition of Mentorship_Match__c to the picked properties correctly implements the new requirement to link mentoring sessions with their parent mentorship match.

libs/common-types/src/lib/con-mentoring-session/con-mentoring-session.mapper.ts (3)

47-47: LGTM! Correct Salesforce field mapping

The mapping correctly preserves the mentorship match reference when persisting to Salesforce, following proper field naming conventions.


27-27: Verify nullability requirements for mentorshipMatchId

Since this represents a Salesforce Master-Detail relationship to Mentorship Match, we should ensure proper handling of null values. Consider adding null checks or making the field required in the entity props if it maps to a Master-Detail relationship.


26-28: Consider adding data consistency validation

Given that an APEX script will backfill existing records, consider adding validation in the mapper to ensure data consistency:

  1. Verify that the mentor/mentee pair in the session matches those in the referenced mentorship match
  2. Log any mismatches for monitoring during the transition period

Also applies to: 46-48

apps/redi-connect/src/pages/app/mentorship/Mentorship.tsx (1)

105-105: LGTM! Verify MSessions component implementation.

The addition of the mentorshipMatchId prop correctly passes the route's matchId to the MSessions component, supporting the new feature of linking sessions to parent matches.

Let's verify the MSessions component implementation:

✅ Verification successful

Let me gather more information about the MSessions component interface and implementation.


Let me check one more aspect to ensure the mutation type and interface are properly defined.


Based on the evidence gathered from the shell scripts, I can now provide the final response:

✅ MSessions component correctly implements mentorshipMatchId

The verification confirms that:

  • The component properly uses the mentorshipMatchId prop in the session creation mutation
  • The mutation correctly includes mentorshipMatchId in its input payload
  • The implementation aligns with the PR's objective of linking sessions to parent matches
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify MSessions component properly handles mentorshipMatchId

# Check MSessions component interface and implementation
ast-grep --pattern 'interface MSessionsProps {
  $$$
  mentorshipMatchId: $_
  $$$
}'

# Check session creation mutation usage
rg -A 5 'createSessionMutation.mutateAsync'

Length of output: 655


Script:

#!/bin/bash
# Check MSessions component definition and props usage
ast-grep --pattern 'const MSessions = ({ $$ }: MSessionsProps) => {
  $$$
}'

# Check MSessions component type definition
rg -B 5 -A 10 'interface MSessionsProps'

# Check createSession mutation type
rg -B 2 -A 5 'createSession.*Mutation'

Length of output: 2459


Script:

#!/bin/bash
# Check mutation type definition and interface
rg -B 2 -A 2 'useCreateMentoringSessionMutation'

# Check if mentorshipMatchId is used in the mutation type
rg -B 5 -A 5 'CreateMentoringSessionInput'

Length of output: 1649

apps/redi-connect/src/components/organisms/modules/MSessions.tsx (2)

71-76: LGTM! Component signature properly updated.

The component signature has been correctly updated to include the new required prop, maintaining consistency with the interface changes.


91-91: LGTM! Mutation input correctly updated.

The mentorshipMatchId is properly included in the mutation input object.

schema.graphql (2)

37-37: LGTM! The new field aligns with the Master-Detail relationship requirement.

The addition of the non-nullable mentorshipMatchId field to the ConMentoringSession type correctly implements the requirement to link mentoring sessions to their parent mentorship matches.


170-170: LGTM! The input type change ensures data consistency.

The addition of the required mentorshipMatchId field to CreateConMentoringSessionInput ensures that new mentoring sessions are always linked to a parent mentorship match, maintaining data integrity.

libs/data-access/src/lib/types/types.ts (2)

58-58: LGTM: Added required mentorship match relationship.

The new mentorshipMatchId field is correctly typed as a non-nullable ID scalar, properly establishing the relationship between mentoring sessions and their parent mentorship matches.


197-197: LGTM: Input type updated to require mentorship match.

The CreateConMentoringSessionInput type has been correctly updated to require a mentorshipMatchId, ensuring that all new mentoring sessions are properly linked to a parent mentorship match.

@katamatata
Copy link
Contributor

katamatata commented Oct 30, 2024

@ericbolikowski, I just have one question. So, the @ResolveField for mentoringSessions in con-mentorship-matches.resolver.ts requires no updates?

@ericbolikowski
Copy link
Contributor Author

@ericbolikowski, I just have one question. So, the @ResolveField for mentoringSessions in con-mentorship-matches.resolver.ts requires no updates?

Yes, that's right. The ticket requirements stated it's necessary, but I found it overall better not to do it, mainly for the reason mentioned in the PR description: The query that loads mentoring sessions ...

@ericbolikowski ericbolikowski merged commit 4566825 into master Oct 30, 2024
2 checks passed
@ericbolikowski ericbolikowski deleted the feat/con/link-mentoring-session-to-parent-match branch October 30, 2024 12:07
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.

[CON/Mentorship Match]: Link the mentoring sessions to a respective mentorship match
3 participants