openai.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. const joi = require("joi");
  2. // .string():数据必须为字符串类
  3. // .number():数据必须为数字类型
  4. // .integer():数据必须为整数类型
  5. // .alphanum():数据只能包含[a-zA-Z0-9]的字符
  6. // .max(number|string):number:最大长度 | string:最大日期
  7. // .min(number|string):number:最小长度 | string:最小日期
  8. // .required():数据为必填项,不能为null或undefined
  9. // .pattern(正则表达式):以正则表达式的形式验证数据
  10. // .regex(正则表达式):定义字段必须匹配正则规则。
  11. // .email():验证邮箱
  12. // .joi.ref(key:string):引言同辈的键值,就是拿到value
  13. // .not(values:any[]):当前属性的值不能同参数值相同
  14. // .valid(…values:any[]):当前属性的值必须于参数值相同
  15. // .dataUri():当前字段为可以是URL地址
  16. // .allow(…values:any[]):该字段允许为指定参数的值
  17. // .default(any[]):设置该字段的默认值,值可以为string、number、boolean……等
  18. // .error(new Error(‘错误信息’)):在不符合验证条件的时候会返回错误信息
  19. const id = joi.number().integer().min(1).required()
  20. const title = joi.string().required()
  21. const createTime = joi.string().required()
  22. const updateTime = joi.string().required()
  23. const titleType = joi.string().required()
  24. const sessionId = joi.string().required()
  25. exports.addOpenaiSchema = {
  26. body: {
  27. title,
  28. createTime,
  29. titleType
  30. }
  31. };
  32. // exports.updataVaccineSchema = {
  33. // body: {
  34. // id,
  35. // vaccine,
  36. // date,
  37. // Lot,
  38. // expirationDate,
  39. // manufacturer,
  40. // site,
  41. // clinic,
  42. // provider,
  43. // price,
  44. // isFree
  45. // }
  46. // };
  47. exports.deleteVaccineSchema = {
  48. params: {
  49. id
  50. }
  51. };