UserSerializer.js 584 B

12345678910111213141516171819202122232425
  1. const makeId = require("../../util/makeId");
  2. /**
  3. * @description 用户基本信息
  4. * @typedef {Object} UserSerializerType
  5. * @property {number|string} id 用户id
  6. * @property {string} role 用户身份
  7. * @property {string} nickname 用户昵称
  8. * @property {string} [bio] 用户描述
  9. */
  10. /**
  11. * 生成基本用户信息
  12. * @param role
  13. * @returns {UserSerializerType}
  14. */
  15. module.exports = (role = "STUDENT") => {
  16. return {
  17. id: makeId(),
  18. role: role,
  19. username: "xb",
  20. nickname: "小白大王",
  21. bio: "小白白白最最最最帅帅帅帅帅帅帅帅"
  22. };
  23. };