mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 13:04:23 +00:00
feat: implement user authentication with GitHub OAuth, create database schema, and enhance navigation
This commit is contained in:
parent
d773473eb0
commit
98ffbec764
12 changed files with 167 additions and 7 deletions
50
createDatabase.ts
Normal file
50
createDatabase.ts
Normal file
|
@ -0,0 +1,50 @@
|
|||
import { sql } from "bun";
|
||||
|
||||
const createUsers = await sql`
|
||||
create table if not exists users (
|
||||
uuid text primary key,
|
||||
created_at timestampz default current_timestamp,
|
||||
username text not null unique,
|
||||
oauthProvider text not null,
|
||||
avatarUrl text not null,
|
||||
email text not null,
|
||||
oauthProviderGivenId text not null
|
||||
);
|
||||
`;
|
||||
|
||||
const createNewsProviders = await sql`
|
||||
create table if not exists newsProviders (
|
||||
uuid text primary key,
|
||||
title text not null,
|
||||
slug text unique,
|
||||
website text not null,
|
||||
description text not null,
|
||||
facebookUrl text,
|
||||
twitterUrl text,
|
||||
threadsUrl text,
|
||||
logoUrl text not null,
|
||||
lean text not null
|
||||
)
|
||||
`
|
||||
|
||||
const createAdminPosts = await sql`
|
||||
create table if not exists adminPosts (
|
||||
uuid text primary key,
|
||||
slug text not null unique,
|
||||
content text not null,
|
||||
created_at timestampz default current_timestamp,
|
||||
byUser text not null
|
||||
)
|
||||
`
|
||||
const adminUsers = await sql`
|
||||
create table if not exists adminUsers (
|
||||
uuid text primary key,
|
||||
username text not null unique,
|
||||
passwordHash text not null,
|
||||
created_at timestampz default current_timestamp,
|
||||
lastlogged_at timestampz default current_timestamp,
|
||||
)
|
||||
`
|
||||
|
||||
|
||||
console.log("Creation Complete");
|
Loading…
Add table
Add a link
Reference in a new issue