feat: KRW 가격 지원 및 GPU/G8/VPU 인스턴스 추가

## KRW 가격 기능
- pricing 테이블에 hourly_price_krw, monthly_price_krw 컬럼 추가
- 부가세 10% + 영업이익 10% + 환율 적용 (기본 1450원)
- 시간당: 1원 단위 반올림 (최소 1원)
- 월간: 100원 단위 반올림 (최소 100원)
- 환율/부가세/영업이익률 환경변수로 분리 (배포 없이 변경 가능)

## GPU/G8/VPU 인스턴스 지원
- gpu_instances, gpu_pricing 테이블 추가
- g8_instances, g8_pricing 테이블 추가
- vpu_instances, vpu_pricing 테이블 추가
- Linode/Vultr 커넥터에 GPU 동기화 로직 추가

## 환경변수 추가
- KRW_EXCHANGE_RATE: 환율 (기본 1450)
- KRW_VAT_RATE: 부가세율 (기본 1.1)
- KRW_MARKUP_RATE: 영업이익률 (기본 1.1)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
kappa
2026-01-22 18:57:51 +09:00
parent b1cb844c05
commit a2133ae5c9
20 changed files with 3517 additions and 690 deletions

View File

@@ -88,6 +88,8 @@ export interface Pricing {
region_id: number;
hourly_price: number;
monthly_price: number;
hourly_price_krw: number | null;
monthly_price_krw: number | null;
currency: string;
available: number; // SQLite boolean (0/1)
created_at: string;
@@ -102,6 +104,97 @@ export interface PriceHistory {
recorded_at: string;
}
export interface GpuInstance {
id: number;
provider_id: number;
instance_id: string;
instance_name: string;
vcpu: number;
memory_mb: number;
storage_gb: number;
transfer_tb: number | null;
network_speed_gbps: number | null;
gpu_count: number;
gpu_type: string;
gpu_memory_gb: number | null;
metadata: string | null; // JSON string
created_at: string;
updated_at: string;
}
export interface GpuPricing {
id: number;
gpu_instance_id: number;
region_id: number;
hourly_price: number;
monthly_price: number;
hourly_price_krw: number | null;
monthly_price_krw: number | null;
currency: string;
available: number; // SQLite boolean (0/1)
created_at: string;
updated_at: string;
}
export interface G8Instance {
id: number;
provider_id: number;
instance_id: string;
instance_name: string;
vcpu: number;
memory_mb: number;
storage_gb: number;
transfer_tb: number | null;
network_speed_gbps: number | null;
metadata: string | null; // JSON string
created_at: string;
updated_at: string;
}
export interface G8Pricing {
id: number;
g8_instance_id: number;
region_id: number;
hourly_price: number;
monthly_price: number;
hourly_price_krw: number | null;
monthly_price_krw: number | null;
currency: string;
available: number; // SQLite boolean (0/1)
created_at: string;
updated_at: string;
}
export interface VpuInstance {
id: number;
provider_id: number;
instance_id: string;
instance_name: string;
vcpu: number;
memory_mb: number;
storage_gb: number;
transfer_tb: number | null;
network_speed_gbps: number | null;
vpu_type: string;
metadata: string | null; // JSON string
created_at: string;
updated_at: string;
}
export interface VpuPricing {
id: number;
vpu_instance_id: number;
region_id: number;
hourly_price: number;
monthly_price: number;
hourly_price_krw: number | null;
monthly_price_krw: number | null;
currency: string;
available: number; // SQLite boolean (0/1)
created_at: string;
updated_at: string;
}
// ============================================================
// Repository Input Types (for create/update operations)
// ============================================================
@@ -109,7 +202,13 @@ export interface PriceHistory {
export type ProviderInput = Omit<Provider, 'id' | 'created_at' | 'updated_at'>;
export type RegionInput = Omit<Region, 'id' | 'created_at' | 'updated_at'>;
export type InstanceTypeInput = Omit<InstanceType, 'id' | 'created_at' | 'updated_at'>;
export type PricingInput = Omit<Pricing, 'id' | 'created_at' | 'updated_at'>;
export type PricingInput = Omit<Pricing, 'id' | 'created_at' | 'updated_at' | 'hourly_price_krw' | 'monthly_price_krw'>;
export type GpuInstanceInput = Omit<GpuInstance, 'id' | 'created_at' | 'updated_at'>;
export type GpuPricingInput = Omit<GpuPricing, 'id' | 'created_at' | 'updated_at' | 'hourly_price_krw' | 'monthly_price_krw'>;
export type G8InstanceInput = Omit<G8Instance, 'id' | 'created_at' | 'updated_at'>;
export type G8PricingInput = Omit<G8Pricing, 'id' | 'created_at' | 'updated_at' | 'hourly_price_krw' | 'monthly_price_krw'>;
export type VpuInstanceInput = Omit<VpuInstance, 'id' | 'created_at' | 'updated_at'>;
export type VpuPricingInput = Omit<VpuPricing, 'id' | 'created_at' | 'updated_at' | 'hourly_price_krw' | 'monthly_price_krw'>;
// ============================================================
// Error Types
@@ -353,6 +452,12 @@ export interface Env {
LOG_LEVEL?: string;
/** CORS origin for Access-Control-Allow-Origin header (default: '*') */
CORS_ORIGIN?: string;
/** KRW exchange rate (USD to KRW conversion, default: 1450) */
KRW_EXCHANGE_RATE?: string;
/** KRW VAT rate multiplier (default: 1.1 for 10% VAT) */
KRW_VAT_RATE?: string;
/** KRW markup rate multiplier (default: 1.1 for 10% markup) */
KRW_MARKUP_RATE?: string;
}
// ============================================================