@goweekdays/core 2.12.1 → 2.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -13518,7 +13518,7 @@ var paginationSchema = import_joi52.default.object({
13518
13518
  search: import_joi52.default.string().optional().allow("", null)
13519
13519
  });
13520
13520
  function useOptionCtrl() {
13521
- const { getAll: _getAllCountries } = useOptionRepo("option.job.countries");
13521
+ const { getAll: _getAllCountries } = useOptionRepo("option.countries");
13522
13522
  const { getAll: _getAllJobTitles } = useOptionRepo("option.job.titles");
13523
13523
  const { getAll: _getAllCurrencies } = useOptionRepo("option.currencies");
13524
13524
  const { getAll: _getAllCities } = useOptionRepo("option.cities");
@@ -13550,7 +13550,7 @@ function useOptionCtrl() {
13550
13550
  next(error2);
13551
13551
  }
13552
13552
  }
13553
- async function getLocations(req, res, next) {
13553
+ async function getCountries(req, res, next) {
13554
13554
  return handleGetAll(req, res, next, _getAllCountries);
13555
13555
  }
13556
13556
  async function getJobTitles(req, res, next) {
@@ -13563,7 +13563,7 @@ function useOptionCtrl() {
13563
13563
  return handleGetAll(req, res, next, _getAllCities);
13564
13564
  }
13565
13565
  return {
13566
- getLocations,
13566
+ getCountries,
13567
13567
  getJobTitles,
13568
13568
  getCurrencies,
13569
13569
  getAllCities
@@ -14836,7 +14836,7 @@ var workExp = {
14836
14836
  jobTitle: import_joi61.default.string().required(),
14837
14837
  company: import_joi61.default.string().required(),
14838
14838
  country: import_joi61.default.string().required(),
14839
- cityState: import_joi61.default.string().optional().allow(""),
14839
+ city: import_joi61.default.string().optional().allow(""),
14840
14840
  fromMonth: import_joi61.default.string().required(),
14841
14841
  fromYear: import_joi61.default.string().required(),
14842
14842
  toMonth: import_joi61.default.string().optional().allow(""),
@@ -14945,7 +14945,7 @@ var schemaJobProfile = import_joi61.default.object({
14945
14945
  verifiedEmail: import_joi61.default.boolean().optional(),
14946
14946
  country: import_joi61.default.string().required(),
14947
14947
  streetAddress: import_joi61.default.string().optional().allow(""),
14948
- cityState: import_joi61.default.string().required(),
14948
+ city: import_joi61.default.string().required(),
14949
14949
  postalCode: import_joi61.default.string().optional().allow(""),
14950
14950
  citizenship: import_joi61.default.string().optional().allow("")
14951
14951
  });
@@ -14957,7 +14957,7 @@ var schemaJobProfileContactInfo = import_joi61.default.object({
14957
14957
  contact: import_joi61.default.string().optional().allow(""),
14958
14958
  showContact: import_joi61.default.boolean().optional(),
14959
14959
  country: import_joi61.default.string().optional().allow(""),
14960
- cityState: import_joi61.default.string().optional().allow(""),
14960
+ city: import_joi61.default.string().optional().allow(""),
14961
14961
  streetAddress: import_joi61.default.string().optional().allow(""),
14962
14962
  postalCode: import_joi61.default.string().optional().allow(""),
14963
14963
  relocate: import_joi61.default.boolean().optional()
@@ -15040,7 +15040,7 @@ function modelJobProfile(data) {
15040
15040
  verifiedEmail: data.verifiedEmail ?? false,
15041
15041
  country: data.country,
15042
15042
  streetAddress: data.streetAddress ?? "",
15043
- cityState: data.cityState,
15043
+ city: data.city,
15044
15044
  postalCode: data.postalCode ?? "",
15045
15045
  relocate: data.relocate,
15046
15046
  summary: data.summary ?? "",
@@ -15081,7 +15081,7 @@ function modelJobProfileWorkExp(data) {
15081
15081
  jobTitle: data.jobTitle,
15082
15082
  company: data.company,
15083
15083
  country: data.country,
15084
- cityState: data.cityState ?? "",
15084
+ city: data.city ?? "",
15085
15085
  fromMonth: data.fromMonth,
15086
15086
  fromYear: data.fromYear,
15087
15087
  toMonth: data.toMonth ?? "",
@@ -15960,21 +15960,255 @@ function useJobProfileRepo() {
15960
15960
  }
15961
15961
 
15962
15962
  // src/resources/job-profile/job.profile.controller.ts
15963
+ var import_utils82 = require("@goweekdays/utils");
15964
+ var import_joi64 = __toESM(require("joi"));
15965
+
15966
+ // src/resources/job-profile/job.profile.service.ts
15963
15967
  var import_utils81 = require("@goweekdays/utils");
15964
15968
  var import_joi63 = __toESM(require("joi"));
15969
+ function useJobPostProfileSvc() {
15970
+ const {
15971
+ updateContactInfoById: _updateContactInfoById,
15972
+ updatePersonalInfoById: _updatePersonalInfoById,
15973
+ addWorkExpById: _addWorkExpById,
15974
+ updateWorkExpById: _updateWorkExpById,
15975
+ addEduById: _addEduById,
15976
+ updateEduById: _updateEduById
15977
+ } = useJobProfileRepo();
15978
+ const { getByName: getCountryByName, add: addCountry } = useOptionRepo("option.countries");
15979
+ const { getByName: getCityByName, add: addCity } = useOptionRepo("option.cities");
15980
+ const { getByName: getJobTitleByName, add: addJobTitle } = useOptionRepo("option.job.titles");
15981
+ async function updateContactInfoById(id, options) {
15982
+ const { error } = schemaJobProfileContactInfo.validate({ ...options, id });
15983
+ if (error) {
15984
+ throw new import_utils81.BadRequestError(error.message);
15985
+ }
15986
+ const session = import_utils81.useAtlas.getClient()?.startSession();
15987
+ if (!session) {
15988
+ throw new import_utils81.InternalServerError("Failed to start database session.");
15989
+ }
15990
+ try {
15991
+ session.startTransaction();
15992
+ if (options.country) {
15993
+ const country = await getCountryByName(options.country);
15994
+ if (!country) {
15995
+ await addCountry({ name: options.country }, session);
15996
+ }
15997
+ }
15998
+ if (options.city) {
15999
+ const city = await getCityByName(options.city);
16000
+ if (!city) {
16001
+ await addCity({ name: options.city }, session);
16002
+ }
16003
+ }
16004
+ await _updateContactInfoById(id, options);
16005
+ await session.commitTransaction();
16006
+ return "Successfully updated contact info.";
16007
+ } catch (error2) {
16008
+ await session.abortTransaction();
16009
+ if (error2 instanceof import_utils81.AppError) {
16010
+ throw error2;
16011
+ }
16012
+ throw new import_utils81.InternalServerError("Failed to update contact info.");
16013
+ } finally {
16014
+ await session.endSession();
16015
+ }
16016
+ }
16017
+ async function updatePersonalInfoById(id, options) {
16018
+ const { error } = import_joi63.default.object({
16019
+ id: import_joi63.default.string().required(),
16020
+ citizenship: import_joi63.default.string().optional()
16021
+ }).validate({ id, ...options });
16022
+ if (error) {
16023
+ throw new import_utils81.BadRequestError(error.message);
16024
+ }
16025
+ const session = import_utils81.useAtlas.getClient()?.startSession();
16026
+ if (!session) {
16027
+ throw new import_utils81.InternalServerError("Failed to start database session.");
16028
+ }
16029
+ try {
16030
+ session.startTransaction();
16031
+ if (options.citizenship) {
16032
+ const citizenship = await getCountryByName(options.citizenship);
16033
+ if (!citizenship) {
16034
+ await addCountry({ name: options.citizenship }, session);
16035
+ }
16036
+ }
16037
+ await _updatePersonalInfoById(id, options);
16038
+ await session.commitTransaction();
16039
+ return "Successfully updated personal info.";
16040
+ } catch (error2) {
16041
+ await session.abortTransaction();
16042
+ if (error2 instanceof import_utils81.AppError) {
16043
+ throw error2;
16044
+ }
16045
+ throw new import_utils81.InternalServerError("Failed to update personal info.");
16046
+ } finally {
16047
+ await session.endSession();
16048
+ }
16049
+ }
16050
+ async function addWorkExpById(id, workExp2) {
16051
+ const { error } = schemaJobProfileWorkExp.validate({ _id: id, ...workExp2 });
16052
+ if (error) {
16053
+ throw new import_utils81.BadRequestError(error.message);
16054
+ }
16055
+ const session = import_utils81.useAtlas.getClient()?.startSession();
16056
+ if (!session) {
16057
+ throw new import_utils81.InternalServerError("Failed to start database session.");
16058
+ }
16059
+ try {
16060
+ session.startTransaction();
16061
+ const country = await getCountryByName(workExp2.country);
16062
+ if (!country) {
16063
+ await addCountry({ name: workExp2.country }, session);
16064
+ }
16065
+ if (workExp2.city) {
16066
+ const city = await getCityByName(workExp2.city);
16067
+ if (!city) {
16068
+ await addCity({ name: workExp2.city }, session);
16069
+ }
16070
+ }
16071
+ const jobTitle = await getJobTitleByName(workExp2.jobTitle);
16072
+ if (!jobTitle) {
16073
+ await addJobTitle({ name: workExp2.jobTitle }, session);
16074
+ }
16075
+ await _addWorkExpById(id, workExp2);
16076
+ await session.commitTransaction();
16077
+ return "Successfully added work experience.";
16078
+ } catch (error2) {
16079
+ await session.abortTransaction();
16080
+ if (error2 instanceof import_utils81.AppError) {
16081
+ throw error2;
16082
+ }
16083
+ throw new import_utils81.InternalServerError("Failed to add work experience.");
16084
+ } finally {
16085
+ await session.endSession();
16086
+ }
16087
+ }
16088
+ async function updateWorkExpById(id, workExp2) {
16089
+ const { error } = schemaJobProfileWorkExp.validate({ _id: id, ...workExp2 });
16090
+ if (error) {
16091
+ throw new import_utils81.BadRequestError(error.message);
16092
+ }
16093
+ const session = import_utils81.useAtlas.getClient()?.startSession();
16094
+ if (!session) {
16095
+ throw new import_utils81.InternalServerError("Failed to start database session.");
16096
+ }
16097
+ try {
16098
+ session.startTransaction();
16099
+ const country = await getCountryByName(workExp2.country);
16100
+ if (!country) {
16101
+ await addCountry({ name: workExp2.country }, session);
16102
+ }
16103
+ if (workExp2.city) {
16104
+ const city = await getCityByName(workExp2.city);
16105
+ if (!city) {
16106
+ await addCity({ name: workExp2.city }, session);
16107
+ }
16108
+ }
16109
+ const jobTitle = await getJobTitleByName(workExp2.jobTitle);
16110
+ if (!jobTitle) {
16111
+ await addJobTitle({ name: workExp2.jobTitle }, session);
16112
+ }
16113
+ await _updateWorkExpById(id, workExp2);
16114
+ await session.commitTransaction();
16115
+ return "Successfully updated work experience.";
16116
+ } catch (error2) {
16117
+ await session.abortTransaction();
16118
+ if (error2 instanceof import_utils81.AppError) {
16119
+ throw error2;
16120
+ }
16121
+ throw new import_utils81.InternalServerError("Failed to update work experience.");
16122
+ } finally {
16123
+ await session.endSession();
16124
+ }
16125
+ }
16126
+ async function addEduById(id, edu) {
16127
+ const { error } = schemaJobProfileEdu.validate({ _id: id, ...edu });
16128
+ if (error) {
16129
+ throw new import_utils81.BadRequestError(error.message);
16130
+ }
16131
+ const session = import_utils81.useAtlas.getClient()?.startSession();
16132
+ if (!session) {
16133
+ throw new import_utils81.InternalServerError("Failed to start database session.");
16134
+ }
16135
+ try {
16136
+ session.startTransaction();
16137
+ const country = await getCountryByName(edu.country);
16138
+ if (!country) {
16139
+ await addCountry({ name: edu.country }, session);
16140
+ }
16141
+ if (edu.location) {
16142
+ const location = await getCityByName(edu.location);
16143
+ if (!location) {
16144
+ await addCity({ name: edu.location }, session);
16145
+ }
16146
+ }
16147
+ await _addEduById(id, edu);
16148
+ await session.commitTransaction();
16149
+ return "Successfully added education.";
16150
+ } catch (error2) {
16151
+ await session.abortTransaction();
16152
+ if (error2 instanceof import_utils81.AppError) {
16153
+ throw error2;
16154
+ }
16155
+ throw new import_utils81.InternalServerError("Failed to add education.");
16156
+ } finally {
16157
+ await session.endSession();
16158
+ }
16159
+ }
16160
+ async function updateEduById(id, edu) {
16161
+ const { error } = schemaJobProfileEdu.validate({ _id: id, ...edu });
16162
+ if (error) {
16163
+ throw new import_utils81.BadRequestError(error.message);
16164
+ }
16165
+ const session = import_utils81.useAtlas.getClient()?.startSession();
16166
+ if (!session) {
16167
+ throw new import_utils81.InternalServerError("Failed to start database session.");
16168
+ }
16169
+ try {
16170
+ session.startTransaction();
16171
+ const country = await getCountryByName(edu.country);
16172
+ if (!country) {
16173
+ await addCountry({ name: edu.country }, session);
16174
+ }
16175
+ if (edu.location) {
16176
+ const location = await getCityByName(edu.location);
16177
+ if (!location) {
16178
+ await addCity({ name: edu.location }, session);
16179
+ }
16180
+ }
16181
+ await _updateEduById(id, edu);
16182
+ await session.commitTransaction();
16183
+ return "Successfully updated education.";
16184
+ } catch (error2) {
16185
+ await session.abortTransaction();
16186
+ if (error2 instanceof import_utils81.AppError) {
16187
+ throw error2;
16188
+ }
16189
+ throw new import_utils81.InternalServerError("Failed to update education.");
16190
+ } finally {
16191
+ await session.endSession();
16192
+ }
16193
+ }
16194
+ return {
16195
+ updateContactInfoById,
16196
+ updatePersonalInfoById,
16197
+ addWorkExpById,
16198
+ updateWorkExpById,
16199
+ addEduById,
16200
+ updateEduById
16201
+ };
16202
+ }
16203
+
16204
+ // src/resources/job-profile/job.profile.controller.ts
15965
16205
  function useJobProfileCtrl() {
15966
16206
  const {
15967
16207
  add: _add,
15968
16208
  getAll: _getAll,
15969
16209
  getByUser: _getByUser,
15970
- updateContactInfoById: _updateContactInfoById,
15971
16210
  updateSummaryById: _updateSummaryById,
15972
- updatePersonalInfoById: _updatePersonalInfoById,
15973
- addWorkExpById: _addWorkExpById,
15974
- updateWorkExpById: _updateWorkExpById,
15975
16211
  deleteWorkExpById: _deleteWorkExpById,
15976
- addEduById: _addEduById,
15977
- updateEduById: _updateEduById,
15978
16212
  deleteEduById: _deleteEduById,
15979
16213
  addSkillById: _addSkillById,
15980
16214
  updateSkillById: _updateSkillById,
@@ -15987,11 +16221,19 @@ function useJobProfileCtrl() {
15987
16221
  deleteCertById: _deleteCertById,
15988
16222
  updateAdditionalInfoById: _updateAdditionalInfoById
15989
16223
  } = useJobProfileRepo();
16224
+ const {
16225
+ updateContactInfoById: _updateContactInfoById,
16226
+ updatePersonalInfoById: _updatePersonalInfoById,
16227
+ addWorkExpById: _addWorkExpById,
16228
+ updateWorkExpById: _updateWorkExpById,
16229
+ addEduById: _addEduById,
16230
+ updateEduById: _updateEduById
16231
+ } = useJobPostProfileSvc();
15990
16232
  async function add(req, res, next) {
15991
16233
  const { error } = schemaJobProfile.validate(req.body);
15992
16234
  if (error) {
15993
16235
  next(
15994
- new import_utils81.BadRequestError(`Invalid job application data: ${error.message}`)
16236
+ new import_utils82.BadRequestError(`Invalid job application data: ${error.message}`)
15995
16237
  );
15996
16238
  return;
15997
16239
  }
@@ -16000,26 +16242,26 @@ function useJobProfileCtrl() {
16000
16242
  res.json({ message });
16001
16243
  return;
16002
16244
  } catch (error2) {
16003
- if (error2 instanceof import_utils81.AppError) {
16245
+ if (error2 instanceof import_utils82.AppError) {
16004
16246
  next(error2);
16005
16247
  return;
16006
16248
  }
16007
16249
  next(
16008
- new import_utils81.BadRequestError(
16250
+ new import_utils82.BadRequestError(
16009
16251
  `Failed to create job application: ${error2.message}`
16010
16252
  )
16011
16253
  );
16012
16254
  }
16013
16255
  }
16014
16256
  async function getAll(req, res, next) {
16015
- const validation = import_joi63.default.object({
16016
- page: import_joi63.default.number().integer().min(1).optional(),
16017
- limit: import_joi63.default.number().integer().min(1).max(100).optional(),
16018
- search: import_joi63.default.string().optional().allow("")
16257
+ const validation = import_joi64.default.object({
16258
+ page: import_joi64.default.number().integer().min(1).optional(),
16259
+ limit: import_joi64.default.number().integer().min(1).max(100).optional(),
16260
+ search: import_joi64.default.string().optional().allow("")
16019
16261
  });
16020
16262
  const { error } = validation.validate(req.query);
16021
16263
  if (error) {
16022
- next(new import_utils81.BadRequestError(`Invalid query parameters: ${error.message}`));
16264
+ next(new import_utils82.BadRequestError(`Invalid query parameters: ${error.message}`));
16023
16265
  return;
16024
16266
  }
16025
16267
  const page = req.query.page ? parseInt(req.query.page) : 1;
@@ -16030,35 +16272,35 @@ function useJobProfileCtrl() {
16030
16272
  res.json(data);
16031
16273
  return;
16032
16274
  } catch (error2) {
16033
- if (error2 instanceof import_utils81.AppError) {
16275
+ if (error2 instanceof import_utils82.AppError) {
16034
16276
  next(error2);
16035
16277
  return;
16036
16278
  }
16037
- next(new import_utils81.BadRequestError(`Failed to get job profiles: ${error2.message}`));
16279
+ next(new import_utils82.BadRequestError(`Failed to get job profiles: ${error2.message}`));
16038
16280
  }
16039
16281
  }
16040
16282
  async function getByUser(req, res, next) {
16041
16283
  const user = req.params.user ?? "";
16042
- const { error } = import_joi63.default.string().hex().length(24).required().validate(user);
16284
+ const { error } = import_joi64.default.string().hex().length(24).required().validate(user);
16043
16285
  if (error) {
16044
- next(new import_utils81.BadRequestError(`Invalid user id: ${user}`));
16286
+ next(new import_utils82.BadRequestError(`Invalid user id: ${user}`));
16045
16287
  return;
16046
16288
  }
16047
16289
  try {
16048
16290
  const data = await _getByUser(user);
16049
16291
  if (!data) {
16050
- next(new import_utils81.NotFoundError(`Job profile not found for user: ${user}`));
16292
+ next(new import_utils82.NotFoundError(`Job profile not found for user: ${user}`));
16051
16293
  return;
16052
16294
  }
16053
16295
  res.json(data);
16054
16296
  return;
16055
16297
  } catch (error2) {
16056
- if (error2 instanceof import_utils81.AppError) {
16298
+ if (error2 instanceof import_utils82.AppError) {
16057
16299
  next(error2);
16058
16300
  return;
16059
16301
  }
16060
16302
  next(
16061
- new import_utils81.BadRequestError(`Failed to get job application: ${error2.message}`)
16303
+ new import_utils82.BadRequestError(`Failed to get job application: ${error2.message}`)
16062
16304
  );
16063
16305
  }
16064
16306
  }
@@ -16067,7 +16309,7 @@ function useJobProfileCtrl() {
16067
16309
  const options = req.body;
16068
16310
  const { error } = schemaJobProfileContactInfo.validate({ ...options, id });
16069
16311
  if (error) {
16070
- next(new import_utils81.BadRequestError(`Invalid job profile data: ${error.message}`));
16312
+ next(new import_utils82.BadRequestError(`Invalid job profile data: ${error.message}`));
16071
16313
  return;
16072
16314
  }
16073
16315
  try {
@@ -16075,12 +16317,12 @@ function useJobProfileCtrl() {
16075
16317
  res.json({ message });
16076
16318
  return;
16077
16319
  } catch (error2) {
16078
- if (error2 instanceof import_utils81.AppError) {
16320
+ if (error2 instanceof import_utils82.AppError) {
16079
16321
  next(error2);
16080
16322
  return;
16081
16323
  }
16082
16324
  next(
16083
- new import_utils81.BadRequestError(
16325
+ new import_utils82.BadRequestError(
16084
16326
  `Failed to update job profile contact info: ${error2.message}`
16085
16327
  )
16086
16328
  );
@@ -16091,7 +16333,7 @@ function useJobProfileCtrl() {
16091
16333
  const summary = req.body.summary ?? "";
16092
16334
  const { error } = schemaJobProfileSummary.validate({ id, summary });
16093
16335
  if (error) {
16094
- next(new import_utils81.BadRequestError(`Invalid job profile data: ${error.message}`));
16336
+ next(new import_utils82.BadRequestError(`Invalid job profile data: ${error.message}`));
16095
16337
  return;
16096
16338
  }
16097
16339
  try {
@@ -16099,12 +16341,12 @@ function useJobProfileCtrl() {
16099
16341
  res.json({ message });
16100
16342
  return;
16101
16343
  } catch (error2) {
16102
- if (error2 instanceof import_utils81.AppError) {
16344
+ if (error2 instanceof import_utils82.AppError) {
16103
16345
  next(error2);
16104
16346
  return;
16105
16347
  }
16106
16348
  next(
16107
- new import_utils81.BadRequestError(
16349
+ new import_utils82.BadRequestError(
16108
16350
  `Failed to update job profile summary: ${error2.message}`
16109
16351
  )
16110
16352
  );
@@ -16115,7 +16357,7 @@ function useJobProfileCtrl() {
16115
16357
  const options = req.body;
16116
16358
  const { error } = schemaJobProfilePersonalInfo.validate({ ...options, id });
16117
16359
  if (error) {
16118
- next(new import_utils81.BadRequestError(`Invalid job profile data: ${error.message}`));
16360
+ next(new import_utils82.BadRequestError(`Invalid job profile data: ${error.message}`));
16119
16361
  return;
16120
16362
  }
16121
16363
  try {
@@ -16123,12 +16365,12 @@ function useJobProfileCtrl() {
16123
16365
  res.json({ message });
16124
16366
  return;
16125
16367
  } catch (error2) {
16126
- if (error2 instanceof import_utils81.AppError) {
16368
+ if (error2 instanceof import_utils82.AppError) {
16127
16369
  next(error2);
16128
16370
  return;
16129
16371
  }
16130
16372
  next(
16131
- new import_utils81.BadRequestError(
16373
+ new import_utils82.BadRequestError(
16132
16374
  `Failed to update job profile personal info: ${error2.message}`
16133
16375
  )
16134
16376
  );
@@ -16140,7 +16382,7 @@ function useJobProfileCtrl() {
16140
16382
  const { error } = schemaJobProfileWorkExp.validate({ _id, ...workExp2 });
16141
16383
  if (error) {
16142
16384
  next(
16143
- new import_utils81.BadRequestError(`Invalid work experience data: ${error.message}`)
16385
+ new import_utils82.BadRequestError(`Invalid work experience data: ${error.message}`)
16144
16386
  );
16145
16387
  return;
16146
16388
  }
@@ -16149,12 +16391,12 @@ function useJobProfileCtrl() {
16149
16391
  res.json({ message });
16150
16392
  return;
16151
16393
  } catch (error2) {
16152
- if (error2 instanceof import_utils81.AppError) {
16394
+ if (error2 instanceof import_utils82.AppError) {
16153
16395
  next(error2);
16154
16396
  return;
16155
16397
  }
16156
16398
  next(
16157
- new import_utils81.BadRequestError(`Failed to add work experience: ${error2.message}`)
16399
+ new import_utils82.BadRequestError(`Failed to add work experience: ${error2.message}`)
16158
16400
  );
16159
16401
  }
16160
16402
  }
@@ -16164,7 +16406,7 @@ function useJobProfileCtrl() {
16164
16406
  const { error } = schemaJobProfileWorkExp.validate({ _id, ...workExp2 });
16165
16407
  if (error) {
16166
16408
  next(
16167
- new import_utils81.BadRequestError(`Invalid work experience data: ${error.message}`)
16409
+ new import_utils82.BadRequestError(`Invalid work experience data: ${error.message}`)
16168
16410
  );
16169
16411
  return;
16170
16412
  }
@@ -16173,12 +16415,12 @@ function useJobProfileCtrl() {
16173
16415
  res.json({ message });
16174
16416
  return;
16175
16417
  } catch (error2) {
16176
- if (error2 instanceof import_utils81.AppError) {
16418
+ if (error2 instanceof import_utils82.AppError) {
16177
16419
  next(error2);
16178
16420
  return;
16179
16421
  }
16180
16422
  next(
16181
- new import_utils81.BadRequestError(
16423
+ new import_utils82.BadRequestError(
16182
16424
  `Failed to update work experience: ${error2.message}`
16183
16425
  )
16184
16426
  );
@@ -16190,7 +16432,7 @@ function useJobProfileCtrl() {
16190
16432
  const { error } = schemaJobProfileWorkExpDel.validate({ id, workExpId });
16191
16433
  if (error) {
16192
16434
  next(
16193
- new import_utils81.BadRequestError(`Invalid work experience data: ${error.message}`)
16435
+ new import_utils82.BadRequestError(`Invalid work experience data: ${error.message}`)
16194
16436
  );
16195
16437
  return;
16196
16438
  }
@@ -16199,12 +16441,12 @@ function useJobProfileCtrl() {
16199
16441
  res.json({ message });
16200
16442
  return;
16201
16443
  } catch (error2) {
16202
- if (error2 instanceof import_utils81.AppError) {
16444
+ if (error2 instanceof import_utils82.AppError) {
16203
16445
  next(error2);
16204
16446
  return;
16205
16447
  }
16206
16448
  next(
16207
- new import_utils81.BadRequestError(
16449
+ new import_utils82.BadRequestError(
16208
16450
  `Failed to delete work experience: ${error2.message}`
16209
16451
  )
16210
16452
  );
@@ -16215,7 +16457,7 @@ function useJobProfileCtrl() {
16215
16457
  const edu = req.body;
16216
16458
  const { error } = schemaJobProfileEdu.validate({ _id, ...edu });
16217
16459
  if (error) {
16218
- next(new import_utils81.BadRequestError(`Invalid education data: ${error.message}`));
16460
+ next(new import_utils82.BadRequestError(`Invalid education data: ${error.message}`));
16219
16461
  return;
16220
16462
  }
16221
16463
  try {
@@ -16223,11 +16465,11 @@ function useJobProfileCtrl() {
16223
16465
  res.json({ message });
16224
16466
  return;
16225
16467
  } catch (error2) {
16226
- if (error2 instanceof import_utils81.AppError) {
16468
+ if (error2 instanceof import_utils82.AppError) {
16227
16469
  next(error2);
16228
16470
  return;
16229
16471
  }
16230
- next(new import_utils81.BadRequestError(`Failed to add education: ${error2.message}`));
16472
+ next(new import_utils82.BadRequestError(`Failed to add education: ${error2.message}`));
16231
16473
  }
16232
16474
  }
16233
16475
  async function updateEduById(req, res, next) {
@@ -16235,7 +16477,7 @@ function useJobProfileCtrl() {
16235
16477
  const edu = req.body;
16236
16478
  const { error } = schemaJobProfileEdu.validate({ _id, ...edu });
16237
16479
  if (error) {
16238
- next(new import_utils81.BadRequestError(`Invalid education data: ${error.message}`));
16480
+ next(new import_utils82.BadRequestError(`Invalid education data: ${error.message}`));
16239
16481
  return;
16240
16482
  }
16241
16483
  try {
@@ -16243,11 +16485,11 @@ function useJobProfileCtrl() {
16243
16485
  res.json({ message });
16244
16486
  return;
16245
16487
  } catch (error2) {
16246
- if (error2 instanceof import_utils81.AppError) {
16488
+ if (error2 instanceof import_utils82.AppError) {
16247
16489
  next(error2);
16248
16490
  return;
16249
16491
  }
16250
- next(new import_utils81.BadRequestError(`Failed to update education: ${error2.message}`));
16492
+ next(new import_utils82.BadRequestError(`Failed to update education: ${error2.message}`));
16251
16493
  }
16252
16494
  }
16253
16495
  async function deleteEduById(req, res, next) {
@@ -16255,7 +16497,7 @@ function useJobProfileCtrl() {
16255
16497
  const eduId = req.params.eduId ?? "";
16256
16498
  const { error } = schemaJobProfileEduDel.validate({ id, eduId });
16257
16499
  if (error) {
16258
- next(new import_utils81.BadRequestError(`Invalid education data: ${error.message}`));
16500
+ next(new import_utils82.BadRequestError(`Invalid education data: ${error.message}`));
16259
16501
  return;
16260
16502
  }
16261
16503
  try {
@@ -16263,11 +16505,11 @@ function useJobProfileCtrl() {
16263
16505
  res.json({ message });
16264
16506
  return;
16265
16507
  } catch (error2) {
16266
- if (error2 instanceof import_utils81.AppError) {
16508
+ if (error2 instanceof import_utils82.AppError) {
16267
16509
  next(error2);
16268
16510
  return;
16269
16511
  }
16270
- next(new import_utils81.BadRequestError(`Failed to delete education: ${error2.message}`));
16512
+ next(new import_utils82.BadRequestError(`Failed to delete education: ${error2.message}`));
16271
16513
  }
16272
16514
  }
16273
16515
  async function addSkillById(req, res, next) {
@@ -16275,7 +16517,7 @@ function useJobProfileCtrl() {
16275
16517
  const skill2 = req.body;
16276
16518
  const { error } = schemaJobProfileSkill.validate({ _id, ...skill2 });
16277
16519
  if (error) {
16278
- next(new import_utils81.BadRequestError(`Invalid skill data: ${error.message}`));
16520
+ next(new import_utils82.BadRequestError(`Invalid skill data: ${error.message}`));
16279
16521
  return;
16280
16522
  }
16281
16523
  try {
@@ -16283,11 +16525,11 @@ function useJobProfileCtrl() {
16283
16525
  res.json({ message });
16284
16526
  return;
16285
16527
  } catch (error2) {
16286
- if (error2 instanceof import_utils81.AppError) {
16528
+ if (error2 instanceof import_utils82.AppError) {
16287
16529
  next(error2);
16288
16530
  return;
16289
16531
  }
16290
- next(new import_utils81.BadRequestError(`Failed to add skill: ${error2.message}`));
16532
+ next(new import_utils82.BadRequestError(`Failed to add skill: ${error2.message}`));
16291
16533
  }
16292
16534
  }
16293
16535
  async function updateSkillById(req, res, next) {
@@ -16295,7 +16537,7 @@ function useJobProfileCtrl() {
16295
16537
  const skill2 = req.body;
16296
16538
  const { error } = schemaJobProfileSkill.validate({ _id, ...skill2 });
16297
16539
  if (error) {
16298
- next(new import_utils81.BadRequestError(`Invalid skill data: ${error.message}`));
16540
+ next(new import_utils82.BadRequestError(`Invalid skill data: ${error.message}`));
16299
16541
  return;
16300
16542
  }
16301
16543
  try {
@@ -16303,11 +16545,11 @@ function useJobProfileCtrl() {
16303
16545
  res.json({ message });
16304
16546
  return;
16305
16547
  } catch (error2) {
16306
- if (error2 instanceof import_utils81.AppError) {
16548
+ if (error2 instanceof import_utils82.AppError) {
16307
16549
  next(error2);
16308
16550
  return;
16309
16551
  }
16310
- next(new import_utils81.BadRequestError(`Failed to update skill: ${error2.message}`));
16552
+ next(new import_utils82.BadRequestError(`Failed to update skill: ${error2.message}`));
16311
16553
  }
16312
16554
  }
16313
16555
  async function deleteSkillById(req, res, next) {
@@ -16315,7 +16557,7 @@ function useJobProfileCtrl() {
16315
16557
  const skillId = req.params.skillId ?? "";
16316
16558
  const { error } = schemaJobProfileSkillDel.validate({ id, skillId });
16317
16559
  if (error) {
16318
- next(new import_utils81.BadRequestError(`Invalid skill data: ${error.message}`));
16560
+ next(new import_utils82.BadRequestError(`Invalid skill data: ${error.message}`));
16319
16561
  return;
16320
16562
  }
16321
16563
  try {
@@ -16323,11 +16565,11 @@ function useJobProfileCtrl() {
16323
16565
  res.json({ message });
16324
16566
  return;
16325
16567
  } catch (error2) {
16326
- if (error2 instanceof import_utils81.AppError) {
16568
+ if (error2 instanceof import_utils82.AppError) {
16327
16569
  next(error2);
16328
16570
  return;
16329
16571
  }
16330
- next(new import_utils81.BadRequestError(`Failed to delete skill: ${error2.message}`));
16572
+ next(new import_utils82.BadRequestError(`Failed to delete skill: ${error2.message}`));
16331
16573
  }
16332
16574
  }
16333
16575
  async function updateAdditionalInfoById(req, res, next) {
@@ -16338,7 +16580,7 @@ function useJobProfileCtrl() {
16338
16580
  additionalInfo
16339
16581
  });
16340
16582
  if (error) {
16341
- next(new import_utils81.BadRequestError(`Invalid job profile data: ${error.message}`));
16583
+ next(new import_utils82.BadRequestError(`Invalid job profile data: ${error.message}`));
16342
16584
  return;
16343
16585
  }
16344
16586
  try {
@@ -16346,12 +16588,12 @@ function useJobProfileCtrl() {
16346
16588
  res.json({ message });
16347
16589
  return;
16348
16590
  } catch (error2) {
16349
- if (error2 instanceof import_utils81.AppError) {
16591
+ if (error2 instanceof import_utils82.AppError) {
16350
16592
  next(error2);
16351
16593
  return;
16352
16594
  }
16353
16595
  next(
16354
- new import_utils81.BadRequestError(
16596
+ new import_utils82.BadRequestError(
16355
16597
  `Failed to update job profile additional info: ${error2.message}`
16356
16598
  )
16357
16599
  );
@@ -16362,7 +16604,7 @@ function useJobProfileCtrl() {
16362
16604
  const lang = req.body;
16363
16605
  const { error } = schemaJobProfileLang.validate({ _id, ...lang });
16364
16606
  if (error) {
16365
- next(new import_utils81.BadRequestError(`Invalid language data: ${error.message}`));
16607
+ next(new import_utils82.BadRequestError(`Invalid language data: ${error.message}`));
16366
16608
  return;
16367
16609
  }
16368
16610
  try {
@@ -16370,11 +16612,11 @@ function useJobProfileCtrl() {
16370
16612
  res.json({ message });
16371
16613
  return;
16372
16614
  } catch (error2) {
16373
- if (error2 instanceof import_utils81.AppError) {
16615
+ if (error2 instanceof import_utils82.AppError) {
16374
16616
  next(error2);
16375
16617
  return;
16376
16618
  }
16377
- next(new import_utils81.BadRequestError(`Failed to add language: ${error2.message}`));
16619
+ next(new import_utils82.BadRequestError(`Failed to add language: ${error2.message}`));
16378
16620
  }
16379
16621
  }
16380
16622
  async function updateLangById(req, res, next) {
@@ -16382,7 +16624,7 @@ function useJobProfileCtrl() {
16382
16624
  const lang = req.body;
16383
16625
  const { error } = schemaJobProfileLang.validate({ _id, ...lang });
16384
16626
  if (error) {
16385
- next(new import_utils81.BadRequestError(`Invalid language data: ${error.message}`));
16627
+ next(new import_utils82.BadRequestError(`Invalid language data: ${error.message}`));
16386
16628
  return;
16387
16629
  }
16388
16630
  try {
@@ -16390,11 +16632,11 @@ function useJobProfileCtrl() {
16390
16632
  res.json({ message });
16391
16633
  return;
16392
16634
  } catch (error2) {
16393
- if (error2 instanceof import_utils81.AppError) {
16635
+ if (error2 instanceof import_utils82.AppError) {
16394
16636
  next(error2);
16395
16637
  return;
16396
16638
  }
16397
- next(new import_utils81.BadRequestError(`Failed to update language: ${error2.message}`));
16639
+ next(new import_utils82.BadRequestError(`Failed to update language: ${error2.message}`));
16398
16640
  }
16399
16641
  }
16400
16642
  async function deleteLangById(req, res, next) {
@@ -16402,7 +16644,7 @@ function useJobProfileCtrl() {
16402
16644
  const langId = req.params.langId ?? "";
16403
16645
  const { error } = schemaJobProfileLangDel.validate({ id, langId });
16404
16646
  if (error) {
16405
- next(new import_utils81.BadRequestError(`Invalid language data: ${error.message}`));
16647
+ next(new import_utils82.BadRequestError(`Invalid language data: ${error.message}`));
16406
16648
  return;
16407
16649
  }
16408
16650
  try {
@@ -16410,11 +16652,11 @@ function useJobProfileCtrl() {
16410
16652
  res.json({ message });
16411
16653
  return;
16412
16654
  } catch (error2) {
16413
- if (error2 instanceof import_utils81.AppError) {
16655
+ if (error2 instanceof import_utils82.AppError) {
16414
16656
  next(error2);
16415
16657
  return;
16416
16658
  }
16417
- next(new import_utils81.BadRequestError(`Failed to delete language: ${error2.message}`));
16659
+ next(new import_utils82.BadRequestError(`Failed to delete language: ${error2.message}`));
16418
16660
  }
16419
16661
  }
16420
16662
  async function addCertById(req, res, next) {
@@ -16422,7 +16664,7 @@ function useJobProfileCtrl() {
16422
16664
  const cert = req.body;
16423
16665
  const { error } = schemaJobProfileCert.validate({ _id, ...cert });
16424
16666
  if (error) {
16425
- next(new import_utils81.BadRequestError(`Invalid certification data: ${error.message}`));
16667
+ next(new import_utils82.BadRequestError(`Invalid certification data: ${error.message}`));
16426
16668
  return;
16427
16669
  }
16428
16670
  try {
@@ -16430,12 +16672,12 @@ function useJobProfileCtrl() {
16430
16672
  res.json({ message });
16431
16673
  return;
16432
16674
  } catch (error2) {
16433
- if (error2 instanceof import_utils81.AppError) {
16675
+ if (error2 instanceof import_utils82.AppError) {
16434
16676
  next(error2);
16435
16677
  return;
16436
16678
  }
16437
16679
  next(
16438
- new import_utils81.BadRequestError(`Failed to add certification: ${error2.message}`)
16680
+ new import_utils82.BadRequestError(`Failed to add certification: ${error2.message}`)
16439
16681
  );
16440
16682
  }
16441
16683
  }
@@ -16444,7 +16686,7 @@ function useJobProfileCtrl() {
16444
16686
  const cert = req.body;
16445
16687
  const { error } = schemaJobProfileCert.validate({ _id, ...cert });
16446
16688
  if (error) {
16447
- next(new import_utils81.BadRequestError(`Invalid certification data: ${error.message}`));
16689
+ next(new import_utils82.BadRequestError(`Invalid certification data: ${error.message}`));
16448
16690
  return;
16449
16691
  }
16450
16692
  try {
@@ -16452,12 +16694,12 @@ function useJobProfileCtrl() {
16452
16694
  res.json({ message });
16453
16695
  return;
16454
16696
  } catch (error2) {
16455
- if (error2 instanceof import_utils81.AppError) {
16697
+ if (error2 instanceof import_utils82.AppError) {
16456
16698
  next(error2);
16457
16699
  return;
16458
16700
  }
16459
16701
  next(
16460
- new import_utils81.BadRequestError(`Failed to update certification: ${error2.message}`)
16702
+ new import_utils82.BadRequestError(`Failed to update certification: ${error2.message}`)
16461
16703
  );
16462
16704
  }
16463
16705
  }
@@ -16466,7 +16708,7 @@ function useJobProfileCtrl() {
16466
16708
  const certId = req.params.certId ?? "";
16467
16709
  const { error } = schemaJobProfileCertDel.validate({ id, certId });
16468
16710
  if (error) {
16469
- next(new import_utils81.BadRequestError(`Invalid certification data: ${error.message}`));
16711
+ next(new import_utils82.BadRequestError(`Invalid certification data: ${error.message}`));
16470
16712
  return;
16471
16713
  }
16472
16714
  try {
@@ -16474,12 +16716,12 @@ function useJobProfileCtrl() {
16474
16716
  res.json({ message });
16475
16717
  return;
16476
16718
  } catch (error2) {
16477
- if (error2 instanceof import_utils81.AppError) {
16719
+ if (error2 instanceof import_utils82.AppError) {
16478
16720
  next(error2);
16479
16721
  return;
16480
16722
  }
16481
16723
  next(
16482
- new import_utils81.BadRequestError(`Failed to delete certification: ${error2.message}`)
16724
+ new import_utils82.BadRequestError(`Failed to delete certification: ${error2.message}`)
16483
16725
  );
16484
16726
  }
16485
16727
  }