@trafficgroup/knex-rel 0.1.6 → 0.1.8
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/dist/dao/VideoMinuteResultDAO.d.ts +37 -0
- package/dist/dao/VideoMinuteResultDAO.js +146 -0
- package/dist/dao/VideoMinuteResultDAO.js.map +1 -1
- package/dist/dao/batch/batch.dao.d.ts +27 -0
- package/dist/dao/batch/batch.dao.js +135 -0
- package/dist/dao/batch/batch.dao.js.map +1 -0
- package/dist/dao/folder/folder.dao.js +3 -6
- package/dist/dao/folder/folder.dao.js.map +1 -1
- package/dist/dao/study/study.dao.d.ts +1 -0
- package/dist/dao/study/study.dao.js +18 -3
- package/dist/dao/study/study.dao.js.map +1 -1
- package/dist/dao/video/video.dao.d.ts +19 -5
- package/dist/dao/video/video.dao.js +61 -32
- package/dist/dao/video/video.dao.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces/batch/batch.interfaces.d.ts +13 -0
- package/dist/interfaces/batch/batch.interfaces.js +3 -0
- package/dist/interfaces/batch/batch.interfaces.js.map +1 -0
- package/dist/interfaces/folder/folder.interfaces.d.ts +0 -3
- package/dist/interfaces/study/study.interfaces.d.ts +5 -0
- package/dist/interfaces/video/video.interfaces.d.ts +8 -3
- package/migrations/20251010143500_migration.ts +83 -0
- package/migrations/20251020225758_migration.ts +135 -0
- package/package.json +1 -1
- package/plan.md +524 -711
- package/src/dao/VideoMinuteResultDAO.ts +232 -0
- package/src/dao/batch/batch.dao.ts +121 -0
- package/src/dao/folder/folder.dao.ts +3 -18
- package/src/dao/study/study.dao.ts +34 -3
- package/src/dao/video/video.dao.ts +70 -43
- package/src/index.ts +11 -1
- package/src/interfaces/batch/batch.interfaces.ts +14 -0
- package/src/interfaces/folder/folder.interfaces.ts +0 -3
- package/src/interfaces/study/study.interfaces.ts +5 -0
- package/src/interfaces/video/video.interfaces.ts +12 -4
|
@@ -225,56 +225,85 @@ class VideoDAO {
|
|
|
225
225
|
});
|
|
226
226
|
}
|
|
227
227
|
/**
|
|
228
|
-
*
|
|
229
|
-
* Supports optional transaction for service-level transaction management
|
|
228
|
+
* Get videos by batch ID
|
|
230
229
|
*/
|
|
231
|
-
|
|
230
|
+
getByBatchId(batchId) {
|
|
232
231
|
return __awaiter(this, void 0, void 0, function* () {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
.whereIn("id", videoIds)
|
|
239
|
-
.update({
|
|
240
|
-
cameraId: cameraId,
|
|
241
|
-
updated_at: query.fn.now(),
|
|
242
|
-
})
|
|
243
|
-
.returning("id");
|
|
244
|
-
return result.length;
|
|
232
|
+
return this._knex("video as v")
|
|
233
|
+
.innerJoin("folders as f", "v.folderId", "f.id")
|
|
234
|
+
.select("v.*", this._knex.raw("to_jsonb(f.*) as folder"))
|
|
235
|
+
.where("v.batchId", batchId)
|
|
236
|
+
.orderBy("v.created_at", "asc");
|
|
245
237
|
});
|
|
246
238
|
}
|
|
247
239
|
/**
|
|
248
|
-
* Get videos by
|
|
240
|
+
* Get videos sorted chronologically by recording start time for a study
|
|
249
241
|
*/
|
|
250
|
-
|
|
242
|
+
getChronologicalVideos(studyId, startDate, endDate) {
|
|
251
243
|
return __awaiter(this, void 0, void 0, function* () {
|
|
252
|
-
|
|
253
|
-
const query = this._knex("video as v")
|
|
244
|
+
let query = this._knex("video as v")
|
|
254
245
|
.innerJoin("folders as f", "v.folderId", "f.id")
|
|
255
246
|
.select("v.*", this._knex.raw("to_jsonb(f.*) as folder"))
|
|
256
|
-
.where("
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
.where("v.
|
|
260
|
-
|
|
247
|
+
.where("f.studyId", studyId)
|
|
248
|
+
.whereNotNull("v.recordingStartedAt");
|
|
249
|
+
if (startDate) {
|
|
250
|
+
query = query.where("v.recordingStartedAt", ">=", startDate);
|
|
251
|
+
}
|
|
252
|
+
if (endDate) {
|
|
253
|
+
query = query.where("v.recordingStartedAt", "<=", endDate);
|
|
254
|
+
}
|
|
255
|
+
const [countResult] = yield query.clone().clearSelect().count("* as count");
|
|
261
256
|
const totalCount = +countResult.count;
|
|
262
|
-
const videos = yield query
|
|
263
|
-
.clone()
|
|
264
|
-
.limit(limit)
|
|
265
|
-
.offset(offset)
|
|
266
|
-
.orderBy("v.created_at", "desc");
|
|
257
|
+
const videos = yield query.clone().orderBy("v.recordingStartedAt", "asc");
|
|
267
258
|
return {
|
|
268
259
|
success: true,
|
|
269
260
|
data: videos,
|
|
270
|
-
page,
|
|
271
|
-
limit,
|
|
261
|
+
page: 1,
|
|
262
|
+
limit: totalCount,
|
|
272
263
|
count: videos.length,
|
|
273
264
|
totalCount,
|
|
274
|
-
totalPages:
|
|
265
|
+
totalPages: 1,
|
|
275
266
|
};
|
|
276
267
|
});
|
|
277
268
|
}
|
|
269
|
+
/**
|
|
270
|
+
* Update recording start time for a video
|
|
271
|
+
*/
|
|
272
|
+
updateRecordingStartTime(id, recordingStartedAt) {
|
|
273
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
274
|
+
yield this._knex("video").where({ id }).update({
|
|
275
|
+
recordingStartedAt,
|
|
276
|
+
updated_at: this._knex.fn.now(),
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Update trim settings for a video
|
|
282
|
+
*/
|
|
283
|
+
updateTrimSettings(id, trimEnabled, trimPeriods) {
|
|
284
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
285
|
+
yield this._knex("video")
|
|
286
|
+
.where({ id })
|
|
287
|
+
.update({
|
|
288
|
+
trimEnabled,
|
|
289
|
+
trimPeriods: trimPeriods ? JSON.stringify(trimPeriods) : null,
|
|
290
|
+
updated_at: this._knex.fn.now(),
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Get videos with trimming enabled for a folder
|
|
296
|
+
*/
|
|
297
|
+
getVideosWithTrimming(folderId) {
|
|
298
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
299
|
+
return this._knex("video as v")
|
|
300
|
+
.innerJoin("folders as f", "v.folderId", "f.id")
|
|
301
|
+
.select("v.*", this._knex.raw("to_jsonb(f.*) as folder"))
|
|
302
|
+
.where("v.folderId", folderId)
|
|
303
|
+
.where("v.trimEnabled", true)
|
|
304
|
+
.orderBy("v.recordingStartedAt", "asc");
|
|
305
|
+
});
|
|
306
|
+
}
|
|
278
307
|
}
|
|
279
308
|
exports.VideoDAO = VideoDAO;
|
|
280
309
|
//# sourceMappingURL=video.dao.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video.dao.js","sourceRoot":"","sources":["../../../src/dao/video/video.dao.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,0EAA+C;AAE/C,MAAa,QAAQ;IAArB;QACU,UAAK,GAAyB,wBAAW,CAAC,aAAa,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"video.dao.js","sourceRoot":"","sources":["../../../src/dao/video/video.dao.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,0EAA+C;AAE/C,MAAa,QAAQ;IAArB;QACU,UAAK,GAAyB,wBAAW,CAAC,aAAa,EAAE,CAAC;IAuVpE,CAAC;IArVC,MAAM,CAAC,WAAW;QAChB,OAAO,wBAAW,CAAC,aAAa,EAAE,CAAC;IACrC,CAAC;IAEK,MAAM,CAAC,IAAY;;YACvB,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;iBAC7C,MAAM,CAAC,IAAI,CAAC;iBACZ,SAAS,CAAC,GAAG,CAAC,CAAC;YAClB,OAAO,YAAY,CAAC;QACtB,CAAC;KAAA;IAEK,OAAO,CAAC,EAAU;;YACtB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;iB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K,CAAC,EAAE,CAAC,GAAG,EAAE;aAChC,CAAC,CAAC;QACP,CAAC;KAAA;IAED;;OAEG;IACG,qBAAqB,CAAC,QAAgB;;YAC1C,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;iBAC5B,SAAS,CAAC,cAAc,EAAE,YAAY,EAAE,MAAM,CAAC;iBAC/C,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;iBACxD,KAAK,CAAC,YAAY,EAAE,QAAQ,CAAC;iBAC7B,KAAK,CAAC,eAAe,EAAE,IAAI,CAAC;iBAC5B,OAAO,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;QAC5C,CAAC;KAAA;CACF;AAxVD,4BAwVC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { AuthDAO } from "./dao/auth/auth.dao";
|
|
2
|
+
export { BatchDAO } from "./dao/batch/batch.dao";
|
|
2
3
|
export { CameraDAO } from "./dao/camera/camera.dao";
|
|
3
4
|
export { ChatDAO } from "./dao/chat/chat.dao";
|
|
4
5
|
export { FolderDAO } from "./dao/folder/folder.dao";
|
|
@@ -11,6 +12,7 @@ export { VideoDAO } from "./dao/video/video.dao";
|
|
|
11
12
|
export { VideoMinuteResultDAO } from "./dao/VideoMinuteResultDAO";
|
|
12
13
|
export { IDataPaginator } from "./d.types";
|
|
13
14
|
export { IAuth } from "./interfaces/auth/auth.interfaces";
|
|
15
|
+
export { IBatch } from "./interfaces/batch/batch.interfaces";
|
|
14
16
|
export { ICamera } from "./interfaces/camera/camera.interfaces";
|
|
15
17
|
export { IChat, IChatCreate, IChatUpdate, } from "./interfaces/chat/chat.interfaces";
|
|
16
18
|
export { IFolder } from "./interfaces/folder/folder.interfaces";
|
|
@@ -19,7 +21,8 @@ export { IReportConfiguration, IReportConfigurationData, IReportConfigurationInp
|
|
|
19
21
|
export { IStudy } from "./interfaces/study/study.interfaces";
|
|
20
22
|
export { IUser } from "./interfaces/user/user.interfaces";
|
|
21
23
|
export { IUserPushNotificationToken } from "./interfaces/user-push-notification-token/user-push-notification-token.interfaces";
|
|
22
|
-
export { IVideo } from "./interfaces/video/video.interfaces";
|
|
24
|
+
export { IVideo, ITrimPeriod } from "./interfaces/video/video.interfaces";
|
|
23
25
|
export { IVideoMinuteResult, IVideoMinuteResultInput, IVideoMinuteBatch, } from "./entities/VideoMinuteResult";
|
|
26
|
+
export type { IStudyTimeGroupResult, IGroupedStudyResponse, IGroupedResponse, IGroupedResult, ITMCResult, IATRResult, } from "./dao/VideoMinuteResultDAO";
|
|
24
27
|
import KnexManager from "./KnexConnection";
|
|
25
28
|
export { KnexManager };
|
package/dist/index.js
CHANGED
|
@@ -3,10 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.KnexManager = exports.VideoMinuteResultDAO = exports.VideoDAO = exports.UserPushNotificationTokenDAO = exports.UserDAO = exports.StudyDAO = exports.ReportConfigurationDAO = exports.MessageDAO = exports.FolderDAO = exports.ChatDAO = exports.CameraDAO = exports.AuthDAO = void 0;
|
|
6
|
+
exports.KnexManager = exports.VideoMinuteResultDAO = exports.VideoDAO = exports.UserPushNotificationTokenDAO = exports.UserDAO = exports.StudyDAO = exports.ReportConfigurationDAO = exports.MessageDAO = exports.FolderDAO = exports.ChatDAO = exports.CameraDAO = exports.BatchDAO = exports.AuthDAO = void 0;
|
|
7
7
|
// DAOs
|
|
8
8
|
var auth_dao_1 = require("./dao/auth/auth.dao");
|
|
9
9
|
Object.defineProperty(exports, "AuthDAO", { enumerable: true, get: function () { return auth_dao_1.AuthDAO; } });
|
|
10
|
+
var batch_dao_1 = require("./dao/batch/batch.dao");
|
|
11
|
+
Object.defineProperty(exports, "BatchDAO", { enumerable: true, get: function () { return batch_dao_1.BatchDAO; } });
|
|
10
12
|
var camera_dao_1 = require("./dao/camera/camera.dao");
|
|
11
13
|
Object.defineProperty(exports, "CameraDAO", { enumerable: true, get: function () { return camera_dao_1.CameraDAO; } });
|
|
12
14
|
var chat_dao_1 = require("./dao/chat/chat.dao");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO;AACP,gDAA8C;AAArC,mGAAA,OAAO,OAAA;AAChB,sDAAoD;AAA3C,uGAAA,SAAS,OAAA;AAClB,gDAA8C;AAArC,mGAAA,OAAO,OAAA;AAChB,sDAAoD;AAA3C,uGAAA,SAAS,OAAA;AAClB,yDAAuD;AAA9C,yGAAA,UAAU,OAAA;AACnB,gGAA6F;AAApF,kIAAA,sBAAsB,OAAA;AAC/B,mDAAiD;AAAxC,qGAAA,QAAQ,OAAA;AACjB,gDAA8C;AAArC,mGAAA,OAAO,OAAA;AAChB,wHAAmH;AAA1G,gJAAA,4BAA4B,OAAA;AACrC,mDAAiD;AAAxC,qGAAA,QAAQ,OAAA;AACjB,mEAAkE;AAAzD,4HAAA,oBAAoB,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO;AACP,gDAA8C;AAArC,mGAAA,OAAO,OAAA;AAChB,mDAAiD;AAAxC,qGAAA,QAAQ,OAAA;AACjB,sDAAoD;AAA3C,uGAAA,SAAS,OAAA;AAClB,gDAA8C;AAArC,mGAAA,OAAO,OAAA;AAChB,sDAAoD;AAA3C,uGAAA,SAAS,OAAA;AAClB,yDAAuD;AAA9C,yGAAA,UAAU,OAAA;AACnB,gGAA6F;AAApF,kIAAA,sBAAsB,OAAA;AAC/B,mDAAiD;AAAxC,qGAAA,QAAQ,OAAA;AACjB,gDAA8C;AAArC,mGAAA,OAAO,OAAA;AAChB,wHAAmH;AAA1G,gJAAA,4BAA4B,OAAA;AACrC,mDAAiD;AAAxC,qGAAA,QAAQ,OAAA;AACjB,mEAAkE;AAAzD,4HAAA,oBAAoB,OAAA;AA2C7B,sEAA2C;AAClC,sBADF,wBAAW,CACE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IFolder } from "../folder/folder.interfaces";
|
|
2
|
+
export interface IBatch {
|
|
3
|
+
id: number;
|
|
4
|
+
uuid: string;
|
|
5
|
+
folderId: number;
|
|
6
|
+
status: "PENDING" | "IN_PROGRESS" | "COMPLETED" | "FAILED";
|
|
7
|
+
totalVideos: number;
|
|
8
|
+
completedVideos: number;
|
|
9
|
+
failedVideos: number;
|
|
10
|
+
created_at: string;
|
|
11
|
+
updated_at: string;
|
|
12
|
+
folder?: IFolder;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch.interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/batch/batch.interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { IStudy } from "../study/study.interfaces";
|
|
2
|
-
import type { ICamera } from "../camera/camera.interfaces";
|
|
3
2
|
export interface IFolder {
|
|
4
3
|
id: number;
|
|
5
4
|
uuid: string;
|
|
@@ -7,9 +6,7 @@ export interface IFolder {
|
|
|
7
6
|
createdBy: number;
|
|
8
7
|
status: "UPLOADING" | "COMPLETE";
|
|
9
8
|
studyId: number;
|
|
10
|
-
cameraId?: number;
|
|
11
9
|
created_at: string;
|
|
12
10
|
updated_at: string;
|
|
13
11
|
study?: IStudy;
|
|
14
|
-
camera?: ICamera;
|
|
15
12
|
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { IUser } from "../user/user.interfaces";
|
|
2
|
+
import type { ICamera } from "../camera/camera.interfaces";
|
|
2
3
|
export interface IStudy {
|
|
3
4
|
id: number;
|
|
4
5
|
uuid: string;
|
|
5
6
|
name: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
type: "TMC" | "ATR";
|
|
6
9
|
createdBy: number;
|
|
10
|
+
cameraId?: number;
|
|
7
11
|
status: "COMPLETE" | "IN PROGRESS" | "FAILED";
|
|
8
12
|
created_at: string;
|
|
9
13
|
updated_at: string;
|
|
10
14
|
user?: IUser;
|
|
15
|
+
camera?: ICamera;
|
|
11
16
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { IFolder } from "../folder/folder.interfaces";
|
|
2
|
-
|
|
2
|
+
export interface ITrimPeriod {
|
|
3
|
+
startTime: string;
|
|
4
|
+
endTime: string;
|
|
5
|
+
}
|
|
3
6
|
export interface IVideo {
|
|
4
7
|
id: number;
|
|
5
8
|
uuid: string;
|
|
6
9
|
folderId: number;
|
|
7
|
-
cameraId?: number;
|
|
8
10
|
annotationSourceId?: number;
|
|
9
11
|
name: string;
|
|
10
12
|
videoLocation: string;
|
|
@@ -22,8 +24,11 @@ export interface IVideo {
|
|
|
22
24
|
hlsPlaylist: string | null;
|
|
23
25
|
videoSizeMB: number | null;
|
|
24
26
|
streamingMetadata: Record<string, any> | null;
|
|
27
|
+
recordingStartedAt?: Date;
|
|
28
|
+
trimEnabled?: boolean;
|
|
29
|
+
trimPeriods?: ITrimPeriod[] | null;
|
|
30
|
+
batchId?: number | null;
|
|
25
31
|
created_at: string;
|
|
26
32
|
updated_at: string;
|
|
27
33
|
folder?: IFolder;
|
|
28
|
-
camera?: ICamera;
|
|
29
34
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { Knex } from "knex";
|
|
2
|
+
|
|
3
|
+
export async function up(knex: Knex): Promise<void> {
|
|
4
|
+
// 1. Add cameraId to study table
|
|
5
|
+
const studyHasCamera = await knex.schema.hasColumn("study", "cameraId");
|
|
6
|
+
if (!studyHasCamera) {
|
|
7
|
+
await knex.schema.alterTable("study", (table) => {
|
|
8
|
+
table
|
|
9
|
+
.integer("cameraId")
|
|
10
|
+
.nullable()
|
|
11
|
+
.references("id")
|
|
12
|
+
.inTable("cameras")
|
|
13
|
+
.onDelete("SET NULL");
|
|
14
|
+
table.index(["cameraId"]);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// 2. Remove cameraId from video table
|
|
19
|
+
const videoHasCamera = await knex.schema.hasColumn("video", "cameraId");
|
|
20
|
+
if (videoHasCamera) {
|
|
21
|
+
await knex.raw(
|
|
22
|
+
`ALTER TABLE video DROP CONSTRAINT IF EXISTS video_cameraid_foreign`,
|
|
23
|
+
);
|
|
24
|
+
await knex.raw(`DROP INDEX IF EXISTS video_cameraid_index`);
|
|
25
|
+
await knex.schema.alterTable("video", (table) => {
|
|
26
|
+
table.dropColumn("cameraId");
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 3. Remove cameraId from folders table
|
|
31
|
+
const foldersHasCamera = await knex.schema.hasColumn("folders", "cameraId");
|
|
32
|
+
if (foldersHasCamera) {
|
|
33
|
+
await knex.raw(
|
|
34
|
+
`ALTER TABLE folders DROP CONSTRAINT IF EXISTS folders_cameraid_foreign`,
|
|
35
|
+
);
|
|
36
|
+
await knex.raw(`DROP INDEX IF EXISTS folders_cameraid_index`);
|
|
37
|
+
await knex.schema.alterTable("folders", (table) => {
|
|
38
|
+
table.dropColumn("cameraId");
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export async function down(knex: Knex): Promise<void> {
|
|
44
|
+
// 1. Restore cameraId to folders table
|
|
45
|
+
const foldersHasCamera = await knex.schema.hasColumn("folders", "cameraId");
|
|
46
|
+
if (!foldersHasCamera) {
|
|
47
|
+
await knex.schema.alterTable("folders", (table) => {
|
|
48
|
+
table
|
|
49
|
+
.integer("cameraId")
|
|
50
|
+
.nullable()
|
|
51
|
+
.references("id")
|
|
52
|
+
.inTable("cameras")
|
|
53
|
+
.onDelete("SET NULL");
|
|
54
|
+
table.index(["cameraId"]);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 2. Restore cameraId to video table
|
|
59
|
+
const videoHasCamera = await knex.schema.hasColumn("video", "cameraId");
|
|
60
|
+
if (!videoHasCamera) {
|
|
61
|
+
await knex.schema.alterTable("video", (table) => {
|
|
62
|
+
table
|
|
63
|
+
.integer("cameraId")
|
|
64
|
+
.nullable()
|
|
65
|
+
.references("id")
|
|
66
|
+
.inTable("cameras")
|
|
67
|
+
.onDelete("SET NULL");
|
|
68
|
+
table.index(["cameraId"]);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// 3. Remove cameraId from study table
|
|
73
|
+
const studyHasCamera = await knex.schema.hasColumn("study", "cameraId");
|
|
74
|
+
if (studyHasCamera) {
|
|
75
|
+
await knex.raw(
|
|
76
|
+
`ALTER TABLE study DROP CONSTRAINT IF EXISTS study_cameraid_foreign`,
|
|
77
|
+
);
|
|
78
|
+
await knex.raw(`DROP INDEX IF EXISTS study_cameraid_index`);
|
|
79
|
+
await knex.schema.alterTable("study", (table) => {
|
|
80
|
+
table.dropColumn("cameraId");
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { Knex } from "knex";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Migration: Add Recording Time, Video Trimming, and Batch Upload Features
|
|
5
|
+
*
|
|
6
|
+
* This migration implements three major features:
|
|
7
|
+
* 1. Recording Start Time - REQUIRED field for all videos (TIMESTAMPTZ in UTC)
|
|
8
|
+
* 2. Video Trimming - Optional datetime-based trimming with frame-skipping
|
|
9
|
+
* 3. Batch Upload - Up to 50 videos in all-or-nothing transaction
|
|
10
|
+
*
|
|
11
|
+
* FK Pattern: video_batch table uses id (INTEGER) for FKs, uuid (UUID) for external API
|
|
12
|
+
*/
|
|
13
|
+
export async function up(knex: Knex): Promise<void> {
|
|
14
|
+
// Step 1: Create video_batch table with proper id/uuid pattern
|
|
15
|
+
await knex.schema.createTable("video_batch", (table) => {
|
|
16
|
+
table
|
|
17
|
+
.increments("id")
|
|
18
|
+
.primary()
|
|
19
|
+
.comment("Primary key for internal foreign key relationships");
|
|
20
|
+
|
|
21
|
+
table
|
|
22
|
+
.uuid("uuid")
|
|
23
|
+
.notNullable()
|
|
24
|
+
.unique()
|
|
25
|
+
.defaultTo(knex.raw("uuid_generate_v4()"))
|
|
26
|
+
.comment("UUID for external API communication");
|
|
27
|
+
|
|
28
|
+
table
|
|
29
|
+
.integer("folderId")
|
|
30
|
+
.unsigned()
|
|
31
|
+
.notNullable()
|
|
32
|
+
.references("id")
|
|
33
|
+
.inTable("folders")
|
|
34
|
+
.onDelete("CASCADE")
|
|
35
|
+
.comment("Foreign key to folders table");
|
|
36
|
+
|
|
37
|
+
table
|
|
38
|
+
.enu("status", ["PENDING", "IN_PROGRESS", "COMPLETED", "FAILED"])
|
|
39
|
+
.notNullable()
|
|
40
|
+
.defaultTo("PENDING")
|
|
41
|
+
.comment("Status of the batch upload");
|
|
42
|
+
|
|
43
|
+
table
|
|
44
|
+
.integer("totalVideos")
|
|
45
|
+
.notNullable()
|
|
46
|
+
.defaultTo(0)
|
|
47
|
+
.comment("Total number of videos in batch");
|
|
48
|
+
|
|
49
|
+
table
|
|
50
|
+
.integer("completedVideos")
|
|
51
|
+
.notNullable()
|
|
52
|
+
.defaultTo(0)
|
|
53
|
+
.comment("Number of successfully created videos");
|
|
54
|
+
|
|
55
|
+
table
|
|
56
|
+
.integer("failedVideos")
|
|
57
|
+
.notNullable()
|
|
58
|
+
.defaultTo(0)
|
|
59
|
+
.comment("Number of failed videos");
|
|
60
|
+
|
|
61
|
+
table.timestamps(true, true);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Step 2: Add recording time, trimming, and batch columns to video table
|
|
65
|
+
await knex.schema.alterTable("video", (table) => {
|
|
66
|
+
table
|
|
67
|
+
.timestamp("recordingStartedAt", { useTz: true })
|
|
68
|
+
.nullable()
|
|
69
|
+
.comment("Recording start time in UTC - null for backward compatibility");
|
|
70
|
+
|
|
71
|
+
table
|
|
72
|
+
.boolean("trimEnabled")
|
|
73
|
+
.notNullable()
|
|
74
|
+
.defaultTo(false)
|
|
75
|
+
.comment("Whether video trimming is enabled");
|
|
76
|
+
|
|
77
|
+
table
|
|
78
|
+
.jsonb("trimPeriods")
|
|
79
|
+
.nullable()
|
|
80
|
+
.comment(
|
|
81
|
+
"Array of trim periods with startTime and endTime in ISO 8601 format",
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
table
|
|
85
|
+
.integer("batchId")
|
|
86
|
+
.unsigned()
|
|
87
|
+
.nullable()
|
|
88
|
+
.references("id")
|
|
89
|
+
.inTable("video_batch")
|
|
90
|
+
.withKeyName("fk_video_batch")
|
|
91
|
+
.onDelete("SET NULL")
|
|
92
|
+
.comment("Foreign key to video_batch table (numerical ID, NOT UUID)");
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Step 3: Create indices for performance optimization
|
|
96
|
+
|
|
97
|
+
// Index for chronological queries by folder and recording time
|
|
98
|
+
await knex.raw(`
|
|
99
|
+
CREATE INDEX idx_videos_folder_recording
|
|
100
|
+
ON video("folderId", "recordingStartedAt")
|
|
101
|
+
WHERE "recordingStartedAt" IS NOT NULL
|
|
102
|
+
`);
|
|
103
|
+
|
|
104
|
+
// Index for batch operations
|
|
105
|
+
await knex.raw(`
|
|
106
|
+
CREATE INDEX idx_videos_batch
|
|
107
|
+
ON video("batchId")
|
|
108
|
+
WHERE "batchId" IS NOT NULL
|
|
109
|
+
`);
|
|
110
|
+
|
|
111
|
+
// Index for trimming filter
|
|
112
|
+
await knex.raw(`
|
|
113
|
+
CREATE INDEX idx_videos_trimming
|
|
114
|
+
ON video("trimEnabled")
|
|
115
|
+
WHERE "trimEnabled" = true
|
|
116
|
+
`);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export async function down(knex: Knex): Promise<void> {
|
|
120
|
+
// Drop indices first
|
|
121
|
+
await knex.raw(`DROP INDEX IF EXISTS idx_videos_folder_recording`);
|
|
122
|
+
await knex.raw(`DROP INDEX IF EXISTS idx_videos_batch`);
|
|
123
|
+
await knex.raw(`DROP INDEX IF EXISTS idx_videos_trimming`);
|
|
124
|
+
|
|
125
|
+
// Drop columns from video table
|
|
126
|
+
await knex.schema.alterTable("video", (table) => {
|
|
127
|
+
table.dropColumn("recordingStartedAt");
|
|
128
|
+
table.dropColumn("trimEnabled");
|
|
129
|
+
table.dropColumn("trimPeriods");
|
|
130
|
+
table.dropColumn("batchId");
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// Drop video_batch table
|
|
134
|
+
await knex.schema.dropTableIfExists("video_batch");
|
|
135
|
+
}
|