user.api 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. import "../base.api"
  2. type (
  3. // The response data of user information | 用户信息
  4. UserInfo {
  5. BaseUUIDInfo
  6. // Status | 状态
  7. Status *uint32 `json:"status,optional" validate:"omitempty,lt=20"`
  8. // Username | 用户名
  9. Username *string `json:"username,optional" validate:"omitempty,max=50"`
  10. // Nickname | 昵称
  11. Nickname *string `json:"nickname,optional" validate:"omitempty,max=40"`
  12. // Password | 密码
  13. Password *string `json:"password,optional" validate:"omitempty,min=6"`
  14. // Description | 描述
  15. Description *string `json:"description,optional" validate:"omitempty,max=100"`
  16. // HomePath | 首页
  17. HomePath *string `json:"homePath,optional" validate:"omitempty,max=70"`
  18. // RoleId | 角色ID
  19. RoleIds []uint64 `json:"roleIds,optional"`
  20. // Mobile | 手机号
  21. Mobile *string `json:"mobile,optional" validate:"omitempty,max=18"`
  22. // Email | 邮箱
  23. Email *string `json:"email,optional" validate:"omitempty,max=80"`
  24. // Avatar | 头像地址
  25. Avatar *string `json:"avatar,optional" validate:"omitempty,max=300"`
  26. // Department ID | 部门ID
  27. DepartmentId *uint64 `json:"departmentId,optional,omitempty"`
  28. // Position ID | 职位ID
  29. PositionIds []uint64 `json:"positionId,optional,omitempty"`
  30. }
  31. // User information response | 用户信息返回体
  32. UserInfoResp {
  33. BaseDataInfo
  34. // User information | User数据
  35. Data UserInfo `json:"data"`
  36. }
  37. // The response data of user's basic information | 用户基本信息返回数据
  38. UserBaseIDInfoResp {
  39. BaseDataInfo
  40. // The data of user's basic information | 用户基本信息
  41. Data UserBaseIDInfo `json:"data"`
  42. }
  43. // The data of user's basic information | 用户基本信息
  44. UserBaseIDInfo {
  45. // User's UUID | 用户的UUID
  46. UUID *string `json:"userId"`
  47. // User's name | 用户名
  48. Username *string `json:"username"`
  49. // User's nickname | 用户的昵称
  50. Nickname *string `json:"nickname"`
  51. // The user's avatar path | 用户的头像路径
  52. Avatar *string `json:"avatar"`
  53. // The home page that the user enters after logging in | 用户登陆后进入的首页
  54. HomePath *string `json:"homePath"`
  55. // The description of user | 用户的描述信息
  56. Description *string `json:"desc"`
  57. // User's Role Name | 用户的角色名称
  58. RoleName []string `json:"roleName"`
  59. // Department Name | 部门名称
  60. DepartmentName string `json:"departmentName,optional"`
  61. // Department Name | 部门备注
  62. DepartmentRemark string `json:"departmentRemark,optional"`
  63. }
  64. UserLoginReq {
  65. JsCode *string `json:"js_code,optional"`
  66. }
  67. UserLoginResp {
  68. BaseDataInfo
  69. Data UserToken `json:"data,optional"`
  70. }
  71. UserToken {
  72. Token *string `json:"token,optional"`
  73. ID *uint64 `json:"id,optional"`
  74. Avatar *string `json:"avatar,optional"`
  75. Nickname *string `json:"nickname,optional"`
  76. }
  77. )
  78. @server(
  79. group: User
  80. )
  81. service Wechat {
  82. // Get user basic information | 获取用户基本信息
  83. @handler doApiUserLogin
  84. post /api/user/login (UserLoginReq) returns (UserLoginResp)
  85. }
  86. @server(
  87. jwt: Auth
  88. group: User
  89. middleware: Authority
  90. )
  91. service Wechat {
  92. // Get user basic information | 获取用户基本信息
  93. @handler getUserInfo
  94. get /user/info returns (UserBaseIDInfoResp)
  95. }