Passed
Push — feature/azure-webapp-pipeline-... ( 271549...3c88ad )
by Grant
07:11 queued 10s
created

lookupConstants.ts ➔ getKeyByValue   A

Complexity

Conditions 3

Size

Total Lines 5
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 5
c 0
b 0
f 0
rs 10
cc 3
1
export enum ReviewStatusId {
2
  ScreenedOut = 1,
3
  StillThinking = 2,
4
  StillIn = 3,
5
}
6
7
export type ReviewStatusName = "screened_out" | "still_thinking" | "still_in";
8
9
export type ReviewStatus = {
10
  id: ReviewStatusId;
11
  name: ReviewStatusName;
12
};
13
14
export enum ResponseReviewStatusId {
15
  ScreenedOut = 1,
16
  ReadyForReference = 4,
17
  ReadyToAllocate = 5,
18
  AssessmentRequired = 6,
19
  Allocated = 7,
20
  NotAvailable = 8,
21
}
22
23
export type ResponseReviewStatusName =
24
  | "screened_out"
25
  | "ready_for_reference"
26
  | "ready_to_allocate"
27
  | "assessment_required"
28
  | "allocated"
29
  | "not_available";
30
31
export type ResponseReviewStatus = {
32
  id: ResponseReviewStatusId;
33
  name: ResponseReviewStatusName;
34
};
35
36
export enum ExcludedDepartments {
37
  StrategicTalentResponse = 18,
38
}
39
40
export enum CriteriaTypeId {
41
  Essential = 1,
42
  Asset = 2,
43
}
44
45
export enum SkillTypeId {
46
  Soft = 1,
47
  Hard = 2,
48
}
49
50
export enum SkillLevelId {
51
  Basic = 1,
52
  Intermediate = 2,
53
  Advanced = 3,
54
  Expert = 4,
55
}
56
57
export enum AssessmentTypeId {
58
  NarrativeAssessment = 1,
59
  ApplicationScreeningQuestion = 2,
60
  GroupTest = 3,
61
  InformalPhoneConversation = 4,
62
  Interview = 5,
63
  OnlineExam = 6,
64
  OnSiteExam = 7,
65
  TakeHomeExam = 8,
66
  PortfolioReview = 9,
67
  ReferenceCheck = 10,
68
  SeriousGames = 11,
69
}
70
71
export const ProvinceId = {
72
  AB: 1,
73
  BC: 2,
74
  MB: 3,
75
  NL: 4,
76
  NB: 5,
77
  NS: 6,
78
  NU: 7,
79
  NT: 8,
80
  ON: 9,
81
  PE: 10,
82
  QC: 11,
83
  SK: 12,
84
  YT: 13,
85
};
86
87
export const SecurityClearanceId = {
88
  reliability: 1,
89
  secret: 2,
90
  topSecret: 3,
91
};
92
93
export const LanguageRequirementId = {
94
  english: 1,
95
  french: 2,
96
  bilingualIntermediate: 3,
97
  bilingualAdvanced: 4,
98
  englishOrFrench: 5,
99
};
100
101
export const FrequencyId = {
102
  never: 1,
103
  rarely: 2,
104
  sometimes: 3,
105
  often: 4,
106
  always: 5,
107
};
108
109
export const TravelRequirementId = {
110
  frequently: 1,
111
  available: 2,
112
  none: 3,
113
};
114
115
export const OvertimeRequirementId = {
116
  frequently: 1,
117
  available: 2,
118
  none: 3,
119
};
120
121
export const CommentTypeId = {
122
  question: 1,
123
  recommendation: 2,
124
  requiredAction: 3,
125
};
126
127
export const LocationId = {
128
  jobGeneric: "job/generic",
129
  heading: "job/heading",
130
  basicInfo: "job/basicInfo",
131
  impact: "job/impact",
132
  tasks: "job/tasks",
133
  skills: "job/skills",
134
  langRequirements: "job/langRequirements",
135
  environment: "job/environment",
136
  summary: "hr/summary",
137
  preview: "hr/preview",
138
  screeningPlan: "screeningPlan/generic",
139
  screeningPlanBuilder: "screeningPlan/builder",
140
  screeningPlanSummary: "screeningPlan/summary",
141
  screeningPlanRatings: "screeningPlan/ratings",
142
  applicantsGeneric: "applicants/generic",
143
  underConsideration: "applicants/underConsideration",
144
  optionalConsideration: "applicants/optionalConsideration",
145
  notUnderConsideration: "applicants/notUnderConsideration",
146
} as const;
147
148
export enum JobStatus {
149
  Draft = "draft",
150
  ReviewManager = "review_manager",
151
  ReviewHr = "review_hr",
152
  Translation = "translation",
153
  FinalReviewManager = "final_review_manager",
154
  FinalReviewHr = "final_review_hr",
155
  PendingApproval = "pending_approval",
156
  Approved = "approved",
157
  Ready = "ready",
158
  Live = "live",
159
  Assessment = "assessment",
160
  Completed = "completed",
161
}
162
163
export enum ResponseScreeningBuckets {
164
  Consideration = "consideration",
165
  ReadyToAllocate = "ready_to_allocate",
166
  Allocated = "allocated",
167
  Unavailable = "unavailable",
168
  DoesNotQualify = "does_not_qualify",
169
}
170
171
export const CitizenshipId = {
172
  citizen: 1,
173
  permanentResident: 2,
174
  workPermitOpen: 3,
175
  workPermitClosed: 4,
176
  notEntitled: 5,
177
};
178
179
export const VeteranId = {
180
  none: 1,
181
  current: 2,
182
  past: 3,
183
};
184
185
export const ApplicationStatusId = {
186
  draft: 1,
187
  submitted: 2,
188
  requiresAction: 3,
189
  underReview: 4,
190
  rejected: 5,
191
};
192
193
export const ApplicationStepId = {
194
  basic: 1,
195
  experience: 2,
196
  skills: 3,
197
  fit: 4,
198
  review: 5,
199
  submission: 6,
200
};
201
202
export type ApplicationStep =
203
  | "basic"
204
  | "experience"
205
  | "skills"
206
  | "fit"
207
  | "review"
208
  | "submission";
209
210
export type ProgressBarStatus = "default" | "complete" | "error" | "current";
211
212
export function getKeyByValue(object, value): string {
213
  return (
214
    Object.keys(object).find((key) => object[key] === value) ?? "key not found."
215
  );
216
}
217
218
export function enumToIds(enumType: object): number[] {
219
  const enumVals = Object.values(enumType);
220
  // Note: this first array includes the list of ids as strings, followed by the list of names as strings
221
  const enumIds = enumVals.filter((item) => !Number.isNaN(Number(item)));
222
  return enumIds.map((id) => Number(id));
223
}
224
225
export const SkillLevelIdValues = enumToIds(SkillLevelId);
226
227
export const SkillTypeIdValues = enumToIds(SkillTypeId);
228
229
export const AssessmentTypeIdValues = enumToIds(AssessmentTypeId);
230
231
export const CriteriaTypeIdValues = enumToIds(CriteriaTypeId);
232