@trafficgroup/knex-rel 0.1.21 → 0.1.23-rc.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 (121) hide show
  1. package/.claude/settings.local.json +5 -2
  2. package/CLAUDE.md +2 -11
  3. package/dist/constants/folder.constants.d.ts +2 -2
  4. package/dist/constants/folder.constants.js +6 -15
  5. package/dist/constants/folder.constants.js.map +1 -1
  6. package/dist/constants/study.constants.d.ts +1 -1
  7. package/dist/constants/study.constants.js +1 -1
  8. package/dist/constants/video.constants.d.ts +2 -2
  9. package/dist/constants/video.constants.js +5 -9
  10. package/dist/constants/video.constants.js.map +1 -1
  11. package/dist/dao/VideoMinuteResultDAO.d.ts +19 -2
  12. package/dist/dao/VideoMinuteResultDAO.js +75 -29
  13. package/dist/dao/VideoMinuteResultDAO.js.map +1 -1
  14. package/dist/dao/auth/auth.dao.js +1 -4
  15. package/dist/dao/auth/auth.dao.js.map +1 -1
  16. package/dist/dao/batch/batch.dao.d.ts +0 -10
  17. package/dist/dao/batch/batch.dao.js +14 -51
  18. package/dist/dao/batch/batch.dao.js.map +1 -1
  19. package/dist/dao/camera/camera.dao.js +7 -10
  20. package/dist/dao/camera/camera.dao.js.map +1 -1
  21. package/dist/dao/chat/chat.dao.d.ts +1 -1
  22. package/dist/dao/chat/chat.dao.js +40 -27
  23. package/dist/dao/chat/chat.dao.js.map +1 -1
  24. package/dist/dao/folder/folder.dao.js +7 -18
  25. package/dist/dao/folder/folder.dao.js.map +1 -1
  26. package/dist/dao/location/location.dao.js +9 -16
  27. package/dist/dao/location/location.dao.js.map +1 -1
  28. package/dist/dao/message/message.dao.d.ts +1 -1
  29. package/dist/dao/message/message.dao.js +26 -18
  30. package/dist/dao/message/message.dao.js.map +1 -1
  31. package/dist/dao/report-configuration/report-configuration.dao.js +68 -39
  32. package/dist/dao/report-configuration/report-configuration.dao.js.map +1 -1
  33. package/dist/dao/study/study.dao.d.ts +8 -1
  34. package/dist/dao/study/study.dao.js +20 -15
  35. package/dist/dao/study/study.dao.js.map +1 -1
  36. package/dist/dao/systemConfiguration/SystemConfigurationDAO.d.ts +2 -2
  37. package/dist/dao/systemConfiguration/SystemConfigurationDAO.js +26 -26
  38. package/dist/dao/systemConfiguration/SystemConfigurationDAO.js.map +1 -1
  39. package/dist/dao/user/user.dao.js +1 -4
  40. package/dist/dao/user/user.dao.js.map +1 -1
  41. package/dist/dao/user-push-notification-token/user-push-notification-token.dao.js +8 -26
  42. package/dist/dao/user-push-notification-token/user-push-notification-token.dao.js.map +1 -1
  43. package/dist/dao/video/video.dao.js +28 -30
  44. package/dist/dao/video/video.dao.js.map +1 -1
  45. package/dist/index.d.ts +10 -9
  46. package/dist/index.js +4 -4
  47. package/dist/index.js.map +1 -1
  48. package/dist/interfaces/batch/batch.interfaces.d.ts +1 -1
  49. package/dist/interfaces/camera/camera.interfaces.d.ts +1 -1
  50. package/dist/interfaces/chat/chat.interfaces.d.ts +3 -3
  51. package/dist/interfaces/folder/folder.interfaces.d.ts +1 -1
  52. package/dist/interfaces/message/message.interfaces.d.ts +2 -2
  53. package/dist/interfaces/report-configuration/report-configuration.interfaces.d.ts +1 -0
  54. package/dist/interfaces/study/study.interfaces.d.ts +2 -8
  55. package/dist/interfaces/user/user.interfaces.d.ts +1 -1
  56. package/dist/interfaces/user-push-notification-token/user-push-notification-token.interfaces.d.ts +1 -1
  57. package/dist/interfaces/video/video.interfaces.d.ts +2 -2
  58. package/migrations/20250717160737_migration.ts +1 -1
  59. package/migrations/20250717160908_migration.ts +2 -5
  60. package/migrations/20250717161310_migration.ts +1 -1
  61. package/migrations/20250717161406_migration.ts +3 -3
  62. package/migrations/20250717162431_migration.ts +1 -1
  63. package/migrations/20250717173228_migration.ts +2 -2
  64. package/migrations/20250717204731_migration.ts +1 -1
  65. package/migrations/20250722210109_migration.ts +4 -8
  66. package/migrations/20250722211019_migration.ts +1 -1
  67. package/migrations/20250723153852_migration.ts +10 -13
  68. package/migrations/20250723162257_migration.ts +7 -4
  69. package/migrations/20250723171109_migration.ts +7 -4
  70. package/migrations/20250723205331_migration.ts +9 -6
  71. package/migrations/20250724191345_migration.ts +11 -8
  72. package/migrations/20250730180932_migration.ts +13 -14
  73. package/migrations/20250730213625_migration.ts +11 -8
  74. package/migrations/20250804124509_migration.ts +21 -26
  75. package/migrations/20250804132053_migration.ts +8 -5
  76. package/migrations/20250804164518_migration.ts +7 -7
  77. package/migrations/20250823223016_migration.ts +21 -32
  78. package/migrations/20250910015452_migration.ts +6 -18
  79. package/migrations/20250911000000_migration.ts +4 -18
  80. package/migrations/20250917144153_migration.ts +7 -14
  81. package/migrations/20250930200521_migration.ts +4 -8
  82. package/migrations/20251010143500_migration.ts +6 -27
  83. package/migrations/20251020225758_migration.ts +15 -51
  84. package/migrations/20251112120000_migration.ts +2 -10
  85. package/migrations/20251112120200_migration.ts +7 -19
  86. package/migrations/20251112120300_migration.ts +2 -7
  87. package/migrations/20260109140000_migration.ts +2 -7
  88. package/package.json +3 -3
  89. package/src/constants/folder.constants.ts +8 -17
  90. package/src/constants/study.constants.ts +1 -1
  91. package/src/constants/video.constants.ts +7 -11
  92. package/src/d.types.ts +14 -18
  93. package/src/dao/VideoMinuteResultDAO.ts +127 -83
  94. package/src/dao/auth/auth.dao.ts +55 -58
  95. package/src/dao/batch/batch.dao.ts +100 -145
  96. package/src/dao/camera/camera.dao.ts +121 -124
  97. package/src/dao/chat/chat.dao.ts +45 -45
  98. package/src/dao/folder/folder.dao.ts +90 -105
  99. package/src/dao/location/location.dao.ts +87 -109
  100. package/src/dao/message/message.dao.ts +32 -32
  101. package/src/dao/reconciliation-log/reconciliation-log.dao.ts +1 -1
  102. package/src/dao/report-configuration/report-configuration.dao.ts +381 -370
  103. package/src/dao/study/study.dao.ts +83 -94
  104. package/src/dao/systemConfiguration/SystemConfigurationDAO.ts +35 -41
  105. package/src/dao/user/user.dao.ts +50 -52
  106. package/src/dao/user-push-notification-token/user-push-notification-token.dao.ts +48 -80
  107. package/src/dao/video/video.dao.ts +345 -396
  108. package/src/entities/BaseEntity.ts +1 -1
  109. package/src/index.ts +30 -43
  110. package/src/interfaces/auth/auth.interfaces.ts +10 -10
  111. package/src/interfaces/batch/batch.interfaces.ts +1 -1
  112. package/src/interfaces/camera/camera.interfaces.ts +9 -9
  113. package/src/interfaces/chat/chat.interfaces.ts +4 -4
  114. package/src/interfaces/folder/folder.interfaces.ts +2 -2
  115. package/src/interfaces/location/location.interfaces.ts +7 -7
  116. package/src/interfaces/message/message.interfaces.ts +3 -3
  117. package/src/interfaces/report-configuration/report-configuration.interfaces.ts +17 -16
  118. package/src/interfaces/study/study.interfaces.ts +3 -10
  119. package/src/interfaces/user/user.interfaces.ts +9 -9
  120. package/src/interfaces/user-push-notification-token/user-push-notification-token.interfaces.ts +9 -9
  121. package/src/interfaces/video/video.interfaces.ts +34 -34
@@ -1,22 +1,22 @@
1
1
  import { Knex } from "knex";
2
2
  import { IBaseDAO, IDataPaginator } from "../../d.types";
3
- import {
4
- IMessage,
5
- IMessageCreate,
6
- IMessageUpdate,
7
- } from "../../interfaces/message/message.interfaces";
3
+ import { IMessage, IMessageCreate, IMessageUpdate } from '../../interfaces/message/message.interfaces';
8
4
  import KnexManager from "../../KnexConnection";
9
5
 
10
6
  export class MessageDAO implements IBaseDAO<IMessage> {
11
7
  private _knex: Knex<any, unknown[]> = KnexManager.getConnection();
12
8
 
13
9
  async create(item: IMessageCreate): Promise<IMessage> {
14
- const [result] = await this._knex("message").insert(item).returning("*");
10
+ const [result] = await this._knex('message')
11
+ .insert(item)
12
+ .returning('*');
15
13
  return result;
16
14
  }
17
15
 
18
16
  async getById(id: number): Promise<IMessage | null> {
19
- const result = await this._knex("message").where("id", id).first();
17
+ const result = await this._knex('message')
18
+ .where('id', id)
19
+ .first();
20
20
  return result || null;
21
21
  }
22
22
 
@@ -27,13 +27,13 @@ export class MessageDAO implements IBaseDAO<IMessage> {
27
27
 
28
28
  async getAll(page = 1, limit = 10): Promise<IDataPaginator<IMessage>> {
29
29
  const offset = (page - 1) * limit;
30
-
30
+
31
31
  const [results, [{ count }]] = await Promise.all([
32
- this._knex("message")
33
- .orderBy("created_at", "asc")
32
+ this._knex('message')
33
+ .orderBy('created_at', 'asc')
34
34
  .limit(limit)
35
35
  .offset(offset),
36
- this._knex("message").count("* as count"),
36
+ this._knex('message').count('* as count')
37
37
  ]);
38
38
 
39
39
  const totalCount = parseInt(count as string);
@@ -44,40 +44,40 @@ export class MessageDAO implements IBaseDAO<IMessage> {
44
44
  limit,
45
45
  count: results.length,
46
46
  totalCount,
47
- totalPages: Math.ceil(totalCount / limit),
47
+ totalPages: Math.ceil(totalCount / limit)
48
48
  };
49
49
  }
50
50
 
51
51
  async update(id: number, item: IMessageUpdate): Promise<IMessage | null> {
52
- const [result] = await this._knex("message")
53
- .where("id", id)
52
+ const [result] = await this._knex('message')
53
+ .where('id', id)
54
54
  .update({
55
55
  ...item,
56
- updated_at: new Date(),
56
+ updated_at: new Date()
57
57
  })
58
- .returning("*");
58
+ .returning('*');
59
59
  return result || null;
60
60
  }
61
61
 
62
62
  async delete(id: number): Promise<boolean> {
63
- const result = await this._knex("message").where("id", id).delete();
63
+ const result = await this._knex('message')
64
+ .where('id', id)
65
+ .delete();
64
66
  return result > 0;
65
67
  }
66
68
 
67
- async getByChatId(
68
- chatId: number,
69
- page = 1,
70
- limit = 50,
71
- ): Promise<IDataPaginator<IMessage>> {
69
+ async getByChatId(chatId: number, page = 1, limit = 50): Promise<IDataPaginator<IMessage>> {
72
70
  const offset = (page - 1) * limit;
73
-
71
+
74
72
  const [results, [{ count }]] = await Promise.all([
75
- this._knex("message")
76
- .where("chatId", chatId)
77
- .orderBy("created_at", "asc")
73
+ this._knex('message')
74
+ .where('chatId', chatId)
75
+ .orderBy('created_at', 'asc')
78
76
  .limit(limit)
79
77
  .offset(offset),
80
- this._knex("message").where("chatId", chatId).count("* as count"),
78
+ this._knex('message')
79
+ .where('chatId', chatId)
80
+ .count('* as count')
81
81
  ]);
82
82
 
83
83
  const totalCount = parseInt(count as string);
@@ -88,15 +88,15 @@ export class MessageDAO implements IBaseDAO<IMessage> {
88
88
  limit,
89
89
  count: results.length,
90
90
  totalCount,
91
- totalPages: Math.ceil(totalCount / limit),
91
+ totalPages: Math.ceil(totalCount / limit)
92
92
  };
93
93
  }
94
94
 
95
95
  async getLatestMessages(chatId: number, limit = 50): Promise<IMessage[]> {
96
- return await this._knex("message")
97
- .where("chatId", chatId)
98
- .orderBy("created_at", "desc")
96
+ return await this._knex('message')
97
+ .where('chatId', chatId)
98
+ .orderBy('created_at', 'desc')
99
99
  .limit(limit)
100
100
  .then((messages: IMessage[]) => messages.reverse());
101
101
  }
102
- }
102
+ }
@@ -6,7 +6,7 @@ export class ReconciliationLogDAO {
6
6
  private _knex: Knex<any, unknown[]> = KnexManager.getConnection();
7
7
 
8
8
  async create(
9
- item: Omit<IReconciliationLog, "id">,
9
+ item: Omit<IReconciliationLog, "id">
10
10
  ): Promise<IReconciliationLog> {
11
11
  const [created] = await this._knex("reconciliation_log")
12
12
  .insert({