expressServer/models/Search.js
LingandRX 602c0fff4b refactor(config): 优化错误消息和日志记录
- 更新错误消息格式,使用驼峰命名法
- 添加服务器错误消息
- 用 logger 替代 console.log 记录日志
- 更新 MongoDB 连接日志
- 优化用户控制器中的错误处理
- 移除 SearchQuery 类中的无效代码
- 更新 package.json 中的脚本
- 移除未使用的 StringUtil 工具类
- 优化 hashUtils 中的密码加密和比较函数
2025-01-04 23:25:29 +08:00

30 lines
660 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 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 }