data-validation-proximity 1.1.3 → 1.2.0

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.
Files changed (2) hide show
  1. package/index.js +42 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -208,6 +208,27 @@ const userSchema = joi.object({
208
208
  cart: joi.string().allow(null).allow(''),
209
209
  google: joi.boolean(),
210
210
  profileImage: joi.string(),
211
+ // Google Sign-In fields for mobile authentication
212
+ serverAuthCode: joi.string().when('google', {
213
+ is: true,
214
+ then: joi.required(),
215
+ otherwise: joi.forbidden()
216
+ }),
217
+ googleId: joi.string().when('google', {
218
+ is: true,
219
+ then: joi.required(),
220
+ otherwise: joi.forbidden()
221
+ }),
222
+ photoUrl: joi.string().when('google', {
223
+ is: true,
224
+ then: joi.required(),
225
+ otherwise: joi.forbidden()
226
+ }),
227
+ displayName: joi.string().when('google', {
228
+ is: true,
229
+ then: joi.required(),
230
+ otherwise: joi.forbidden()
231
+ }),
211
232
  });
212
233
 
213
234
  exports.userSchemaValidation = createValidationMiddleware(userSchema);
@@ -231,6 +252,27 @@ const userLoginSchema = joi.object({
231
252
  password: joi.string().min(6),
232
253
  google: joi.boolean(),
233
254
  name: joi.string(),
255
+ // Google Sign-In fields for mobile authentication
256
+ serverAuthCode: joi.string().when('google', {
257
+ is: true,
258
+ then: joi.required(),
259
+ otherwise: joi.forbidden()
260
+ }),
261
+ googleId: joi.string().when('google', {
262
+ is: true,
263
+ then: joi.required(),
264
+ otherwise: joi.forbidden()
265
+ }),
266
+ photoUrl: joi.string().when('google', {
267
+ is: true,
268
+ then: joi.required(),
269
+ otherwise: joi.forbidden()
270
+ }),
271
+ displayName: joi.string().when('google', {
272
+ is: true,
273
+ then: joi.required(),
274
+ otherwise: joi.forbidden()
275
+ }),
234
276
  });
235
277
 
236
278
  exports.userLoginSchemaValidation = createValidationMiddleware(userLoginSchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "data-validation-proximity",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "description": "A library of Joi-based validation middlewares for Express.js",
5
5
  "main": "index.js",
6
6
  "license": "MIT",