@trafficgroup/knex-rel 0.0.28 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +2 -5
- package/CLAUDE.md +72 -63
- package/dist/dao/VideoMinuteResultDAO.d.ts +149 -0
- package/dist/dao/VideoMinuteResultDAO.js +604 -0
- package/dist/dao/VideoMinuteResultDAO.js.map +1 -0
- package/dist/dao/auth/auth.dao.js +4 -1
- package/dist/dao/auth/auth.dao.js.map +1 -1
- package/dist/dao/chat/chat.dao.d.ts +1 -1
- package/dist/dao/chat/chat.dao.js +25 -35
- package/dist/dao/chat/chat.dao.js.map +1 -1
- package/dist/dao/folder/folder.dao.js +7 -2
- package/dist/dao/folder/folder.dao.js.map +1 -1
- package/dist/dao/message/message.dao.d.ts +1 -1
- package/dist/dao/message/message.dao.js +18 -26
- package/dist/dao/message/message.dao.js.map +1 -1
- package/dist/dao/study/study.dao.js +7 -2
- package/dist/dao/study/study.dao.js.map +1 -1
- package/dist/dao/user/user.dao.js +4 -1
- package/dist/dao/user/user.dao.js.map +1 -1
- package/dist/dao/user-push-notification-token/user-push-notification-token.dao.js +26 -8
- package/dist/dao/user-push-notification-token/user-push-notification-token.dao.js.map +1 -1
- package/dist/dao/video/video.dao.d.ts +8 -0
- package/dist/dao/video/video.dao.js +54 -7
- package/dist/dao/video/video.dao.js.map +1 -1
- package/dist/entities/BaseEntity.d.ts +4 -0
- package/dist/entities/BaseEntity.js +3 -0
- package/dist/entities/BaseEntity.js.map +1 -0
- package/dist/entities/VideoMinuteResult.d.ts +21 -0
- package/dist/entities/VideoMinuteResult.js +3 -0
- package/dist/entities/VideoMinuteResult.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces/chat/chat.interfaces.d.ts +3 -3
- package/dist/interfaces/folder/folder.interfaces.d.ts +1 -1
- package/dist/interfaces/message/message.interfaces.d.ts +2 -2
- package/dist/interfaces/study/study.interfaces.d.ts +1 -1
- package/dist/interfaces/user/user.interfaces.d.ts +1 -1
- package/dist/interfaces/user-push-notification-token/user-push-notification-token.interfaces.d.ts +1 -1
- package/dist/interfaces/video/video.interfaces.d.ts +7 -2
- package/migrations/20250717160737_migration.ts +1 -1
- package/migrations/20250717160908_migration.ts +5 -2
- package/migrations/20250717161310_migration.ts +1 -1
- package/migrations/20250717161406_migration.ts +3 -3
- package/migrations/20250717162431_migration.ts +1 -1
- package/migrations/20250717173228_migration.ts +2 -2
- package/migrations/20250717204731_migration.ts +1 -1
- package/migrations/20250722210109_migration.ts +8 -4
- package/migrations/20250722211019_migration.ts +1 -1
- package/migrations/20250723153852_migration.ts +13 -10
- package/migrations/20250723162257_migration.ts +4 -7
- package/migrations/20250723171109_migration.ts +4 -7
- package/migrations/20250723205331_migration.ts +6 -9
- package/migrations/20250724191345_migration.ts +8 -11
- package/migrations/20250730180932_migration.ts +14 -13
- package/migrations/20250730213625_migration.ts +8 -11
- package/migrations/20250804124509_migration.ts +26 -21
- package/migrations/20250804132053_migration.ts +5 -8
- package/migrations/20250804164518_migration.ts +7 -7
- package/migrations/20250823223016_migration.ts +46 -0
- package/migrations/20250910015452_migration.ts +34 -0
- package/package.json +47 -47
- package/src/d.types.ts +22 -18
- package/src/dao/VideoMinuteResultDAO.ts +790 -0
- package/src/dao/auth/auth.dao.ts +58 -55
- package/src/dao/chat/chat.dao.ts +45 -43
- package/src/dao/folder/folder.dao.ts +75 -66
- package/src/dao/message/message.dao.ts +32 -32
- package/src/dao/study/study.dao.ts +75 -66
- package/src/dao/user/user.dao.ts +59 -57
- package/src/dao/user-push-notification-token/user-push-notification-token.dao.ts +83 -49
- package/src/dao/video/video.dao.ts +199 -120
- package/src/entities/BaseEntity.ts +4 -0
- package/src/entities/VideoMinuteResult.ts +24 -0
- package/src/index.ts +37 -23
- package/src/interfaces/auth/auth.interfaces.ts +10 -10
- package/src/interfaces/chat/chat.interfaces.ts +4 -4
- package/src/interfaces/folder/folder.interfaces.ts +13 -13
- package/src/interfaces/message/message.interfaces.ts +3 -3
- package/src/interfaces/study/study.interfaces.ts +12 -12
- package/src/interfaces/user/user.interfaces.ts +11 -11
- package/src/interfaces/user-push-notification-token/user-push-notification-token.interfaces.ts +9 -9
- package/src/interfaces/video/video.interfaces.ts +31 -21
|
@@ -1,120 +1,199 @@
|
|
|
1
|
-
import { Knex } from "knex";
|
|
2
|
-
import { IBaseDAO, IDataPaginator } from "../../d.types";
|
|
3
|
-
import { IVideo } from "../../interfaces/video/video.interfaces";
|
|
4
|
-
import KnexManager from "../../KnexConnection";
|
|
5
|
-
|
|
6
|
-
export class VideoDAO implements IBaseDAO<IVideo> {
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
1
|
+
import { Knex } from "knex";
|
|
2
|
+
import { IBaseDAO, IDataPaginator } from "../../d.types";
|
|
3
|
+
import { IVideo } from "../../interfaces/video/video.interfaces";
|
|
4
|
+
import KnexManager from "../../KnexConnection";
|
|
5
|
+
|
|
6
|
+
export class VideoDAO implements IBaseDAO<IVideo> {
|
|
7
|
+
private _knex: Knex<any, unknown[]> = KnexManager.getConnection();
|
|
8
|
+
|
|
9
|
+
static getInstance(): Knex<any, unknown[]> {
|
|
10
|
+
return KnexManager.getConnection();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async create(item: IVideo): Promise<IVideo> {
|
|
14
|
+
const [createdVideo] = await this._knex("video")
|
|
15
|
+
.insert(item)
|
|
16
|
+
.returning("*");
|
|
17
|
+
return createdVideo;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async getById(id: number): Promise<IVideo | null> {
|
|
21
|
+
const video = await this._knex("video as v")
|
|
22
|
+
.innerJoin("folders as f", "v.folderId", "f.id")
|
|
23
|
+
.select("v.*", this._knex.raw("to_jsonb(f.*) as folder"))
|
|
24
|
+
.where("v.id", id)
|
|
25
|
+
.first();
|
|
26
|
+
return video || null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async getByUuid(uuid: string): Promise<IVideo | null> {
|
|
30
|
+
const video = await this._knex("video as v")
|
|
31
|
+
.innerJoin("folders as f", "v.folderId", "f.id")
|
|
32
|
+
.select("v.*", this._knex.raw("to_jsonb(f.*) as folder"))
|
|
33
|
+
.where("v.uuid", uuid)
|
|
34
|
+
.first();
|
|
35
|
+
return video || null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async update(id: number, item: Partial<IVideo>): Promise<IVideo | null> {
|
|
39
|
+
const [updatedVideo] = await this._knex("video")
|
|
40
|
+
.where({ id })
|
|
41
|
+
.update(item)
|
|
42
|
+
.returning("*");
|
|
43
|
+
return updatedVideo || null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async delete(id: number): Promise<boolean> {
|
|
47
|
+
const result = await this._knex("video").where({ id }).del();
|
|
48
|
+
return result > 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// entityId corresponde al id del folder al que pertenece el video
|
|
52
|
+
async getAll(
|
|
53
|
+
page: number,
|
|
54
|
+
limit: number,
|
|
55
|
+
folderId?: number | null,
|
|
56
|
+
): Promise<IDataPaginator<IVideo>> {
|
|
57
|
+
const offset = (page - 1) * limit;
|
|
58
|
+
|
|
59
|
+
const query = this._knex("video as v")
|
|
60
|
+
.innerJoin("folders as f", "v.folderId", "f.id")
|
|
61
|
+
.select("v.*", this._knex.raw("to_jsonb(f.*) as folder"));
|
|
62
|
+
if (folderId !== undefined && folderId !== null) {
|
|
63
|
+
query.where("v.folderId", folderId);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const [countResult] = await query.clone().clearSelect().count("* as count");
|
|
67
|
+
const totalCount = +countResult.count;
|
|
68
|
+
const videos = await query.clone().limit(limit).offset(offset);
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
success: true,
|
|
72
|
+
data: videos,
|
|
73
|
+
page,
|
|
74
|
+
limit,
|
|
75
|
+
count: videos.length,
|
|
76
|
+
totalCount,
|
|
77
|
+
totalPages: Math.ceil(totalCount / limit),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async getVideoStatsByFolderIds(folderIds: number[]): Promise<{
|
|
82
|
+
total_videos: number;
|
|
83
|
+
completed_videos: number;
|
|
84
|
+
failed_videos: number;
|
|
85
|
+
processing_videos: number;
|
|
86
|
+
}> {
|
|
87
|
+
if (!folderIds || folderIds.length === 0) {
|
|
88
|
+
return {
|
|
89
|
+
total_videos: 0,
|
|
90
|
+
completed_videos: 0,
|
|
91
|
+
failed_videos: 0,
|
|
92
|
+
processing_videos: 0,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const result = (await this._knex("video")
|
|
97
|
+
.whereIn("folderId", folderIds)
|
|
98
|
+
.select(
|
|
99
|
+
this._knex.raw("COUNT(*) as total_videos"),
|
|
100
|
+
this._knex.raw(
|
|
101
|
+
"COUNT(CASE WHEN status = ? THEN 1 END) as completed_videos",
|
|
102
|
+
["COMPLETED"],
|
|
103
|
+
),
|
|
104
|
+
this._knex.raw(
|
|
105
|
+
"COUNT(CASE WHEN status = ? THEN 1 END) as failed_videos",
|
|
106
|
+
["FAILED"],
|
|
107
|
+
),
|
|
108
|
+
this._knex.raw(
|
|
109
|
+
"COUNT(CASE WHEN status = ? THEN 1 END) as processing_videos",
|
|
110
|
+
["PROCESSING"],
|
|
111
|
+
),
|
|
112
|
+
)
|
|
113
|
+
.first()) as any;
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
total_videos: parseInt(result?.total_videos) || 0,
|
|
117
|
+
completed_videos: parseInt(result?.completed_videos) || 0,
|
|
118
|
+
failed_videos: parseInt(result?.failed_videos) || 0,
|
|
119
|
+
processing_videos: parseInt(result?.processing_videos) || 0,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async getCompletedVideosByFolderIds(
|
|
124
|
+
folderIds: number[],
|
|
125
|
+
videoType?: string,
|
|
126
|
+
): Promise<IVideo[]> {
|
|
127
|
+
if (!folderIds || folderIds.length === 0) {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const query = this._knex("video")
|
|
132
|
+
.whereIn("folderId", folderIds)
|
|
133
|
+
.where("status", "COMPLETED");
|
|
134
|
+
|
|
135
|
+
if (videoType) {
|
|
136
|
+
query.where("videoType", videoType);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return await query.select(
|
|
140
|
+
"id",
|
|
141
|
+
"name",
|
|
142
|
+
"metadata",
|
|
143
|
+
"results",
|
|
144
|
+
"created_at",
|
|
145
|
+
this._knex.raw(
|
|
146
|
+
"EXTRACT(EPOCH FROM (updated_at - created_at)) as duration",
|
|
147
|
+
),
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Update the duration in seconds for a video
|
|
153
|
+
*/
|
|
154
|
+
async updateDuration(
|
|
155
|
+
id: number,
|
|
156
|
+
durationSeconds: number,
|
|
157
|
+
): Promise<IVideo | null> {
|
|
158
|
+
const [updatedVideo] = await this._knex("video")
|
|
159
|
+
.where({ id })
|
|
160
|
+
.update({
|
|
161
|
+
duration_seconds: durationSeconds,
|
|
162
|
+
updated_at: this._knex.fn.now(),
|
|
163
|
+
})
|
|
164
|
+
.returning("*");
|
|
165
|
+
return updatedVideo || null;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Get videos that don't have minute-by-minute data yet
|
|
170
|
+
*/
|
|
171
|
+
async getVideosWithoutMinuteData(
|
|
172
|
+
page: number,
|
|
173
|
+
limit: number,
|
|
174
|
+
): Promise<IDataPaginator<IVideo>> {
|
|
175
|
+
const offset = (page - 1) * limit;
|
|
176
|
+
|
|
177
|
+
const query = this._knex("video as v")
|
|
178
|
+
.leftJoin("video_minute_results as vmr", "v.id", "vmr.video_id")
|
|
179
|
+
.whereNull("vmr.video_id")
|
|
180
|
+
.where("v.status", "COMPLETED")
|
|
181
|
+
.innerJoin("folders as f", "v.folderId", "f.id")
|
|
182
|
+
.select("v.*", this._knex.raw("to_jsonb(f.*) as folder"))
|
|
183
|
+
.groupBy("v.id", "f.id");
|
|
184
|
+
|
|
185
|
+
const [countResult] = await query.clone().clearSelect().count("* as count");
|
|
186
|
+
const totalCount = +countResult.count;
|
|
187
|
+
const videos = await query.clone().limit(limit).offset(offset);
|
|
188
|
+
|
|
189
|
+
return {
|
|
190
|
+
success: true,
|
|
191
|
+
data: videos,
|
|
192
|
+
page,
|
|
193
|
+
limit,
|
|
194
|
+
count: videos.length,
|
|
195
|
+
totalCount,
|
|
196
|
+
totalPages: Math.ceil(totalCount / limit),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IBaseEntity } from "./BaseEntity";
|
|
2
|
+
|
|
3
|
+
export interface IVideoMinuteResult extends IBaseEntity {
|
|
4
|
+
id: number;
|
|
5
|
+
uuid: string;
|
|
6
|
+
videoId: number;
|
|
7
|
+
minuteNumber: number; // Renamed from 'minute' for clarity
|
|
8
|
+
results: Record<string, any>; // JSONB field for minute-specific results
|
|
9
|
+
createdAt: string;
|
|
10
|
+
updatedAt: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface IVideoMinuteResultInput {
|
|
14
|
+
videoId: number;
|
|
15
|
+
minuteNumber: number;
|
|
16
|
+
results: Record<string, any>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface IVideoMinuteBatch {
|
|
20
|
+
videoId: number;
|
|
21
|
+
startMinute: number;
|
|
22
|
+
endMinute: number;
|
|
23
|
+
minuteResults: IVideoMinuteResultInput[];
|
|
24
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,23 +1,37 @@
|
|
|
1
|
-
// DAOs
|
|
2
|
-
export { UserDAO } from "./dao/user/user.dao";
|
|
3
|
-
export { StudyDAO } from "./dao/study/study.dao";
|
|
4
|
-
export { FolderDAO } from "./dao/folder/folder.dao";
|
|
5
|
-
export { VideoDAO } from "./dao/video/video.dao";
|
|
6
|
-
export { AuthDAO } from "./dao/auth/auth.dao";
|
|
7
|
-
export { UserPushNotificationTokenDAO } from "./dao/user-push-notification-token/user-push-notification-token.dao";
|
|
8
|
-
export { ChatDAO } from "./dao/chat/chat.dao";
|
|
9
|
-
export { MessageDAO } from "./dao/message/message.dao";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
// DAOs
|
|
2
|
+
export { UserDAO } from "./dao/user/user.dao";
|
|
3
|
+
export { StudyDAO } from "./dao/study/study.dao";
|
|
4
|
+
export { FolderDAO } from "./dao/folder/folder.dao";
|
|
5
|
+
export { VideoDAO } from "./dao/video/video.dao";
|
|
6
|
+
export { AuthDAO } from "./dao/auth/auth.dao";
|
|
7
|
+
export { UserPushNotificationTokenDAO } from "./dao/user-push-notification-token/user-push-notification-token.dao";
|
|
8
|
+
export { ChatDAO } from "./dao/chat/chat.dao";
|
|
9
|
+
export { MessageDAO } from "./dao/message/message.dao";
|
|
10
|
+
export { VideoMinuteResultDAO } from "./dao/VideoMinuteResultDAO";
|
|
11
|
+
|
|
12
|
+
// Interfaces
|
|
13
|
+
export { IDataPaginator } from "./d.types";
|
|
14
|
+
export { IUser } from "./interfaces/user/user.interfaces";
|
|
15
|
+
export { IStudy } from "./interfaces/study/study.interfaces";
|
|
16
|
+
export { IFolder } from "./interfaces/folder/folder.interfaces";
|
|
17
|
+
export { IVideo } from "./interfaces/video/video.interfaces";
|
|
18
|
+
export { IAuth } from "./interfaces/auth/auth.interfaces";
|
|
19
|
+
export { IUserPushNotificationToken } from "./interfaces/user-push-notification-token/user-push-notification-token.interfaces";
|
|
20
|
+
export {
|
|
21
|
+
IChat,
|
|
22
|
+
IChatCreate,
|
|
23
|
+
IChatUpdate,
|
|
24
|
+
} from "./interfaces/chat/chat.interfaces";
|
|
25
|
+
export {
|
|
26
|
+
IMessage,
|
|
27
|
+
IMessageCreate,
|
|
28
|
+
IMessageUpdate,
|
|
29
|
+
} from "./interfaces/message/message.interfaces";
|
|
30
|
+
export {
|
|
31
|
+
IVideoMinuteResult,
|
|
32
|
+
IVideoMinuteResultInput,
|
|
33
|
+
IVideoMinuteBatch,
|
|
34
|
+
} from "./entities/VideoMinuteResult";
|
|
35
|
+
|
|
36
|
+
import KnexManager from "./KnexConnection";
|
|
37
|
+
export { KnexManager };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export interface IAuth {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
2
|
+
id: number;
|
|
3
|
+
userId: number;
|
|
4
|
+
password: string;
|
|
5
|
+
twofaEnabled: boolean;
|
|
6
|
+
twofaSecret: string | null;
|
|
7
|
+
emailToken: string | null;
|
|
8
|
+
emailVerified: boolean;
|
|
9
|
+
created_at: string;
|
|
10
|
+
updated_at: string;
|
|
11
|
+
}
|
|
@@ -3,7 +3,7 @@ export interface IChat {
|
|
|
3
3
|
uuid?: string;
|
|
4
4
|
userId: number;
|
|
5
5
|
title: string;
|
|
6
|
-
status?:
|
|
6
|
+
status?: "active" | "archived";
|
|
7
7
|
created_at?: Date;
|
|
8
8
|
updated_at?: Date;
|
|
9
9
|
}
|
|
@@ -11,10 +11,10 @@ export interface IChat {
|
|
|
11
11
|
export interface IChatCreate {
|
|
12
12
|
userId: number;
|
|
13
13
|
title: string;
|
|
14
|
-
status?:
|
|
14
|
+
status?: "active" | "archived";
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export interface IChatUpdate {
|
|
18
18
|
title?: string;
|
|
19
|
-
status?:
|
|
20
|
-
}
|
|
19
|
+
status?: "active" | "archived";
|
|
20
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { IStudy } from "../study/study.interfaces";
|
|
2
|
-
|
|
3
|
-
export interface IFolder {
|
|
4
|
-
id: number;
|
|
5
|
-
uuid: string;
|
|
6
|
-
name: string;
|
|
7
|
-
createdBy: number; // user.id
|
|
8
|
-
status:
|
|
9
|
-
studyId: number; // study.id
|
|
10
|
-
created_at: string;
|
|
11
|
-
updated_at: string;
|
|
12
|
-
study?: IStudy;
|
|
13
|
-
}
|
|
1
|
+
import type { IStudy } from "../study/study.interfaces";
|
|
2
|
+
|
|
3
|
+
export interface IFolder {
|
|
4
|
+
id: number;
|
|
5
|
+
uuid: string;
|
|
6
|
+
name: string;
|
|
7
|
+
createdBy: number; // user.id
|
|
8
|
+
status: "UPLOADING" | "COMPLETE";
|
|
9
|
+
studyId: number; // study.id
|
|
10
|
+
created_at: string;
|
|
11
|
+
updated_at: string;
|
|
12
|
+
study?: IStudy;
|
|
13
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface IMessage {
|
|
2
2
|
id?: number;
|
|
3
3
|
chatId: number;
|
|
4
|
-
role:
|
|
4
|
+
role: "user" | "assistant";
|
|
5
5
|
content: string;
|
|
6
6
|
created_at?: Date;
|
|
7
7
|
updated_at?: Date;
|
|
@@ -9,10 +9,10 @@ export interface IMessage {
|
|
|
9
9
|
|
|
10
10
|
export interface IMessageCreate {
|
|
11
11
|
chatId: number;
|
|
12
|
-
role:
|
|
12
|
+
role: "user" | "assistant";
|
|
13
13
|
content: string;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export interface IMessageUpdate {
|
|
17
17
|
content?: string;
|
|
18
|
-
}
|
|
18
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { IUser } from "../user/user.interfaces";
|
|
2
|
-
|
|
3
|
-
export interface IStudy {
|
|
4
|
-
id: number;
|
|
5
|
-
uuid: string;
|
|
6
|
-
name: string;
|
|
7
|
-
createdBy: number;
|
|
8
|
-
status:
|
|
9
|
-
created_at: string;
|
|
10
|
-
updated_at: string;
|
|
11
|
-
user?: IUser;
|
|
12
|
-
}
|
|
1
|
+
import type { IUser } from "../user/user.interfaces";
|
|
2
|
+
|
|
3
|
+
export interface IStudy {
|
|
4
|
+
id: number;
|
|
5
|
+
uuid: string;
|
|
6
|
+
name: string;
|
|
7
|
+
createdBy: number;
|
|
8
|
+
status: "COMPLETE" | "IN PROGRESS" | "FAILED";
|
|
9
|
+
created_at: string;
|
|
10
|
+
updated_at: string;
|
|
11
|
+
user?: IUser;
|
|
12
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export interface IUser {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
1
|
+
export interface IUser {
|
|
2
|
+
id: number;
|
|
3
|
+
uuid: string;
|
|
4
|
+
email: string;
|
|
5
|
+
nombre: string;
|
|
6
|
+
role: "ADMIN" | "USER";
|
|
7
|
+
profilePhoto?: string;
|
|
8
|
+
company?: string;
|
|
9
|
+
created_at: string;
|
|
10
|
+
updated_at: string;
|
|
11
|
+
}
|
package/src/interfaces/user-push-notification-token/user-push-notification-token.interfaces.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export interface IUserPushNotificationToken {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
2
|
+
id: number;
|
|
3
|
+
userId: number;
|
|
4
|
+
token: string;
|
|
5
|
+
available: boolean;
|
|
6
|
+
token_type: "expo" | "native";
|
|
7
|
+
device_type?: string;
|
|
8
|
+
created_at: string;
|
|
9
|
+
updated_at: string;
|
|
10
|
+
}
|
|
@@ -1,21 +1,31 @@
|
|
|
1
|
-
import type { IFolder } from "../folder/folder.interfaces";
|
|
2
|
-
|
|
3
|
-
export interface IVideo {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import type { IFolder } from "../folder/folder.interfaces";
|
|
2
|
+
|
|
3
|
+
export interface IVideo {
|
|
4
|
+
id: number;
|
|
5
|
+
uuid: string;
|
|
6
|
+
folderId: number;
|
|
7
|
+
name: string;
|
|
8
|
+
videoLocation: string;
|
|
9
|
+
videoOutputLocation: string | null;
|
|
10
|
+
generateVideoOutput: boolean;
|
|
11
|
+
videoRate: number;
|
|
12
|
+
videoType: "TMC" | "ATR" | "JUNCTION" | "ROUNDABOUT" | "PATHWAY";
|
|
13
|
+
metadata: Record<string, any>;
|
|
14
|
+
status: "QUEUED" | "PROCESSING" | "COMPLETED" | "FAILED" | "PENDING";
|
|
15
|
+
progress: number;
|
|
16
|
+
remainingTime: string;
|
|
17
|
+
results: Record<string, any>;
|
|
18
|
+
durationSeconds?: number; // Add optional duration field
|
|
19
|
+
|
|
20
|
+
// HLS streaming support
|
|
21
|
+
isHlsEnabled: boolean;
|
|
22
|
+
hlsPlaylist: string | null;
|
|
23
|
+
videoSizeMB: number | null;
|
|
24
|
+
|
|
25
|
+
// Enhanced metadata for hybrid streaming
|
|
26
|
+
streamingMetadata: Record<string, any> | null;
|
|
27
|
+
|
|
28
|
+
created_at: string;
|
|
29
|
+
updated_at: string;
|
|
30
|
+
folder?: IFolder;
|
|
31
|
+
}
|