Skip to content

Commit

Permalink
Feat/con/link mentoring session to parent match (#991)
Browse files Browse the repository at this point in the history
* BE plumbing: add new mentorshipMatchId field to SF/core models

* FE: include mentorshipMatchId when logging sessions
  • Loading branch information
ericbolikowski authored Oct 30, 2024
1 parent 4d71252 commit 4566825
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class SfApiConMentoringSessionsService {
'Durations_in_Minutes__c',
'Mentor__c',
'Mentee__c',
'Mentorship_Match__c',
])

const createResult = await this.repository.createRecord(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,15 @@ interface MSessions {
sessions: Pick<ConMentoringSession, 'id' | 'date' | 'minuteDuration'>[]
menteeId: string
editable?: boolean
mentorshipMatchId: string
}

const MSessions = ({ sessions, menteeId, editable }: MSessions) => {
const MSessions = ({
sessions,
menteeId,
editable,
mentorshipMatchId,
}: MSessions) => {
const queryClient = useQueryClient()
const { matchId } = useParams<MentorshipRouteParams>()
const createSessionMutation = useCreateMentoringSessionMutation()
Expand All @@ -82,6 +88,7 @@ const MSessions = ({ sessions, menteeId, editable }: MSessions) => {
input: {
...values,
menteeId,
mentorshipMatchId,
},
})
// TODO: I don't like this dependency - this mutation has to know which queries
Expand Down
1 change: 1 addition & 0 deletions apps/redi-connect/src/pages/app/mentorship/Mentorship.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ function Mentorship() {
sessions={viewMatch.mentoringSessions}
menteeId={viewProfile.userId}
editable={currentUserIsMentor}
mentorshipMatchId={matchId}
/>
<ReportProblem
type={myProfile.userType}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export class ConMentoringSessionEntityProps implements EntityProps {
mentorId: string
@Field((type) => ID)
menteeId: string
@Field((type) => ID)
mentorshipMatchId: string

createdAt: Date
updatedAt: Date
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class ConMentoringSessionMapper
]
props.mentorId = raw.props.Mentor__c
props.menteeId = raw.props.Mentee__c
props.mentorshipMatchId = raw.props.Mentorship_Match__c
props.createdAt = raw.props.CreatedDate
props.updatedAt = raw.props.LastModifiedDate

Expand All @@ -43,6 +44,7 @@ export class ConMentoringSessionMapper
)
props.Mentor__c = srcProps.mentorId
props.Mentee__c = srcProps.menteeId
props.Mentorship_Match__c = srcProps.mentorshipMatchId

const record = ConMentoringSessionRecord.create(props)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class ConMentoringSessionRecord extends Record<ConMentoringSessionRecordP
'Durations_in_Minutes__c',
'Mentee__c',
'Mentor__c',
'Mentorship_Match__c',
'CreatedDate',
'LastModifiedDate',
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export class ConMentoringSessionRecordProps implements RecordProps {

Mentor__c: string
Mentee__c: string
Mentorship_Match__c: string

@Type(() => Date)
CreatedDate: Date
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
Field,
InputType,
PartialType,
PickType,
IntersectionType,
} from '@nestjs/graphql'
import { InputType, PickType } from '@nestjs/graphql'
import { ConMentoringSessionEntityProps } from '../con-mentoring-session.entityprops'

@InputType()
Expand All @@ -13,5 +7,5 @@ class _ConMentoringSessionntityProps extends ConMentoringSessionEntityProps {}
@InputType('CreateConMentoringSessionInput')
export class CreateConMentoringSessionInput extends PickType(
_ConMentoringSessionntityProps,
['date', 'minuteDuration', 'menteeId'] as const
['date', 'minuteDuration', 'menteeId', 'mentorshipMatchId'] as const
) {}
2 changes: 2 additions & 0 deletions libs/data-access/src/lib/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export type ConMentoringSession = {
id: Scalars['ID'];
menteeId: Scalars['ID'];
mentorId: Scalars['ID'];
mentorshipMatchId: Scalars['ID'];
minuteDuration: MentoringSessionDuration;
updatedAt: Scalars['DateTime'];
};
Expand Down Expand Up @@ -193,6 +194,7 @@ export enum ConnectProfileStatus {
export type CreateConMentoringSessionInput = {
date: Scalars['DateTime'];
menteeId: Scalars['ID'];
mentorshipMatchId: Scalars['ID'];
minuteDuration: MentoringSessionDuration;
};

Expand Down
2 changes: 2 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type ConMentoringSession {
id: ID!
menteeId: ID!
mentorId: ID!
mentorshipMatchId: ID!
minuteDuration: MentoringSessionDuration!
updatedAt: DateTime!
}
Expand Down Expand Up @@ -166,6 +167,7 @@ enum ConnectProfileStatus {
input CreateConMentoringSessionInput {
date: DateTime!
menteeId: ID!
mentorshipMatchId: ID!
minuteDuration: MentoringSessionDuration!
}

Expand Down

0 comments on commit 4566825

Please sign in to comment.