feat(V2-3): Web App MVP — Next.js 15 + @d3ro/api-client
packages/api-client (@d3ro/api-client) 신규: - types.ts: 12개 테이블 Row/Insert/Update 타입 + Database 형식 - client.ts: createD3roSupabaseClient 팩토리 (placeholder fallback) - auth.ts: signInWithOAuth/signOut/getSession/onAuthStateChange - meetings.ts: 회의 + 메모 + 문서 + 전사 CRUD - history.ts: 음성 입력 이력 CRUD - usage.ts: 일일 쿼터 + 구독 조회 - 루트 barrel은 types만 re-export, 함수는 subpath import 전용 apps/web (@d3ro/web) 신규 — Next.js 15 App Router: - transpilePackages: @d3ro/core, ui, i18n, api-client - ThemeProvider (MUI + AppRouterCacheProvider) - I18nProvider (localStorage 어댑터) - AuthProvider (Supabase session Context) - 라우트 9개: - / (auth 상태 기반 리다이렉트) - /login (Google/GitHub OAuth, 미설정 경고) - /auth/callback (code -> session 교환) - /dashboard (요약 카드 + 최근 회의) - /meetings (카드 그리드 리스트) - /meetings/[id] (transcripts/memos/documents) - /record (getUserMedia + MediaRecorder + stt-proxy) - Sidebar, 인증 가드, 9바 웨이브폼, 레벨 미터 packages/ui 확장: - MetalCard가 BoxProps 상속 (sx/onClick 등 전달) - theme.ts에 typoSx(key) 헬퍼 추가 (d3roTypo -> MUI sx 변환) - d3roPalette.tag.blue 추가 (M5 정리 포함) - DS 컴포넌트 9개에 'use client' directive - MetalDial 미사용 import 제거 packages/i18n 확장: - ko.json에 7개 새 키 (nav.meetings/record/logout, login.*) 설계 결정: - Database 제네릭 현재는 기본 타입 (V2-4에서 supabase gen types로 자동화) - api-client barrel은 타입만 노출해서 컴파일 전파 차단 - DS 컴포넌트 client 경계 명시 - env 없어도 Next.js 빌드 성공 (placeholder URL/key) 검증: - web typecheck OK - desktop typecheck OK (회귀 없음) - web next build OK (9 라우트 정적/동적 생성) - desktop build OK (회귀 없음)
This commit is contained in:
parent
9742b2109a
commit
d0c33ca259
190 changed files with 6167 additions and 18 deletions
225
packages/api-client/src/meetings.ts
Normal file
225
packages/api-client/src/meetings.ts
Normal file
|
|
@ -0,0 +1,225 @@
|
|||
// packages/api-client/src/meetings.ts
|
||||
// meetings / meeting_memos / meeting_documents / transcripts 도메인 함수.
|
||||
|
||||
import type { D3roSupabaseClient } from './client'
|
||||
import type {
|
||||
Meeting,
|
||||
MeetingMemo,
|
||||
MeetingDocument,
|
||||
Transcript,
|
||||
DocumentTemplateType
|
||||
} from './types'
|
||||
|
||||
// ── meetings ─────────────────────────────────────────────────
|
||||
|
||||
export async function listMeetings(
|
||||
client: D3roSupabaseClient,
|
||||
options?: { limit?: number; teamId?: string | null }
|
||||
): Promise<Meeting[]> {
|
||||
let query = client
|
||||
.from('meetings')
|
||||
.select('*')
|
||||
.order('started_at', { ascending: false })
|
||||
|
||||
if (options?.limit) {
|
||||
query = query.limit(options.limit)
|
||||
}
|
||||
if (options?.teamId !== undefined) {
|
||||
query = options.teamId === null ? query.is('team_id', null) : query.eq('team_id', options.teamId)
|
||||
}
|
||||
|
||||
const { data, error } = await query
|
||||
if (error) throw new Error(`listMeetings failed: ${error.message}`)
|
||||
return data ?? []
|
||||
}
|
||||
|
||||
export async function getMeeting(
|
||||
client: D3roSupabaseClient,
|
||||
meetingId: string
|
||||
): Promise<Meeting | null> {
|
||||
const { data, error } = await client
|
||||
.from('meetings')
|
||||
.select('*')
|
||||
.eq('id', meetingId)
|
||||
.maybeSingle()
|
||||
|
||||
if (error) throw new Error(`getMeeting failed: ${error.message}`)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function createMeeting(
|
||||
client: D3roSupabaseClient,
|
||||
input: {
|
||||
userId: string
|
||||
title?: string | null
|
||||
teamId?: string | null
|
||||
}
|
||||
): Promise<Meeting> {
|
||||
const { data, error } = await client
|
||||
.from('meetings')
|
||||
.insert({
|
||||
user_id: input.userId,
|
||||
title: input.title ?? null,
|
||||
team_id: input.teamId ?? null,
|
||||
status: 'recording'
|
||||
})
|
||||
.select('*')
|
||||
.single()
|
||||
|
||||
if (error) throw new Error(`createMeeting failed: ${error.message}`)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function updateMeeting(
|
||||
client: D3roSupabaseClient,
|
||||
meetingId: string,
|
||||
patch: Partial<Meeting>
|
||||
): Promise<Meeting> {
|
||||
const { data, error } = await client
|
||||
.from('meetings')
|
||||
.update(patch)
|
||||
.eq('id', meetingId)
|
||||
.select('*')
|
||||
.single()
|
||||
|
||||
if (error) throw new Error(`updateMeeting failed: ${error.message}`)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function deleteMeeting(
|
||||
client: D3roSupabaseClient,
|
||||
meetingId: string
|
||||
): Promise<void> {
|
||||
const { error } = await client.from('meetings').delete().eq('id', meetingId)
|
||||
if (error) throw new Error(`deleteMeeting failed: ${error.message}`)
|
||||
}
|
||||
|
||||
// ── meeting_memos ────────────────────────────────────────────
|
||||
|
||||
export async function listMemos(
|
||||
client: D3roSupabaseClient,
|
||||
meetingId: string
|
||||
): Promise<MeetingMemo[]> {
|
||||
const { data, error } = await client
|
||||
.from('meeting_memos')
|
||||
.select('*')
|
||||
.eq('meeting_id', meetingId)
|
||||
.order('timestamp_ms', { ascending: true })
|
||||
|
||||
if (error) throw new Error(`listMemos failed: ${error.message}`)
|
||||
return data ?? []
|
||||
}
|
||||
|
||||
export async function createMemo(
|
||||
client: D3roSupabaseClient,
|
||||
input: {
|
||||
meetingId: string
|
||||
userId: string
|
||||
content: string
|
||||
timestampMs: number
|
||||
}
|
||||
): Promise<MeetingMemo> {
|
||||
const { data, error } = await client
|
||||
.from('meeting_memos')
|
||||
.insert({
|
||||
meeting_id: input.meetingId,
|
||||
user_id: input.userId,
|
||||
content: input.content,
|
||||
timestamp_ms: input.timestampMs
|
||||
})
|
||||
.select('*')
|
||||
.single()
|
||||
|
||||
if (error) throw new Error(`createMemo failed: ${error.message}`)
|
||||
return data
|
||||
}
|
||||
|
||||
// ── meeting_documents ────────────────────────────────────────
|
||||
|
||||
export async function listDocuments(
|
||||
client: D3roSupabaseClient,
|
||||
meetingId: string
|
||||
): Promise<MeetingDocument[]> {
|
||||
const { data, error } = await client
|
||||
.from('meeting_documents')
|
||||
.select('*')
|
||||
.eq('meeting_id', meetingId)
|
||||
.order('created_at', { ascending: true })
|
||||
|
||||
if (error) throw new Error(`listDocuments failed: ${error.message}`)
|
||||
return data ?? []
|
||||
}
|
||||
|
||||
export async function createDocument(
|
||||
client: D3roSupabaseClient,
|
||||
input: {
|
||||
meetingId: string
|
||||
userId: string
|
||||
templateType: DocumentTemplateType
|
||||
title: string
|
||||
content: string
|
||||
promptUsed?: string | null
|
||||
llmModel?: string | null
|
||||
}
|
||||
): Promise<MeetingDocument> {
|
||||
const { data, error } = await client
|
||||
.from('meeting_documents')
|
||||
.insert({
|
||||
meeting_id: input.meetingId,
|
||||
user_id: input.userId,
|
||||
template_type: input.templateType,
|
||||
title: input.title,
|
||||
content: input.content,
|
||||
prompt_used: input.promptUsed ?? null,
|
||||
llm_model: input.llmModel ?? null
|
||||
})
|
||||
.select('*')
|
||||
.single()
|
||||
|
||||
if (error) throw new Error(`createDocument failed: ${error.message}`)
|
||||
return data
|
||||
}
|
||||
|
||||
// ── transcripts ──────────────────────────────────────────────
|
||||
|
||||
export async function listTranscripts(
|
||||
client: D3roSupabaseClient,
|
||||
meetingId: string
|
||||
): Promise<Transcript[]> {
|
||||
const { data, error } = await client
|
||||
.from('transcripts')
|
||||
.select('*')
|
||||
.eq('meeting_id', meetingId)
|
||||
.order('segment_index', { ascending: true })
|
||||
|
||||
if (error) throw new Error(`listTranscripts failed: ${error.message}`)
|
||||
return data ?? []
|
||||
}
|
||||
|
||||
export async function appendTranscript(
|
||||
client: D3roSupabaseClient,
|
||||
input: {
|
||||
meetingId: string
|
||||
segmentIndex: number
|
||||
timestampMs: number
|
||||
text: string
|
||||
speaker?: string | null
|
||||
durationMs?: number | null
|
||||
}
|
||||
): Promise<Transcript> {
|
||||
const { data, error } = await client
|
||||
.from('transcripts')
|
||||
.insert({
|
||||
meeting_id: input.meetingId,
|
||||
segment_index: input.segmentIndex,
|
||||
timestamp_ms: input.timestampMs,
|
||||
text: input.text,
|
||||
speaker: input.speaker ?? null,
|
||||
duration_ms: input.durationMs ?? null
|
||||
})
|
||||
.select('*')
|
||||
.single()
|
||||
|
||||
if (error) throw new Error(`appendTranscript failed: ${error.message}`)
|
||||
return data
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue