import { string } from 'alga-js'
import errorHandlingHelper from "../../utils/errorHandlingHelper"
import sqliteHelper from "../../utils/sqliteHelper"

export default defineEventHandler(async (event) => {
  let data: any = {}

  sqliteHelper(event, (db: any) => {
    db.all("SELECT * FROM refresh_tokens", (err: any, rows: any) => {
      if (err) {
        data = errorHandlingHelper(err, err)
      } else {
        data['records'] = rows
      }
    })
  })

  return data
})