feat(products): vitest 도입 + 제품 접근 확장 로직 (music tier 하위 호환)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 08:24:33 +09:00
parent fe055fd0d0
commit cf89e8cbdb
5 changed files with 1179 additions and 30 deletions

17
lib/product-access.ts Normal file
View File

@@ -0,0 +1,17 @@
/**
* orders 기반 제품 접근 확장.
* 음악 팩 상위 tier는 하위 tier 파일도 포함(하위 호환) — 신규 제품은 1:1.
*/
export const MUSIC_PRODUCT_CHAIN: Record<string, string[]> = {
music_starter: ['music_starter'],
music_pro: ['music_pro', 'music_starter'],
music_master: ['music_master', 'music_pro', 'music_starter'],
};
export function expandProductAccess(paidProductIds: string[]): string[] {
const out = new Set<string>();
for (const id of paidProductIds) {
for (const expanded of MUSIC_PRODUCT_CHAIN[id] ?? [id]) out.add(expanded);
}
return Array.from(out);
}