백엔드 서비스 설정 및 CORS 정책 업데이트
- CORS 설정에 https 프로토콜 지원 추가 - User-Service CORS를 모든 Origin 허용으로 변경 - ConfigMap CORS_ALLOWED_ORIGINS 확장 - User-Service DB migration 스크립트 추가 - Application 설정 파일 업데이트 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -31,7 +31,13 @@ spring:
|
||||
use_sql_comments: true
|
||||
dialect: ${JPA_DIALECT:org.hibernate.dialect.PostgreSQLDialect}
|
||||
hibernate:
|
||||
ddl-auto: ${DDL_AUTO:update}
|
||||
ddl-auto: ${DDL_AUTO:validate}
|
||||
|
||||
# Flyway Configuration
|
||||
flyway:
|
||||
enabled: ${FLYWAY_ENABLED:true}
|
||||
baseline-on-migrate: ${FLYWAY_BASELINE:true}
|
||||
locations: classpath:db/migration
|
||||
|
||||
# Auto-configuration exclusions for development without external services
|
||||
autoconfigure:
|
||||
@@ -76,7 +82,7 @@ jwt:
|
||||
|
||||
# CORS Configuration
|
||||
cors:
|
||||
allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:8081,http://localhost:8082,http://localhost:8083,http://localhost:8084,http://kt-event-marketing.20.214.196.128.nip.io}
|
||||
allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:8081,http://localhost:8082,http://localhost:8083,http://localhost:8084,http://kt-event-marketing.20.214.196.128.nip.io,http://kt-event-marketing-api.20.214.196.128.nip.io,http://*.kt-event-marketing-api.20.214.196.128.nip.io,http://*.20.214.196.128.nip.io}
|
||||
allowed-methods: ${CORS_ALLOWED_METHODS:GET,POST,PUT,DELETE,OPTIONS,PATCH}
|
||||
allowed-headers: ${CORS_ALLOWED_HEADERS:*}
|
||||
allow-credentials: ${CORS_ALLOW_CREDENTIALS:true}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
-- Migration script to change user_id from BIGINT to UUID
|
||||
-- WARNING: This will delete all existing data in users and stores tables
|
||||
-- Make sure to backup your data before running this script!
|
||||
|
||||
-- Step 1: Drop dependent tables/constraints
|
||||
DROP TABLE IF EXISTS stores CASCADE;
|
||||
DROP TABLE IF EXISTS users CASCADE;
|
||||
|
||||
-- Step 2: Create users table with UUID
|
||||
CREATE TABLE users (
|
||||
user_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
name VARCHAR(50) NOT NULL,
|
||||
phone_number VARCHAR(20) NOT NULL UNIQUE,
|
||||
email VARCHAR(100) NOT NULL UNIQUE,
|
||||
password_hash VARCHAR(255) NOT NULL,
|
||||
role VARCHAR(20) NOT NULL DEFAULT 'OWNER',
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'ACTIVE',
|
||||
last_login_at TIMESTAMP,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Step 3: Create indexes on users table
|
||||
CREATE UNIQUE INDEX idx_user_phone ON users(phone_number);
|
||||
CREATE UNIQUE INDEX idx_user_email ON users(email);
|
||||
|
||||
-- Step 4: Create stores table with UUID foreign key
|
||||
CREATE TABLE stores (
|
||||
store_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
name VARCHAR(100) NOT NULL,
|
||||
industry VARCHAR(50),
|
||||
address VARCHAR(255) NOT NULL,
|
||||
business_hours VARCHAR(255),
|
||||
user_id UUID NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT fk_stores_user FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- Step 5: Create index on stores table
|
||||
CREATE INDEX idx_stores_user ON stores(user_id);
|
||||
|
||||
-- Enable UUID extension if not already enabled
|
||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
||||
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
|
||||
@@ -0,0 +1,45 @@
|
||||
-- Migration script V002: Change user_id and store_id from BIGINT to UUID
|
||||
-- WARNING: This will delete all existing data in users and stores tables
|
||||
-- Make sure to backup your data before running this script!
|
||||
|
||||
-- Step 1: Drop dependent tables/constraints
|
||||
DROP TABLE IF EXISTS stores CASCADE;
|
||||
DROP TABLE IF EXISTS users CASCADE;
|
||||
|
||||
-- Step 2: Create users table with UUID
|
||||
CREATE TABLE users (
|
||||
user_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
name VARCHAR(50) NOT NULL,
|
||||
phone_number VARCHAR(20) NOT NULL UNIQUE,
|
||||
email VARCHAR(100) NOT NULL UNIQUE,
|
||||
password_hash VARCHAR(255) NOT NULL,
|
||||
role VARCHAR(20) NOT NULL DEFAULT 'OWNER',
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'ACTIVE',
|
||||
last_login_at TIMESTAMP,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Step 3: Create indexes on users table
|
||||
CREATE UNIQUE INDEX idx_user_phone ON users(phone_number);
|
||||
CREATE UNIQUE INDEX idx_user_email ON users(email);
|
||||
|
||||
-- Step 4: Create stores table with UUID foreign key
|
||||
CREATE TABLE stores (
|
||||
store_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
name VARCHAR(100) NOT NULL,
|
||||
industry VARCHAR(50),
|
||||
address VARCHAR(255) NOT NULL,
|
||||
business_hours VARCHAR(255),
|
||||
user_id UUID NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT fk_stores_user FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- Step 5: Create index on stores table
|
||||
CREATE INDEX idx_stores_user ON stores(user_id);
|
||||
|
||||
-- Enable UUID extension if not already enabled
|
||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
||||
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
|
||||
Reference in New Issue
Block a user