@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.
Files changed (83) hide show
  1. package/.claude/settings.local.json +2 -5
  2. package/CLAUDE.md +72 -63
  3. package/dist/dao/VideoMinuteResultDAO.d.ts +149 -0
  4. package/dist/dao/VideoMinuteResultDAO.js +604 -0
  5. package/dist/dao/VideoMinuteResultDAO.js.map +1 -0
  6. package/dist/dao/auth/auth.dao.js +4 -1
  7. package/dist/dao/auth/auth.dao.js.map +1 -1
  8. package/dist/dao/chat/chat.dao.d.ts +1 -1
  9. package/dist/dao/chat/chat.dao.js +25 -35
  10. package/dist/dao/chat/chat.dao.js.map +1 -1
  11. package/dist/dao/folder/folder.dao.js +7 -2
  12. package/dist/dao/folder/folder.dao.js.map +1 -1
  13. package/dist/dao/message/message.dao.d.ts +1 -1
  14. package/dist/dao/message/message.dao.js +18 -26
  15. package/dist/dao/message/message.dao.js.map +1 -1
  16. package/dist/dao/study/study.dao.js +7 -2
  17. package/dist/dao/study/study.dao.js.map +1 -1
  18. package/dist/dao/user/user.dao.js +4 -1
  19. package/dist/dao/user/user.dao.js.map +1 -1
  20. package/dist/dao/user-push-notification-token/user-push-notification-token.dao.js +26 -8
  21. package/dist/dao/user-push-notification-token/user-push-notification-token.dao.js.map +1 -1
  22. package/dist/dao/video/video.dao.d.ts +8 -0
  23. package/dist/dao/video/video.dao.js +54 -7
  24. package/dist/dao/video/video.dao.js.map +1 -1
  25. package/dist/entities/BaseEntity.d.ts +4 -0
  26. package/dist/entities/BaseEntity.js +3 -0
  27. package/dist/entities/BaseEntity.js.map +1 -0
  28. package/dist/entities/VideoMinuteResult.d.ts +21 -0
  29. package/dist/entities/VideoMinuteResult.js +3 -0
  30. package/dist/entities/VideoMinuteResult.js.map +1 -0
  31. package/dist/index.d.ts +4 -2
  32. package/dist/index.js +3 -1
  33. package/dist/index.js.map +1 -1
  34. package/dist/interfaces/chat/chat.interfaces.d.ts +3 -3
  35. package/dist/interfaces/folder/folder.interfaces.d.ts +1 -1
  36. package/dist/interfaces/message/message.interfaces.d.ts +2 -2
  37. package/dist/interfaces/study/study.interfaces.d.ts +1 -1
  38. package/dist/interfaces/user/user.interfaces.d.ts +1 -1
  39. package/dist/interfaces/user-push-notification-token/user-push-notification-token.interfaces.d.ts +1 -1
  40. package/dist/interfaces/video/video.interfaces.d.ts +7 -2
  41. package/migrations/20250717160737_migration.ts +1 -1
  42. package/migrations/20250717160908_migration.ts +5 -2
  43. package/migrations/20250717161310_migration.ts +1 -1
  44. package/migrations/20250717161406_migration.ts +3 -3
  45. package/migrations/20250717162431_migration.ts +1 -1
  46. package/migrations/20250717173228_migration.ts +2 -2
  47. package/migrations/20250717204731_migration.ts +1 -1
  48. package/migrations/20250722210109_migration.ts +8 -4
  49. package/migrations/20250722211019_migration.ts +1 -1
  50. package/migrations/20250723153852_migration.ts +13 -10
  51. package/migrations/20250723162257_migration.ts +4 -7
  52. package/migrations/20250723171109_migration.ts +4 -7
  53. package/migrations/20250723205331_migration.ts +6 -9
  54. package/migrations/20250724191345_migration.ts +8 -11
  55. package/migrations/20250730180932_migration.ts +14 -13
  56. package/migrations/20250730213625_migration.ts +8 -11
  57. package/migrations/20250804124509_migration.ts +26 -21
  58. package/migrations/20250804132053_migration.ts +5 -8
  59. package/migrations/20250804164518_migration.ts +7 -7
  60. package/migrations/20250823223016_migration.ts +46 -0
  61. package/migrations/20250910015452_migration.ts +34 -0
  62. package/package.json +47 -47
  63. package/src/d.types.ts +22 -18
  64. package/src/dao/VideoMinuteResultDAO.ts +790 -0
  65. package/src/dao/auth/auth.dao.ts +58 -55
  66. package/src/dao/chat/chat.dao.ts +45 -43
  67. package/src/dao/folder/folder.dao.ts +75 -66
  68. package/src/dao/message/message.dao.ts +32 -32
  69. package/src/dao/study/study.dao.ts +75 -66
  70. package/src/dao/user/user.dao.ts +59 -57
  71. package/src/dao/user-push-notification-token/user-push-notification-token.dao.ts +83 -49
  72. package/src/dao/video/video.dao.ts +199 -120
  73. package/src/entities/BaseEntity.ts +4 -0
  74. package/src/entities/VideoMinuteResult.ts +24 -0
  75. package/src/index.ts +37 -23
  76. package/src/interfaces/auth/auth.interfaces.ts +10 -10
  77. package/src/interfaces/chat/chat.interfaces.ts +4 -4
  78. package/src/interfaces/folder/folder.interfaces.ts +13 -13
  79. package/src/interfaces/message/message.interfaces.ts +3 -3
  80. package/src/interfaces/study/study.interfaces.ts +12 -12
  81. package/src/interfaces/user/user.interfaces.ts +11 -11
  82. package/src/interfaces/user-push-notification-token/user-push-notification-token.interfaces.ts +9 -9
  83. package/src/interfaces/video/video.interfaces.ts +31 -21
@@ -0,0 +1,46 @@
1
+ import type { Knex } from "knex";
2
+
3
+ export async function up(knex: Knex): Promise<void> {
4
+ // Create video_minute_results table
5
+ await knex.schema.createTable("video_minute_results", (table) => {
6
+ table.bigIncrements("id").primary();
7
+ table
8
+ .uuid("uuid")
9
+ .defaultTo(knex.raw("gen_random_uuid()"))
10
+ .notNullable()
11
+ .unique();
12
+ table
13
+ .integer("video_id")
14
+ .unsigned()
15
+ .notNullable()
16
+ .references("id")
17
+ .inTable("video")
18
+ .onDelete("CASCADE");
19
+ table.integer("minute_number").notNullable();
20
+ table.jsonb("results").notNullable();
21
+ table.timestamps(true, true);
22
+
23
+ // Constraints
24
+ table.unique(["video_id", "minute_number"], {
25
+ indexName: "unique_video_minute",
26
+ });
27
+ table.check("minute_number >= 0", [], "valid_minute_number");
28
+
29
+ // Indexes
30
+ table.index("video_id", "idx_video_minute_results_video_id");
31
+ table.index("uuid", "idx_video_minute_results_uuid");
32
+ table.index("minute_number", "idx_video_minute_results_minute_number");
33
+ });
34
+
35
+ // Add duration_seconds to video table
36
+ await knex.schema.alterTable("video", (table) => {
37
+ table.integer("duration_seconds").nullable();
38
+ });
39
+ }
40
+
41
+ export async function down(knex: Knex): Promise<void> {
42
+ await knex.schema.dropTableIfExists("video_minute_results");
43
+ await knex.schema.alterTable("video", (table) => {
44
+ table.dropColumn("duration_seconds");
45
+ });
46
+ }
@@ -0,0 +1,34 @@
1
+ import type { Knex } from "knex";
2
+
3
+ export async function up(knex: Knex): Promise<void> {
4
+ await knex.schema.alterTable("video", (table) => {
5
+ table
6
+ .boolean("isHlsEnabled")
7
+ .defaultTo(false)
8
+ .comment("Whether HLS streaming is enabled for this video");
9
+ table
10
+ .text("hlsPlaylist")
11
+ .nullable()
12
+ .comment("S3 path to the HLS master playlist file");
13
+ table
14
+ .decimal("videoSizeMB", 12, 2)
15
+ .nullable()
16
+ .comment("Final processed video size in MB");
17
+
18
+ table
19
+ .json("streamingMetadata")
20
+ .nullable()
21
+ .comment(
22
+ "Additional streaming metadata (quality levels, segment info, etc.)",
23
+ );
24
+ });
25
+ }
26
+
27
+ export async function down(knex: Knex): Promise<void> {
28
+ await knex.schema.alterTable("video", (table) => {
29
+ table.dropColumn("isHlsEnabled");
30
+ table.dropColumn("hlsPlaylist");
31
+ table.dropColumn("videoSizeMB");
32
+ table.dropColumn("streamingMetadata");
33
+ });
34
+ }
package/package.json CHANGED
@@ -1,47 +1,47 @@
1
- {
2
- "name": "@trafficgroup/knex-rel",
3
- "version": "0.0.28",
4
- "description": "Knex Module",
5
- "main": "dist/index.js",
6
- "scripts": {
7
- "test": "jest",
8
- "format": "prettier --write .",
9
- "build": "tsc",
10
- "clean": "rimraf dist && npm run format && npm run build",
11
- "npm:publish": "npm run clean && npm publish",
12
- "migrate:create": "knex migrate:make migration -x ts",
13
- "migrate:deploy": "knex migrate:latest",
14
- "seed:create": "knex seed:make seed -x ts",
15
- "seed:run": "knex seed:run"
16
- },
17
- "repository": {
18
- "type": "git",
19
- "url": "git+https://github.com/thetrafficgroup/knex-rel.git"
20
- },
21
- "author": "Genium, Inc",
22
- "license": "ISC",
23
- "bugs": {
24
- "url": "https://github.com/thetrafficgroup/knex-rel/issues"
25
- },
26
- "homepage": "https://github.com/thetrafficgroup/knex-rel#readme",
27
- "devDependencies": {
28
- "@eslint/js": "^9.23.0",
29
- "@types/dotenv": "^6.1.1",
30
- "@types/lodash": "^4.17.20",
31
- "@types/node": "^22.13.13",
32
- "eslint": "^9.23.0",
33
- "globals": "^16.0.0",
34
- "prettier": "^3.5.3",
35
- "rimraf": "^6.0.1",
36
- "ts-node": "^10.9.2",
37
- "typescript": "^5.8.2",
38
- "typescript-eslint": "^8.28.0"
39
- },
40
- "dependencies": {
41
- "dotenv": "^16.4.7",
42
- "knex": "^3.1.0",
43
- "lodash": "^4.17.21",
44
- "pg": "^8.14.1",
45
- "uuid": "^11.1.0"
46
- }
47
- }
1
+ {
2
+ "name": "@trafficgroup/knex-rel",
3
+ "version": "0.1.0",
4
+ "description": "Knex Module",
5
+ "main": "dist/index.js",
6
+ "scripts": {
7
+ "test": "jest",
8
+ "format": "prettier --write .",
9
+ "build": "tsc",
10
+ "clean": "rimraf dist && npm run format && npm run build",
11
+ "npm:publish": "npm run clean && npm publish",
12
+ "migrate:create": "knex migrate:make migration -x ts",
13
+ "migrate:deploy": "knex migrate:latest",
14
+ "seed:create": "knex seed:make seed -x ts",
15
+ "seed:run": "knex seed:run"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/thetrafficgroup/knex-rel.git"
20
+ },
21
+ "author": "Genium, Inc",
22
+ "license": "ISC",
23
+ "bugs": {
24
+ "url": "https://github.com/thetrafficgroup/knex-rel/issues"
25
+ },
26
+ "homepage": "https://github.com/thetrafficgroup/knex-rel#readme",
27
+ "devDependencies": {
28
+ "@eslint/js": "^9.23.0",
29
+ "@types/dotenv": "^6.1.1",
30
+ "@types/lodash": "^4.17.20",
31
+ "@types/node": "^22.13.13",
32
+ "eslint": "^9.23.0",
33
+ "globals": "^16.0.0",
34
+ "prettier": "^3.5.3",
35
+ "rimraf": "^6.0.1",
36
+ "ts-node": "^10.9.2",
37
+ "typescript": "^5.8.2",
38
+ "typescript-eslint": "^8.28.0"
39
+ },
40
+ "dependencies": {
41
+ "dotenv": "^16.4.7",
42
+ "knex": "^3.1.0",
43
+ "lodash": "^4.17.21",
44
+ "pg": "^8.14.1",
45
+ "uuid": "^11.1.0"
46
+ }
47
+ }
package/src/d.types.ts CHANGED
@@ -1,18 +1,22 @@
1
- export interface IDataPaginator<T> {
2
- success: boolean;
3
- data: T[];
4
- page: number;
5
- limit: number;
6
- count: number;
7
- totalCount: number;
8
- totalPages: number;
9
- }
10
-
11
- export interface IBaseDAO<T> {
12
- create(item: T): Promise<T>;
13
- getById(id: number): Promise<T | null>;
14
- getByUuid(uuid: string): Promise<T | null>;
15
- getAll(page: number, limit: number, entityId?: any | null): Promise<IDataPaginator<T>>;
16
- update(id: number, item: T): Promise<T | null>;
17
- delete(id: number): Promise<boolean>;
18
- }
1
+ export interface IDataPaginator<T> {
2
+ success: boolean;
3
+ data: T[];
4
+ page: number;
5
+ limit: number;
6
+ count: number;
7
+ totalCount: number;
8
+ totalPages: number;
9
+ }
10
+
11
+ export interface IBaseDAO<T> {
12
+ create(item: T): Promise<T>;
13
+ getById(id: number): Promise<T | null>;
14
+ getByUuid(uuid: string): Promise<T | null>;
15
+ getAll(
16
+ page: number,
17
+ limit: number,
18
+ entityId?: any | null,
19
+ ): Promise<IDataPaginator<T>>;
20
+ update(id: number, item: T): Promise<T | null>;
21
+ delete(id: number): Promise<boolean>;
22
+ }