Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports = (app, db, sequelize) => {
- const select = {
- type: sequelize.QueryTypes.SELECT
- };
- async function getPackagesInfo() {
- return new Promise((done) => {
- app.get('/apijs/packages/:page', (req, res) => {
- const resp = db
- .query(
- `SELECT ae_pack.id, ae_pack.package_description, ae_pack.full_description, ae_pack.buyin, ae_pack.created_by, ae_pack.bid_amount, ae_pack.package_type, ae_pack.percentage_offered, ae_pack.auction_end_date, ae_pack.is_streaming, a_urs.id AS userID, a_urs.name, a_urs.username, a_urs.email, ae_prof.large_image
- FROM aen_marketplace_packages ae_pack
- LEFT JOIN aen_users a_urs ON ae_pack.created_by = a_urs.id
- LEFT JOIN aen_marketplace_profile ae_prof ON ae_pack.created_by = ae_prof.user_id
- WHERE ae_pack.approved = 1
- ORDER BY ae_pack.ts
- DESC LIMIT 10
- OFFSET ${req.params.page * 10}`,
- select,
- )
- return done({
- Resp: resp,
- Res: res
- })
- });
- });
- };
- async function foo() {
- let a = await getPackagesInfo();
- console.log(a.Resp);
- a.Res.send(a.Resp)
- }
- foo();
- };
Add Comment
Please, Sign In to add comment