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