structure ready
Deploy Node App / deploy (push) Successful in 15s

This commit is contained in:
Gitea
2026-06-15 16:08:52 +05:30
parent 0312c5aa1f
commit 0370b8e2fd
+10 -6
View File
@@ -3,8 +3,8 @@ const postgre = require('../database/postgre');
const AnsweredQuestions = async (req, res) => { const AnsweredQuestions = async (req, res) => {
try { try {
const user_id = req.user.id; const user_id = req.user.id;
const result = await postgre.query( const result = await postgre.query(
'SELECT * FROM useraskquestion WHERE user_id = $1 And status = $2 ORDER BY id DESC', 'SELECT * FROM useraskquestion WHERE user_id = $1 And status = $2 ORDER BY id DESC',
@@ -27,12 +27,16 @@ const AnsweredQuestions = async (req, res) => {
const UnansweredQuestions = async (req, res) => { const UnansweredQuestions = async (req, res) => {
try { try {
const user_id = req.user.id;
const result = await postgre.query( const result = await postgre.query(
'SELECT * FROM useraskquestion WHERE user_id = $1 And status = $2 ORDER BY id DESC', `SELECT
[user_id, '0'] uaq.*,
u.name
FROM useraskquestion uaq
LEFT JOIN users u ON u.id = uaq.user_id
WHERE uaq.status = $1
ORDER BY uaq.id DESC`,
['0']
); );
res.json({ res.json({