All files / modules/publish publish.types.ts

0% Statements 0/0
0% Branches 1/1
0% Functions 1/1
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80                                                                                                                                                               
/**
 * 视频发布模块 - 类型定义
 */
 
/** 平台类型 */
export type PublishPlatform = 'douyin' | 'kuaishou' | 'bilibili';
 
/** 发布状态 */
export type PublishStatus = 'pending' | 'uploading' | 'success' | 'failed';
 
/** 平台账号信息 */
export interface PlatformAccount {
  id?: number;
  userId?: number;
  platform: PublishPlatform;
  cookies: string;        // 登录 Cookie
  headers: string;        // 关键请求头(User-Agent 等)
  nickname?: string;       // 账号昵称
  avatar?: string;         // 账号头像
  isValid: boolean;       // 凭证是否有效
  expireTime?: Date;       // 过期时间
  createdAt?: Date;
  updatedAt?: Date;
}
 
/** 发布任务 */
export interface PublishTask {
  id?: number;
  userId?: number;
  videoProjectId: number;
  videoUrl: string;        // 视频文件路径
  platform: PublishPlatform;
  title: string;           // 视频标题
  description?: string;    // 视频描述
  tags?: string[];         // 话题标签
  coverUrl?: string;       // 封面图
  status: PublishStatus;
  errorMsg?: string;
  publishedUrl?: string;   // 发布后获得的链接
  createdAt?: Date;
  updatedAt?: Date;
}
 
/** 创建发布任务的请求 */
export interface CreatePublishTaskRequest {
  videoProjectId: number;
  platform: PublishPlatform;
  title: string;
  description?: string;
  tags?: string[];
  coverUrl?: string;
}
 
/** 抖音上传响应 */
export interface DouyinUploadResponse {
  success: boolean;
  awemeId?: string;       // 抖音作品ID
  awemeUrl?: string;       // 作品链接
  error?: string;
}
 
/** 抖音登录信息 */
export interface DouyinLoginInfo {
  cookies: string;
  headers: Record<string, string>;
  nickname: string;
  avatar: string;
}
 
/** Prisma 模型扩展类型 */
export type PlatformAccountResponse = PlatformAccount & {
  cookies: string;
  headers: string;
  tags?: string[];
}
 
export type PublishTaskResponse = PublishTask & {
  tags?: string[];
}