class Search { 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 = { Search, SearchResult }