128 lines
3.1 KiB
TypeScript
128 lines
3.1 KiB
TypeScript
/*
|
|
* 백엔드 API 계약 타입 (단일 출처: _workspace/01_backend_contracts.md · 04_backend_public_auth.md)
|
|
* ★ 백엔드 응답 shape과 정확히 일치해야 한다. 불일치 발견 시 _workspace/에 기록·보고.
|
|
*/
|
|
|
|
// ── 0-1 응답 봉투 ──
|
|
export interface ApiError {
|
|
code: ApiErrorCode;
|
|
message: string;
|
|
}
|
|
export interface ApiResponse<T> {
|
|
success: boolean;
|
|
data: T | null;
|
|
error: ApiError | null;
|
|
}
|
|
export interface PageResponse<T> {
|
|
items: T[];
|
|
page: number;
|
|
size: number;
|
|
total: number;
|
|
}
|
|
|
|
// ── 0-2 오류 코드 ──
|
|
export type ApiErrorCode =
|
|
| 'VALIDATION'
|
|
| 'UNAUTHORIZED'
|
|
| 'FORBIDDEN'
|
|
| 'NOT_FOUND'
|
|
| 'CONFLICT'
|
|
| 'EMAIL_TAKEN'
|
|
| 'COMPLIANCE_BLOCKED'
|
|
| 'RENDER_QUOTA_EXCEEDED'
|
|
| 'NOT_REGISTERED_COMPANY'
|
|
| 'NOT_IMPLEMENTED'
|
|
| 'ACCOUNT_LOCKED'
|
|
| 'OTP_REQUIRED'
|
|
| 'OTP_INVALID'
|
|
| 'INTERNAL';
|
|
|
|
// ── 0-5 역할 ──
|
|
export type EventRole = 'ORGANIZER' | 'EXHIBITOR' | 'CONTRACTOR' | 'HALL_MANAGER';
|
|
|
|
// ── 2. 인증·워크스페이스 (SCR-01) ──
|
|
export interface WorkspaceDto {
|
|
eventId: string;
|
|
eventName: string;
|
|
startDate: string;
|
|
endDate: string;
|
|
hallLabel: string;
|
|
myRole: EventRole;
|
|
dday: number;
|
|
}
|
|
export interface AuthUser {
|
|
userId: string;
|
|
displayName: string;
|
|
hallManager: boolean;
|
|
}
|
|
export interface LoginResponse {
|
|
accessToken: string;
|
|
expiresInSeconds: number;
|
|
user: AuthUser;
|
|
workspaces: WorkspaceDto[];
|
|
}
|
|
|
|
// ── 공개 인증 (04_backend_public_auth.md) ──
|
|
export interface RegisterRequest {
|
|
email: string;
|
|
displayName: string;
|
|
password: string;
|
|
companyName?: string;
|
|
inviteCode?: string;
|
|
}
|
|
export interface RegisterResponse {
|
|
userId: string;
|
|
email: string;
|
|
displayName: string;
|
|
joinedEvent: string | null;
|
|
}
|
|
export interface MessageResponse {
|
|
message: string;
|
|
}
|
|
|
|
// ── 6. M5 나노바나나 RenderJob (SCR-06/12) ──
|
|
export type RenderJobStatus = 'QUEUED' | 'RUNNING' | 'DONE' | 'FAILED';
|
|
export interface RenderJobDto {
|
|
jobId: string;
|
|
boothId: string;
|
|
shotPreset: string; // S1..S7
|
|
status: RenderJobStatus;
|
|
imageUrl: string | null;
|
|
schemaHash: string | null;
|
|
modelVersion: string | null;
|
|
/** AI 생성 이미지 고지 — 항상 true (제거 불가). */
|
|
watermarkRequired: boolean;
|
|
watermarkText: string;
|
|
notice?: string;
|
|
createdAt?: string;
|
|
}
|
|
|
|
// ── 헬스체크 ──
|
|
export interface HealthDto {
|
|
status: string;
|
|
service: string;
|
|
time: string;
|
|
}
|
|
|
|
// ── 내정보(SCR-M 프로필) ──
|
|
// GET /api/auth/me → KintexPrincipal(백엔드 record). 이메일·부서·전화는 현 계약 미포함(백엔드 인계 대상).
|
|
export interface MePrincipal {
|
|
userId: string;
|
|
displayName: string;
|
|
eventRoles: Record<string, EventRole>;
|
|
hallManager: boolean;
|
|
roleCode: string | null;
|
|
tenantId: string | null;
|
|
}
|
|
|
|
// GET /api/auth/otp/status → { otpEnabled, verifyMethod }.
|
|
export interface OtpStatusDto {
|
|
otpEnabled: boolean;
|
|
verifyMethod: string;
|
|
}
|
|
|
|
/** 아바타 업로드 응답(제안 계약 — 백엔드 미구현 시 degrade). */
|
|
export interface AvatarUploadResponse {
|
|
photoUrl: string;
|
|
}
|