@trafficgroup/knex-rel 0.1.2 → 0.1.4

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/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { CameraDAO } from "./dao/camera/camera.dao";
3
3
  export { ChatDAO } from "./dao/chat/chat.dao";
4
4
  export { FolderDAO } from "./dao/folder/folder.dao";
5
5
  export { MessageDAO } from "./dao/message/message.dao";
6
+ export { ReportConfigurationDAO } from "./dao/report-configuration/report-configuration.dao";
6
7
  export { StudyDAO } from "./dao/study/study.dao";
7
8
  export { UserDAO } from "./dao/user/user.dao";
8
9
  export { UserPushNotificationTokenDAO } from "./dao/user-push-notification-token/user-push-notification-token.dao";
@@ -14,6 +15,7 @@ export { ICamera } from "./interfaces/camera/camera.interfaces";
14
15
  export { IChat, IChatCreate, IChatUpdate, } from "./interfaces/chat/chat.interfaces";
15
16
  export { IFolder } from "./interfaces/folder/folder.interfaces";
16
17
  export { IMessage, IMessageCreate, IMessageUpdate, } from "./interfaces/message/message.interfaces";
18
+ export { IReportConfiguration, IReportConfigurationData, IReportConfigurationInput, ICustomClass, IValidationResult, } from "./interfaces/report-configuration/report-configuration.interfaces";
17
19
  export { IStudy } from "./interfaces/study/study.interfaces";
18
20
  export { IUser } from "./interfaces/user/user.interfaces";
19
21
  export { IUserPushNotificationToken } from "./interfaces/user-push-notification-token/user-push-notification-token.interfaces";
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ 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.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.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; } });
@@ -15,6 +15,8 @@ var folder_dao_1 = require("./dao/folder/folder.dao");
15
15
  Object.defineProperty(exports, "FolderDAO", { enumerable: true, get: function () { return folder_dao_1.FolderDAO; } });
16
16
  var message_dao_1 = require("./dao/message/message.dao");
17
17
  Object.defineProperty(exports, "MessageDAO", { enumerable: true, get: function () { return message_dao_1.MessageDAO; } });
18
+ var report_configuration_dao_1 = require("./dao/report-configuration/report-configuration.dao");
19
+ Object.defineProperty(exports, "ReportConfigurationDAO", { enumerable: true, get: function () { return report_configuration_dao_1.ReportConfigurationDAO; } });
18
20
  var study_dao_1 = require("./dao/study/study.dao");
19
21
  Object.defineProperty(exports, "StudyDAO", { enumerable: true, get: function () { return study_dao_1.StudyDAO; } });
20
22
  var user_dao_1 = require("./dao/user/user.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,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;AA2B7B,sEAA2C;AAClC,sBADF,wBAAW,CACE"}
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;AAkC7B,sEAA2C;AAClC,sBADF,wBAAW,CACE"}
@@ -0,0 +1,26 @@
1
+ export interface IReportConfiguration {
2
+ id: number;
3
+ uuid: string;
4
+ name: string;
5
+ description?: string;
6
+ configuration: IReportConfigurationData;
7
+ created_at: Date;
8
+ updated_at: Date;
9
+ }
10
+ export interface IReportConfigurationData {
11
+ version: string;
12
+ customClasses: ICustomClass[];
13
+ }
14
+ export interface ICustomClass {
15
+ name: string;
16
+ fhwaClasses: number[];
17
+ }
18
+ export interface IReportConfigurationInput {
19
+ name: string;
20
+ description?: string;
21
+ configuration: IReportConfigurationData;
22
+ }
23
+ export interface IValidationResult {
24
+ valid: boolean;
25
+ errors: string[];
26
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=report-configuration.interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-configuration.interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/report-configuration/report-configuration.interfaces.ts"],"names":[],"mappings":""}
@@ -0,0 +1,52 @@
1
+ import type { Knex } from "knex";
2
+
3
+ export async function up(knex: Knex): Promise<void> {
4
+ // Create report_configurations table
5
+ await knex.schema.createTable("report_configurations", (table) => {
6
+ table.increments("id").primary();
7
+ table
8
+ .uuid("uuid")
9
+ .notNullable()
10
+ .unique()
11
+ .defaultTo(knex.raw("uuid_generate_v4()"));
12
+ table.string("name", 30).notNullable().unique();
13
+ table.text("description");
14
+ table.jsonb("configuration").notNullable();
15
+ table.timestamps(true, true); // created_at, updated_at
16
+ });
17
+
18
+ // Create indexes
19
+ await knex.schema.alterTable("report_configurations", (table) => {
20
+ table.index("uuid", "idx_report_configurations_uuid");
21
+ });
22
+
23
+ await knex.raw(`
24
+ CREATE INDEX idx_report_configurations_name_lower
25
+ ON report_configurations(LOWER(name))
26
+ `);
27
+
28
+ // Seed "Default" configuration
29
+ await knex("report_configurations").insert({
30
+ name: "Default",
31
+ description: "Standard configuration matching current system behavior",
32
+ configuration: JSON.stringify({
33
+ version: "1.0",
34
+ customClasses: [
35
+ { name: "Cars", fhwaClasses: [1, 2, 3] },
36
+ { name: "Medium Trucks", fhwaClasses: [5] },
37
+ { name: "Heavy Trucks", fhwaClasses: [4, 6, 7, 8, 9, 10, 11, 12, 13] },
38
+ ],
39
+ }),
40
+ });
41
+ }
42
+
43
+ export async function down(knex: Knex): Promise<void> {
44
+ // Drop indexes first
45
+ await knex.raw("DROP INDEX IF EXISTS idx_report_configurations_name_lower");
46
+ await knex.schema.alterTable("report_configurations", (table) => {
47
+ table.dropIndex("uuid", "idx_report_configurations_uuid");
48
+ });
49
+
50
+ // Drop table
51
+ await knex.schema.dropTableIfExists("report_configurations");
52
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trafficgroup/knex-rel",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Knex Module",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {