@@ -9,7 +9,14 @@ import { blockUtils } from '@utils/blocks';
99import log from '@utils/log' ;
1010import { bold , codeBlock , compose , italic , mention , ul } from '@utils/text' ;
1111import { PendingReviewer } from '@models/ActiveReview' ;
12- import { ActionId , Deadline , DeadlineLabel , Interaction } from './enums' ;
12+ import {
13+ ActionId ,
14+ CandidateType ,
15+ CandidateTypeLabel ,
16+ Deadline ,
17+ DeadlineLabel ,
18+ Interaction ,
19+ } from './enums' ;
1320import { chatService } from '@/services/ChatService' ;
1421import { determineExpirationTime } from '@utils/reviewExpirationUtils' ;
1522
@@ -89,6 +96,19 @@ export const requestReview = {
8996 } ,
9097 } ,
9198 } ,
99+ {
100+ type : 'input' ,
101+ block_id : ActionId . CANDIDATE_TYPE ,
102+ label : {
103+ text : 'What type of candidate is this?' ,
104+ type : 'plain_text' ,
105+ } ,
106+ element : {
107+ type : 'static_select' ,
108+ action_id : ActionId . CANDIDATE_TYPE ,
109+ options : buildCandidateTypeOptions ( ) ,
110+ } ,
111+ } ,
92112 {
93113 type : 'input' ,
94114 block_id : ActionId . HACKERRANK_URL ,
@@ -160,19 +180,24 @@ export const requestReview = {
160180 const deadline = blockUtils . getBlockValue ( body , ActionId . REVIEW_DEADLINE ) ;
161181 const numberOfRequestedReviewers = blockUtils . getBlockValue ( body , ActionId . NUMBER_OF_REVIEWERS ) ;
162182 const candidateIdentifier = blockUtils . getBlockValue ( body , ActionId . CANDIDATE_IDENTIFIER ) ;
183+ const candidateType = blockUtils . getBlockValue ( body , ActionId . CANDIDATE_TYPE ) ;
163184 const hackerRankUrl = blockUtils . getBlockValue ( body , ActionId . HACKERRANK_URL ) ;
164185
165186 const numberOfReviewersValue = numberOfRequestedReviewers . value ;
166187 const deadlineValue = deadline . selected_option . value ;
167188 const deadlineDisplay = deadline . selected_option . text . text ;
168189 const candidateIdentifierValue = candidateIdentifier . value ;
190+ const candidateTypeValue = candidateType . selected_option . value ;
191+ const candidateTypeDisplay = candidateType . selected_option . text . text ;
169192 const hackerRankUrlValue = hackerRankUrl . value ;
170193 log . d (
171194 'requestReview.callback' ,
172195 'Parsed values:' ,
173196 JSON . stringify ( {
174197 numberOfReviewersValue,
175198 candidateIdentifierValue,
199+ candidateTypeValue,
200+ candidateTypeDisplay,
176201 hackerRankUrlValue,
177202 deadlineValue,
178203 deadlineDisplay,
@@ -190,6 +215,7 @@ export const requestReview = {
190215 user ,
191216 ) } has requested ${ numberOfReviewersValue } reviews for a HackerRank done in the following languages:`,
192217 ul ( ...languages ) ,
218+ bold ( `Candidate Type: ${ candidateTypeDisplay } ` ) ,
193219 bold ( `The review is needed by end of day ${ deadlineDisplay } ` ) ,
194220 candidateIdentifierValue ? italic ( `Candidate Identifier: ${ candidateIdentifierValue } ` ) : '' ,
195221 ) ,
@@ -226,6 +252,7 @@ export const requestReview = {
226252 { id : user . id } ,
227253 languages ,
228254 deadlineDisplay ,
255+ candidateTypeDisplay ,
229256 ) ;
230257 const pendingReviewer : PendingReviewer = {
231258 userId : reviewer . id ,
@@ -242,6 +269,7 @@ export const requestReview = {
242269 requestedAt : new Date ( ) ,
243270 dueBy : deadlineValue ,
244271 candidateIdentifier : candidateIdentifierValue ,
272+ candidateType : candidateTypeValue ,
245273 reviewersNeededCount : numberOfReviewersValue ,
246274 acceptedReviewers : [ ] ,
247275 declinedReviewers : [ ] ,
@@ -265,3 +293,17 @@ function buildDeadlineOptions(): PlainTextOption[] {
265293function buildOption ( deadline : Deadline ) : PlainTextOption {
266294 return { text : { text : DeadlineLabel . get ( deadline ) || '' , type : 'plain_text' } , value : deadline } ;
267295}
296+
297+ function buildCandidateTypeOptions ( ) : PlainTextOption [ ] {
298+ return [
299+ buildCandidateTypeOption ( CandidateType . FULL_TIME ) ,
300+ buildCandidateTypeOption ( CandidateType . APPRENTICE ) ,
301+ ] ;
302+ }
303+
304+ function buildCandidateTypeOption ( candidateType : CandidateType ) : PlainTextOption {
305+ return {
306+ text : { text : CandidateTypeLabel . get ( candidateType ) || '' , type : 'plain_text' } ,
307+ value : candidateType ,
308+ } ;
309+ }
0 commit comments