const http = require("../utils/axios"); module.exports = class BaseModel { static MODULES = { HISTORY: 'history', PENDING: 'pending', FACTORY: 'factory', TOKEN: 'token', V2_LP: 'v2-lp', V3_LP: 'v3-lp' } constructor(chainId, module) { if (!chainId || !module) throw "Must have [chainId, module]." this.chainId = chainId this.module = module } async find() { const url = `/${this.module}/findByChainId` const rst = await http.post(url, { chainId: this.chainId }) return rst.data } async findByPaginate(pageNumber=1, pageSize=200) { const url = `/${this.module}/findByChainIdAndPaginate` const rst = await http.post(url, { chainId: this.chainId, pageNumber: pageNumber, pageSize: pageSize }) return rst.data } async appendOrUpdate(data) { const url = `/${this.module}/appendOrUpdate` const rst = await http.post(url, data) return rst.data } }