How to use the id function from joi

Find comprehensive JavaScript joi.id code examples handpicked from public code repositorys.

76
77
78
79
80
81
82
83
84
85
86
  return newAttachments
}


createAttachment.schema = {
  currentUser: Joi.any(),
  challengeId: Joi.id(),
  attachments: Joi.array().items(Joi.object().keys({
    name: Joi.string().required(),
    url: Joi.string().uri().required(),
    fileSize: Joi.fileSize(),
fork icon44
star icon17
watch icon25

+ 10 other calls in file

62
63
64
65
66
67
68
69
70
71
72
73
async function getPhase (phaseId) {
  return helper.getById('Phase', phaseId)
}


getPhase.schema = {
  phaseId: Joi.id()
}


/**
 * Update phase.
fork icon44
star icon17
watch icon25

+ 3 other calls in file

80
81
82
83
84
85
86
87
88
89
90


createChallengeTimelineTemplate.schema = {
  data: Joi.object().keys({
    typeId: Joi.id(),
    trackId: Joi.id(),
    timelineTemplateId: Joi.id(),
    isDefault: Joi.boolean().default(false).required()
  }).required()
}

fork icon44
star icon17
watch icon25

+ 5 other calls in file

79
80
81
82
83
84
85
86
87
88
89
90
  const ret = await helper.getById('ChallengeType', id)
  return ret
}


getChallengeType.schema = {
  id: Joi.id()
}


/**
 * Fully update challenge type.
fork icon44
star icon17
watch icon25

+ 3 other calls in file

69
70
71
72
73
74
75
76
77
78
79
80
async function getTimelineTemplate (timelineTemplateId) {
  return helper.getById('TimelineTemplate', timelineTemplateId)
}


getTimelineTemplate.schema = {
  timelineTemplateId: Joi.id()
}


/**
 * Update timeline template.
fork icon44
star icon17
watch icon25

+ 6 other calls in file

1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
    status: Joi.string().valid(_.values(constants.challengeStatuses)),
    groups: Joi.array().items(Joi.optionalId()).unique(),
    // gitRepoURLs: Joi.array().items(Joi.string().uri()),
    terms: Joi.array().items(Joi.object().keys({
      id: Joi.id(),
      roleId: Joi.id()
    }))
  }).required(),
  userToken: Joi.string().required()
}
fork icon44
star icon17
watch icon25

+ 18 other calls in file

1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
  groups: Joi.array().items(Joi.optionalId()).unique(),
  // gitRepoURLs: Joi.array().items(Joi.string().uri()),
  terms: Joi.array().items(
    Joi.object().keys({
      id: Joi.id(),
      roleId: Joi.id(),
    })
  ),
})
.required(),
fork icon44
star icon17
watch icon25

+ 59 other calls in file

506
507
508
509
510
511
512
513
514
515
516
  }
}


getGroup.schema = {
  currentUser: Joi.any(),
  groupId: Joi.id(), // defined in app-bootstrap
  criteria: Joi.object().keys({
    includeSubGroups: Joi.boolean().default(false),
    includeParentGroup: Joi.boolean().default(false),
    flattenGroupIdTree: Joi.boolean().default(false),
fork icon14
star icon0
watch icon42

+ 9 other calls in file