增加jsdoc
This commit is contained in:
@@ -1,9 +1,80 @@
|
||||
import http from '../utils/http';
|
||||
|
||||
/**
|
||||
* @typedef {object} CreateUserRequest
|
||||
* @property {string} username
|
||||
* @property {string} password
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} CreateUserResponse
|
||||
* @property {number} id
|
||||
* @property {string} username
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} LoginRequest
|
||||
* @property {string} identifier - Identifier 可以是用户名、邮箱、手机号、微信号或飞书账号
|
||||
* @property {string} password
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} LoginResponse
|
||||
* @property {number} id
|
||||
* @property {string} username
|
||||
* @property {string} token
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {('成功'|'失败')} AuditStatus
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} UserActionLogDTO
|
||||
* @property {number} id
|
||||
* @property {number} user_id
|
||||
* @property {string} username
|
||||
* @property {string} action_type
|
||||
* @property {string} description
|
||||
* @property {string} http_method
|
||||
* @property {string} http_path
|
||||
* @property {string} source_ip
|
||||
* @property {Array<number>} target_resource
|
||||
* @property {AuditStatus} status
|
||||
* @property {string} result_details
|
||||
* @property {string} time
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} PaginationDTO
|
||||
* @property {number} page
|
||||
* @property {number} pageSize
|
||||
* @property {number} total
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} ListUserActionLogResponse
|
||||
* @property {Array<UserActionLogDTO>} list
|
||||
* @property {PaginationDTO} pagination
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} UserHistoryParams
|
||||
* @property {string} [action_type]
|
||||
* @property {string} [end_time]
|
||||
* @property {string} [order_by]
|
||||
* @property {number} [page]
|
||||
* @property {number} [pageSize]
|
||||
* @property {string} [start_time]
|
||||
* @property {string} [status]
|
||||
* @property {number} [user_id]
|
||||
* @property {string} [username]
|
||||
*/
|
||||
|
||||
/**
|
||||
* 创建一个新用户
|
||||
* @param {object} userData - 用户信息,对应 dto.CreateUserRequest
|
||||
* @returns {Promise<*>}
|
||||
* @param {CreateUserRequest} userData - 用户信息
|
||||
* @returns {Promise<CreateUserResponse>}
|
||||
*/
|
||||
const createUser = (userData) => {
|
||||
return http.post('/api/v1/users', userData);
|
||||
@@ -11,8 +82,8 @@ const createUser = (userData) => {
|
||||
|
||||
/**
|
||||
* 用户登录
|
||||
* @param {object} credentials - 登录凭证,对应 dto.LoginRequest
|
||||
* @returns {Promise<*>}
|
||||
* @param {LoginRequest} credentials - 登录凭证
|
||||
* @returns {Promise<LoginResponse>}
|
||||
*/
|
||||
const login = (credentials) => {
|
||||
return http.post('/api/v1/users/login', credentials);
|
||||
@@ -21,8 +92,8 @@ const login = (credentials) => {
|
||||
/**
|
||||
* 获取指定用户的操作历史
|
||||
* @param {number} id - 用户ID
|
||||
* @param {object} params - 查询参数
|
||||
* @returns {Promise<*>}
|
||||
* @param {UserHistoryParams} params - 查询参数
|
||||
* @returns {Promise<ListUserActionLogResponse>}
|
||||
*/
|
||||
const getUserHistory = (id, params) => {
|
||||
return http.get(`/api/v1/users/${id}/history`, { params });
|
||||
|
||||
Reference in New Issue
Block a user