返回 AiToEarn
common.ts
1 import { AccountType, UserType } from '@yikart/common'
2 import { FileMetadata, MaterialSource } from '@yikart/mongodb'
3
4 export enum PubStatus {
5 UNPUBLISH = 0, // Unpublished/Draft
6 RELEASED = 1, // Published
7 FAIL = 2, // Publish failed
8 PartSuccess = 3, // Partially successful
9 }
10
11 export enum PubType {
12 VIDEO = 'video', // Video
13 ARTICLE = 'article', // Article
14 }
15
16 export interface PubRecord {
17 id: string
18 userId: string
19 accountId: string
20 commonCoverPath?: string
21 coverPath?: string
22 desc: string
23 publishTime?: Date
24 status: PubStatus
25 timingTime?: Date
26 title: string
27 type: PubType
28 videoPath?: string
29 }
30
31 export enum MaterialType {
32 VIDEO = 'video', // Video
33 ARTICLE = 'article', // Article
34 }
35
36 export enum MaterialStatus {
37 WAIT = 0,
38 SUCCESS = 1,
39 FAIL = -1,
40 }
41
42 export interface Material {
43 id: string
44 userId: string
45 groupId?: string // Group ID
46 type: MaterialType
47 coverUrl?: string
48 mediaList: MaterialMedia[]
49 title: string
50 desc: string
51 topics: string[]
52 status: MaterialStatus
53 option: Record<string, any>
54 model?: string
55 generationParams?: Record<string, any>
56 createAt: Date
57 updatedAt: Date
58 }
59
60 export interface MaterialMedia {
61 id?: string
62 url: string
63 type: MediaType
64 thumbUrl?: string
65 metadata?: FileMetadata
66 content?: string
67 }
68
69 export interface NewMaterial {
70 id?: string
71 userId: string
72 userType?: UserType
73 taskId?: string
74 groupId: string // Group ID
75 coverUrl?: string
76 mediaList: MaterialMedia[]
77 title: string
78 desc?: string
79 type: MaterialType
80 topics?: string[]
81 location?: number[]
82 option?: Record<string, any>
83 autoDeleteMedia?: boolean
84 status: MaterialStatus
85 platform?: AccountType
86 source?: MaterialSource
87 maxUseCount?: number
88 }
89
90 export interface UpMaterial {
91 title?: string
92 desc?: string
93 topics?: string[]
94 option?: Record<string, any>
95 platform?: AccountType
96 maxUseCount?: number
97 }
98
99 export interface MaterialFilter {
100 readonly userId?: string
101 readonly userType?: string
102 readonly status?: MaterialStatus
103 readonly ids?: string[]
104 readonly title?: string
105 readonly groupId?: string
106 readonly useCount?: number
107 readonly platform?: AccountType
108 }
109
110 export interface MaterialListByIdsFilter {
111 readonly ids: string[]
112 }
113
114 export interface MaterialGroup {
115 id: string
116 userId: string
117 userType?: string
118 title: string
119 desc?: string
120 createAt: Date
121 updatedAt: Date
122 }
123
124 export enum MediaType {
125 VIDEO = 'video', // Video
126 IMG = 'img', // Image
127 }
128
129 export interface Media {
130 id: string
131 userId: string
132 userType?: string
133 groupId?: string // Group ID
134 materialId?: string // Material ID
135 type: MaterialType
136 url: string
137 title?: string
138 desc?: string
139 createAt: Date
140 updatedAt: Date
141 }
142
143 export interface NewMedia {
144 userId: string
145 userType?: string
146 groupId?: string // Group ID
147 materialId?: string // Material ID
148 type: MediaType
149 url: string
150 thumbUrl?: string
151 title?: string
152 desc?: string
153 }
154
155 export interface MediaGroup {
156 _id: string
157 id: string
158 userId: string
159 title: string
160 desc?: string
161 createAt: Date
162 updatedAt: Date
163 mediaList?: { list: Media[], total: number }
164 }
165 export interface NewMaterialGroup {
166 type: MaterialType
167 userId: string
168 userType?: UserType
169 name: string
170 readonly desc?: string
171 platform?: AccountType
172 }
173
174 export interface UpdateMaterialGroup {
175 name: string
176 readonly desc?: string
177 }
178
178 lines TYPESCRIPT