@restnfeel/agentc-starter-kit
Version:
한국어 기업용 CMS 모듈 - Task Master AI와 함께 빠르게 웹사이트를 구현할 수 있는 재사용 가능한 컴포넌트 시스템
296 lines (266 loc) • 6.19 kB
text/typescript
// Prisma 타입 정의 (실제 Prisma 스키마에서 생성될 타입들)
export enum Role {
ADMIN = "ADMIN",
EDITOR = "EDITOR",
VIEWER = "VIEWER",
GUEST = "GUEST",
}
export interface User {
id: string;
email: string;
name: string;
password?: string;
passwordHash?: string;
role: Role;
isActive: boolean;
emailVerified: Date | null;
emailVerificationToken: string | null;
passwordResetToken: string | null;
passwordResetExpires: Date | null;
failedLoginAttempts: number;
accountLockedUntil: Date | null;
lastLogin: Date | null;
loginCount: number;
tenantId: string | null;
createdAt: Date;
updatedAt: Date;
}
export interface Tenant {
id: string;
name: string;
slug: string;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
}
// 기본 사용자 타입
export interface UserProfile extends Omit<User, "password" | "passwordHash"> {
tenant?: Tenant;
_count?: {
auditLogs: number;
sessions: number;
};
}
// 사용자 생성 요청
export interface CreateUserRequest {
email: string;
password: string;
name: string;
role?: Role;
tenantId?: string;
sendVerificationEmail?: boolean;
}
// 사용자 업데이트 요청
export interface UpdateUserRequest {
name?: string;
email?: string;
role?: Role;
isActive?: boolean;
emailVerified?: Date | null;
tenantId?: string;
}
// 사용자 목록 필터
export interface UserListFilters {
search?: string;
role?: Role;
isActive?: boolean;
emailVerified?: boolean;
tenantId?: string;
createdAfter?: Date;
createdBefore?: Date;
lastLoginAfter?: Date;
lastLoginBefore?: Date;
}
// 사용자 목록 정렬
export interface UserListSort {
field: "name" | "email" | "role" | "createdAt" | "lastLogin" | "loginCount";
direction: "asc" | "desc";
}
// 페이지네이션
export interface PaginationParams {
page: number;
limit: number;
}
// 사용자 목록 응답
export interface UserListResponse {
users: UserProfile[];
pagination: {
page: number;
limit: number;
total: number;
totalPages: number;
hasNext: boolean;
hasPrev: boolean;
};
filters: UserListFilters;
sort: UserListSort;
}
// 비밀번호 재설정 요청
export interface PasswordResetRequest {
email: string;
redirectUrl?: string;
}
// 비밀번호 재설정 확인
export interface PasswordResetConfirm {
token: string;
newPassword: string;
}
// 이메일 인증 요청
export interface EmailVerificationRequest {
email: string;
redirectUrl?: string;
}
// 이메일 인증 확인
export interface EmailVerificationConfirm {
token: string;
}
// 계정 잠금 해제 요청
export interface AccountUnlockRequest {
userId: string;
reason?: string;
}
// 사용자 프로필 업데이트 요청
export interface ProfileUpdateRequest {
name?: string;
email?: string;
currentPassword?: string;
newPassword?: string;
}
// 사용자 활동 로그
export interface UserActivity {
id: string;
action: string;
resource: string;
resourceId?: string;
details?: Record<string, string | number | boolean>;
ipAddress?: string;
userAgent?: string;
createdAt: Date;
}
// 사용자 통계
export interface UserStats {
totalUsers: number;
activeUsers: number;
verifiedUsers: number;
lockedUsers: number;
usersByRole: Record<Role, number>;
usersByTenant: Record<string, number>;
recentRegistrations: number;
recentLogins: number;
}
// 사용자 세션 정보
export interface UserSession {
id: string;
userId: string;
sessionToken: string;
expires: Date;
ipAddress?: string;
userAgent?: string;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
}
// 사용자 보안 설정
export interface UserSecuritySettings {
twoFactorEnabled: boolean;
passwordLastChanged: Date;
failedLoginAttempts: number;
accountLockedUntil?: Date;
lastPasswordReset?: Date;
securityQuestions: Array<{
question: string;
answerHash: string;
}>;
}
// 사용자 알림 설정
export interface UserNotificationSettings {
emailNotifications: boolean;
securityAlerts: boolean;
systemUpdates: boolean;
marketingEmails: boolean;
weeklyDigest: boolean;
}
// 사용자 선호 설정
export interface UserPreferences {
language: string;
timezone: string;
dateFormat: string;
theme: "light" | "dark" | "auto";
notifications: UserNotificationSettings;
}
// API 응답 타입
export interface ApiResponse<T = unknown> {
success: boolean;
data?: T;
error?: {
code: string;
message: string;
details?: Record<string, string | number | boolean>;
};
meta?: {
timestamp: string;
requestId: string;
version: string;
};
}
// 사용자 관리 이벤트
export type UserManagementEvent =
| "user.created"
| "user.updated"
| "user.deleted"
| "user.activated"
| "user.deactivated"
| "user.locked"
| "user.unlocked"
| "user.email_verified"
| "user.password_reset"
| "user.role_changed"
| "user.login"
| "user.logout"
| "user.login_failed";
// 사용자 관리 이벤트 데이터
export interface UserManagementEventData {
event: UserManagementEvent;
userId: string;
adminId?: string;
data?: Record<string, string | number | boolean>;
timestamp: Date;
ipAddress?: string;
userAgent?: string;
}
// 사용자 가져오기 옵션
export interface UserFetchOptions {
includeTenant?: boolean;
includeStats?: boolean;
includeSessions?: boolean;
includeAuditLogs?: boolean;
}
// 대량 사용자 작업
export interface BulkUserOperation {
userIds: string[];
operation: "activate" | "deactivate" | "delete" | "unlock" | "change_role";
data?: Record<string, string | number | boolean>;
}
// 대량 작업 결과
export interface BulkOperationResult {
success: number;
failed: number;
errors: Array<{
userId: string;
error: string;
}>;
}
// 사용자 가져오기/내보내기
export interface UserImportData {
email: string;
name: string;
role?: Role;
tenantId?: string;
sendWelcomeEmail?: boolean;
}
export interface UserExportOptions {
format: "csv" | "json" | "xlsx";
fields: string[];
filters?: UserListFilters;
includeDeleted?: boolean;
}