mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-24 05:24:23 +00:00
Add news article archiving & Add user favs.
This commit is contained in:
parent
2527056e85
commit
25760cf0d1
4 changed files with 48 additions and 7 deletions
|
@ -1,11 +1,17 @@
|
|||
import getUserTokenMinusSQLInjection from "~/server/components/getUserToken";
|
||||
import sql from "~/server/components/postgres";
|
||||
export default defineEventHandler(async (event) => {
|
||||
const userToken = await getUserTokenMinusSQLInjection(event);
|
||||
if (userToken.error.length !== 0) {
|
||||
return {
|
||||
error: userToken.error,
|
||||
};
|
||||
}
|
||||
const getData = await sql`
|
||||
SELECT * FROM user_other_data
|
||||
WHERE username = ${userToken.user}
|
||||
`;
|
||||
return {
|
||||
items: [
|
||||
{
|
||||
name: "dfasdfa",
|
||||
article_link: "49redjvicjwsd",
|
||||
favTime: "2024-12-12",
|
||||
},
|
||||
],
|
||||
items: getData[0].starred_news,
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue