expressServer/models/Search.js
LingandRX 352323262c refactor(user): 重构用户相关代码并优化登录功能
- 移除 app.js 中的冗余配置
- 更新 userController.js 中的导入和函数名称
- 修改 Search.js 中的类名
- 重构 userService.js 中的 login 和其他用户相关函数
- 优化错误处理和事务管理
2025-01-01 12:04:27 +08:00

33 lines
767 B
JavaScript

class SearchQuery {
constructor({ size, page, sort, filters }) {
this.size = size
this.page = page
this.sort = sort
this.filters = filters
}
}
class SearchResult {
constructor({ list = [], num = 0, size = 0, total = 0 } = {}) {
if (typeof list !== 'object' || list === null) {
throw new Error('Invalid list parameter')
}
if (typeof num !== 'number') {
throw new Error('Invalid num parameter')
}
if (typeof size !== 'number') {
throw new Error('Invalid size parameter')
}
if (typeof total !== 'number') {
throw new Error('Invalid total parameter')
}
this.list = list
this.num = num
this.size = size
this.total = total
}
}
module.exports = { SearchQuery, SearchResult }