Update
This commit is contained in:
@@ -6,23 +6,27 @@ const addTopic = async (userId, name) => {
|
||||
|
||||
const countTopics = async () => {
|
||||
const result = await sql`SELECT COUNT(id) FROM topics`;
|
||||
return result.rows[0].count;
|
||||
console.log(result);
|
||||
return result[0].count;
|
||||
};
|
||||
|
||||
const getAllTopics = async () => {
|
||||
await sql`SELECT * FROM topics ORDER BY name ASC`;
|
||||
return result.rows;
|
||||
const result = await sql`SELECT * FROM topics ORDER BY name ASC`;
|
||||
console.log(result);
|
||||
return result;
|
||||
};
|
||||
|
||||
const getTopicsByUserId = async (userId) => {
|
||||
const result =
|
||||
await sql`SELECT * FROM topics WHERE user_id = ${userId} ORDER BY name ASC`;
|
||||
return result.rows;
|
||||
console.log(result);
|
||||
return result;
|
||||
};
|
||||
|
||||
const getTopicByTopicId = async (topicId) => {
|
||||
const result = await sql`SELECT * FROM topics WHERE id = ${topicId}`;
|
||||
return result.rows[0];
|
||||
console.log(result);
|
||||
return result[0];
|
||||
};
|
||||
|
||||
const deleteTopic = async (topicId) => {
|
||||
|
||||
Reference in New Issue
Block a user