jp-shared 1.0.28 → 1.0.29
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/package.json
CHANGED
|
@@ -64,52 +64,99 @@ const pendingJobPostStep2Schema = new mongoose.Schema(
|
|
|
64
64
|
minlength: [3, "Experience level must be at least 3 characters"],
|
|
65
65
|
maxlength: [11, "Experience level must be at most 11 characters"],
|
|
66
66
|
},
|
|
67
|
-
experience: {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
67
|
+
// experience: {
|
|
68
|
+
// type: {
|
|
69
|
+
// min: {
|
|
70
|
+
// type: Number,
|
|
71
|
+
// required: function () {
|
|
72
|
+
// return this.experienceLevel === "Experienced";
|
|
73
|
+
// },
|
|
74
|
+
// min: [0, "Minimum experience must be a non-negative number"],
|
|
75
|
+
// validate: {
|
|
76
|
+
// validator: Number.isInteger,
|
|
77
|
+
// message: "Minimum experience must be an integer",
|
|
78
|
+
// },
|
|
79
|
+
// },
|
|
80
|
+
// max: {
|
|
81
|
+
// type: Number,
|
|
82
|
+
// required: function () {
|
|
83
|
+
// return this.experienceLevel === "Experienced";
|
|
84
|
+
// },
|
|
85
|
+
// min: [0, "Maximum experience must be a non-negative number"],
|
|
86
|
+
// validate: {
|
|
87
|
+
// validator: Number.isInteger,
|
|
88
|
+
// message: "Maximum experience must be an integer",
|
|
89
|
+
// },
|
|
90
|
+
// },
|
|
91
|
+
// },
|
|
92
|
+
// validate: {
|
|
93
|
+
// validator: function (v) {
|
|
94
|
+
// if (
|
|
95
|
+
// this.experienceLevel === "Fresher" ||
|
|
96
|
+
// this.experienceLevel === "Any"
|
|
97
|
+
// ) {
|
|
98
|
+
// return !v || (v.min === undefined && v.max === undefined);
|
|
99
|
+
// }
|
|
100
|
+
// return v.min <= v.max;
|
|
101
|
+
// },
|
|
102
|
+
// message: function (props) {
|
|
103
|
+
// if (
|
|
104
|
+
// this.experienceLevel === "Fresher" ||
|
|
105
|
+
// this.experienceLevel === "Any"
|
|
106
|
+
// ) {
|
|
107
|
+
// return "Experience field should not be provided for 'Fresher' or 'Any' experience levels";
|
|
108
|
+
// }
|
|
109
|
+
// return "Minimum experience must be less than or equal to maximum experience";
|
|
110
|
+
// },
|
|
111
|
+
// },
|
|
112
|
+
// },
|
|
113
|
+
experience: {
|
|
114
|
+
type: {
|
|
115
|
+
min: {
|
|
116
|
+
type: Number,
|
|
117
|
+
required: function () {
|
|
118
|
+
return this.experienceLevel === "Experienced";
|
|
91
119
|
},
|
|
120
|
+
min: [0, "Minimum experience must be a non-negative number"],
|
|
92
121
|
validate: {
|
|
93
|
-
validator:
|
|
94
|
-
|
|
95
|
-
this.experienceLevel === "Fresher" ||
|
|
96
|
-
this.experienceLevel === "Any"
|
|
97
|
-
) {
|
|
98
|
-
return !v || (v.min === undefined && v.max === undefined);
|
|
99
|
-
}
|
|
100
|
-
return v.min <= v.max;
|
|
101
|
-
},
|
|
102
|
-
message: function (props) {
|
|
103
|
-
if (
|
|
104
|
-
this.experienceLevel === "Fresher" ||
|
|
105
|
-
this.experienceLevel === "Any"
|
|
106
|
-
) {
|
|
107
|
-
return "Experience field should not be provided for 'Fresher' or 'Any' experience levels";
|
|
108
|
-
}
|
|
109
|
-
return "Minimum experience must be less than or equal to maximum experience";
|
|
110
|
-
},
|
|
122
|
+
validator: Number.isInteger,
|
|
123
|
+
message: "Minimum experience must be an integer",
|
|
111
124
|
},
|
|
112
125
|
},
|
|
126
|
+
max: {
|
|
127
|
+
type: Number,
|
|
128
|
+
required: function () {
|
|
129
|
+
return this.experienceLevel === "Experienced";
|
|
130
|
+
},
|
|
131
|
+
min: [0, "Maximum experience must be a non-negative number"],
|
|
132
|
+
validate: {
|
|
133
|
+
validator: Number.isInteger,
|
|
134
|
+
message: "Maximum experience must be an integer",
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
validate: {
|
|
139
|
+
validator: function (v) {
|
|
140
|
+
if (this.experienceLevel === "Fresher") {
|
|
141
|
+
return !v || (v.min === undefined && v.max === undefined);
|
|
142
|
+
}
|
|
143
|
+
if (this.experienceLevel === "Experienced") {
|
|
144
|
+
return v && v.min <= v.max;
|
|
145
|
+
}
|
|
146
|
+
// When experienceLevel is "Any", allow any value or no value
|
|
147
|
+
return true;
|
|
148
|
+
},
|
|
149
|
+
message: function (props) {
|
|
150
|
+
if (this.experienceLevel === "Fresher") {
|
|
151
|
+
return "Experience field should not be provided for 'Fresher' experience level";
|
|
152
|
+
}
|
|
153
|
+
if (this.experienceLevel === "Experienced") {
|
|
154
|
+
return "Minimum experience must be less than or equal to maximum experience";
|
|
155
|
+
}
|
|
156
|
+
return "Invalid experience configuration";
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
},
|
|
113
160
|
},
|
|
114
161
|
{ timestamps: { createdAt: true, updatedAt: true } }
|
|
115
162
|
);
|