REFINE OAuth2 user handling and update database schema

This commit is contained in:
2025-06-23 23:28:29 +02:00
parent 8d7f74e189
commit c7b3f6bf70
8 changed files with 56 additions and 54 deletions

View File

@@ -13,4 +13,3 @@ spring.sql.init.data-locations=classpath:db/data.sql
spring.security.oauth2.client.registration.google.client-id=${GOOGLE_CLIENT_ID}
spring.security.oauth2.client.registration.google.client-secret=${GOOGLE_CLIENT_SECRET}
spring.security.oauth2.client.registration.google.scope=openid,profile,email
spring.security.oauth2.client.registration.google.redirect-uri=http://localhost:8080/login/oauth2/code/google

View File

@@ -1,15 +1,15 @@
INSERT INTO users (id, google_id, username, email, name)
INSERT INTO users ( google_id, username, email, name)
VALUES
(1, 'google-uid-001', 'alice', 'alice@example.com', 'Alice Example'),
(2, 'google-uid-002', 'bob', 'bob@example.com', 'Bob Example'),
(3, 'google-uid-003', 'carol', 'carol@example.com', 'Carol Example'),
(4, 'google-uid-004', 'wizard42', 'gandalf@middle.earth', 'Gandalf the Grey'),
(5, 'google-uid-005', 'catnap', 'whiskers@meowmail.com', 'Sir Whiskers McFluff'),
(6, 'google-uid-006', 'robotron', 'bender@futurama.tv', 'Bender Rodriguez'),
(7, 'google-uid-007', 'unicorn', 'sparkle@rainbow.com', 'Princess Sparklehoof'),
(8, 'google-uid-008', 'pirate', 'blackbeard@seas.com', 'Edward Teach'),
(9, 'google-uid-009', 'detective', 'holmes@bakerstreet.uk', 'Sherlock Holmes'),
(10, 'google-uid-010', 'timey', 'docbrown@delorean.net', 'Dr. Emmett Brown');
('google-uid-001', 'alice', 'alice@example.com', 'Alice Example'),
( 'google-uid-002', 'bob', 'bob@example.com', 'Bob Example'),
('google-uid-003', 'carol', 'carol@example.com', 'Carol Example'),
( 'google-uid-004', 'wizard42', 'gandalf@middle.earth', 'Gandalf the Grey'),
( 'google-uid-005', 'catnap', 'whiskers@meowmail.com', 'Sir Whiskers McFluff'),
( 'google-uid-006', 'robotron', 'bender@futurama.tv', 'Bender Rodriguez'),
('google-uid-007', 'unicorn', 'sparkle@rainbow.com', 'Princess Sparklehoof'),
( 'google-uid-008', 'pirate', 'blackbeard@seas.com', 'Edward Teach'),
( 'google-uid-009', 'detective', 'holmes@bakerstreet.uk', 'Sherlock Holmes'),
( 'google-uid-010', 'timey', 'docbrown@delorean.net', 'Dr. Emmett Brown');
INSERT INTO clips (id, user_id, title, description, width, height, fps, duration, file_size, video_path)
VALUES

View File

@@ -2,18 +2,17 @@ DROP TABLE IF EXISTS clips;
DROP TABLE IF EXISTS users;
CREATE TABLE IF NOT EXISTS users (
id BIGINT PRIMARY KEY,
id BIGSERIAL PRIMARY KEY,
google_id VARCHAR(64),
username VARCHAR(50) NOT NULL UNIQUE,
email VARCHAR(100) NOT NULL UNIQUE,
name VARCHAR(100) NOT NULL,
role INTEGER DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
);
CREATE TABLE IF NOT EXISTS clips (
id BIGINT PRIMARY KEY,
id BIGSERIAL PRIMARY KEY,
user_id BIGINT NOT NULL,
title VARCHAR(255) NOT NULL,
description TEXT,