let express = require('express')
let router = express.Router()
const auth = require('../lib/authUserInfo')
const Errors = require('../lib/errors')
let { User, Transaction } = require('../models')

router.get('/', auth, async(req, res, next) => {
    let queryObj = {
        where: {UserId: req.userData.UserId},
    }
    let transaction = await Transaction.findAll(queryObj)
    if(!transaction) {
        res.status(200)
        res.json({success: false})
    }
    res.json(transaction)
})

module.exports = router;
