@@ -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({
|
||||||
|
|||||||
Reference in New Issue
Block a user