mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 13:04:23 +00:00
Delete old components from a month ago? & Update draggable window to be using the native svgs by lucide icons & updated the news page to activate the tab changing animation when changing tabs & added caching into the [slug].ts file in publishers/lt & added a basic endpoint for searching for sources.
This commit is contained in:
parent
231a7ce251
commit
8032c3faae
12 changed files with 124 additions and 117 deletions
44
server/api/create_database.ts
Normal file
44
server/api/create_database.ts
Normal file
|
@ -0,0 +1,44 @@
|
|||
import sql from "~/server/components/postgres";
|
||||
|
||||
const createUsers = await sql`
|
||||
create table if not exists users (
|
||||
uuid text primary key,
|
||||
created_at timestamptz default current_timestamp,
|
||||
username text not null unique,
|
||||
avatarurl text,
|
||||
firstname text,
|
||||
passwordhash text not null,
|
||||
email text
|
||||
);
|
||||
`;
|
||||
|
||||
const usersList = await sql`
|
||||
create table if not exists usertokens (
|
||||
token text not null primary key,
|
||||
created_at timestamptz default current_timestamp,
|
||||
username text not null,
|
||||
email text,
|
||||
avatarurl text,
|
||||
firstname text
|
||||
)
|
||||
`;
|
||||
|
||||
const createUserAiChatHistory = await sql`
|
||||
CREATE TABLE IF NOT EXISTS chat_history (
|
||||
id SERIAL PRIMARY KEY,
|
||||
uuid VARCHAR(255) NOT NULL,
|
||||
role VARCHAR(50) NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
)`;
|
||||
|
||||
const createSources = await sql``;
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
return {
|
||||
createUsers: createUsers,
|
||||
usersList: usersList,
|
||||
createUserAiChatHistory: createUserAiChatHistory,
|
||||
createSources: createSources,
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue