import db from '../db.js';

class ApiService {
    async getChatMessages(limit, offset) {
        try {
            const messages = (await db.query("SELECT * FROM chat_messages ORDER BY ID DESC LIMIT $1 OFFSET $2", [limit, offset])).rows

            return messages
        } catch(e) {
            console.log(e)
        }
    }
}

export default new ApiService();