@kipicore/dbcore 1.1.658 → 1.1.659

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 (122) hide show
  1. package/dist/constants/app.d.ts +12 -15
  2. package/dist/constants/app.js +17 -20
  3. package/dist/constants/errorMessages.d.ts +0 -17
  4. package/dist/constants/errorMessages.js +1 -20
  5. package/dist/constants/successMessages.d.ts +0 -14
  6. package/dist/constants/successMessages.js +1 -17
  7. package/dist/db/psql/migrations/20260714095754-create-arena-models.js +642 -0
  8. package/dist/db/psql/migrations/20260720092201-replace-facility-sports-with-sport-group-data.d.ts +2 -0
  9. package/dist/db/psql/migrations/20260720092201-replace-facility-sports-with-sport-group-data.js +138 -0
  10. package/dist/interfaces/ageGroupInterface.d.ts +12 -0
  11. package/dist/interfaces/assessmentTestInterface.d.ts +24 -0
  12. package/dist/interfaces/categoriesInterface.d.ts +1 -2
  13. package/dist/interfaces/equipmentInterface.d.ts +10 -0
  14. package/dist/interfaces/equipmentInterface.js +2 -0
  15. package/dist/interfaces/facilityMasterInterface.d.ts +9 -0
  16. package/dist/interfaces/facilityMasterInterface.js +2 -0
  17. package/dist/interfaces/index.d.ts +12 -1
  18. package/dist/interfaces/index.js +13 -1
  19. package/dist/interfaces/instituteInterface.d.ts +0 -1
  20. package/dist/interfaces/skillInterface.d.ts +15 -0
  21. package/dist/interfaces/skillInterface.js +2 -0
  22. package/dist/interfaces/sportCategoryInterface.d.ts +9 -0
  23. package/dist/interfaces/sportCategoryInterface.js +2 -0
  24. package/dist/interfaces/sportGroupDataInterface.d.ts +7 -0
  25. package/dist/interfaces/sportGroupDataInterface.js +2 -0
  26. package/dist/interfaces/sportInfoInterface.d.ts +23 -0
  27. package/dist/interfaces/sportInfoInterface.js +2 -0
  28. package/dist/interfaces/sportInterface.d.ts +10 -0
  29. package/dist/interfaces/sportInterface.js +2 -0
  30. package/dist/interfaces/sportRoleInterface.d.ts +11 -0
  31. package/dist/interfaces/sportRoleInterface.js +2 -0
  32. package/dist/interfaces/sportSubCategoryInterface.d.ts +10 -0
  33. package/dist/interfaces/sportSubCategoryInterface.js +2 -0
  34. package/dist/interfaces/subCategoriesInterface.d.ts +1 -2
  35. package/dist/interfaces/unitInterface.d.ts +10 -0
  36. package/dist/interfaces/unitInterface.js +2 -0
  37. package/dist/interfaces/userInterface.d.ts +1 -2
  38. package/dist/interfaces/vendorCompanyMetaInterface.d.ts +1 -1
  39. package/dist/models/mongodb/assessmentTestModel.d.ts +4 -0
  40. package/dist/models/mongodb/assessmentTestModel.js +72 -0
  41. package/dist/models/mongodb/index.d.ts +2 -0
  42. package/dist/models/mongodb/index.js +6 -1
  43. package/dist/models/mongodb/productMetaModel.js +0 -8
  44. package/dist/models/mongodb/sportInfoModel.d.ts +4 -0
  45. package/dist/models/mongodb/sportInfoModel.js +71 -0
  46. package/dist/models/mongodb/vendorCompanyMetaModel.js +1 -1
  47. package/dist/models/psql/SubCategoriesModel.d.ts +1 -2
  48. package/dist/models/psql/SubCategoriesModel.js +0 -5
  49. package/dist/models/psql/ageGroupModel.d.ts +22 -0
  50. package/dist/models/psql/ageGroupModel.js +76 -0
  51. package/dist/models/psql/categoriesModel.d.ts +1 -2
  52. package/dist/models/psql/categoriesModel.js +0 -5
  53. package/dist/models/psql/equipmentModel.d.ts +20 -0
  54. package/dist/models/psql/equipmentModel.js +57 -0
  55. package/dist/models/psql/facilityMasterModel.d.ts +18 -0
  56. package/dist/models/psql/facilityMasterModel.js +64 -0
  57. package/dist/models/psql/index.d.ts +10 -1
  58. package/dist/models/psql/index.js +23 -4
  59. package/dist/models/psql/instituteModel.d.ts +0 -1
  60. package/dist/models/psql/instituteModel.js +2 -5
  61. package/dist/models/psql/skillModel.d.ts +25 -0
  62. package/dist/models/psql/skillModel.js +99 -0
  63. package/dist/models/psql/sportCategoryModel.d.ts +19 -0
  64. package/dist/models/psql/sportCategoryModel.js +53 -0
  65. package/dist/models/psql/sportGroupDataModel.d.ts +13 -0
  66. package/dist/models/psql/sportGroupDataModel.js +64 -0
  67. package/dist/models/psql/sportModel.d.ts +20 -0
  68. package/dist/models/psql/sportModel.js +58 -0
  69. package/dist/models/psql/sportRoleModel.d.ts +21 -0
  70. package/dist/models/psql/sportRoleModel.js +71 -0
  71. package/dist/models/psql/sportSubCategoryModel.d.ts +20 -0
  72. package/dist/models/psql/sportSubCategoryModel.js +75 -0
  73. package/dist/models/psql/unitModel.d.ts +20 -0
  74. package/dist/models/psql/unitModel.js +57 -0
  75. package/dist/models/psql/userModel.d.ts +1 -2
  76. package/dist/models/psql/userModel.js +0 -1
  77. package/dist/types/ageGroupType.d.ts +2 -0
  78. package/dist/types/ageGroupType.js +2 -0
  79. package/dist/types/assessmentTestType.d.ts +2 -0
  80. package/dist/types/assessmentTestType.js +2 -0
  81. package/dist/types/commonType.d.ts +1 -1
  82. package/dist/types/equipmentType.d.ts +2 -0
  83. package/dist/types/equipmentType.js +2 -0
  84. package/dist/types/facilityMasterType.d.ts +3 -0
  85. package/dist/types/facilityMasterType.js +2 -0
  86. package/dist/types/index.d.ts +12 -1
  87. package/dist/types/index.js +13 -1
  88. package/dist/types/skillType.d.ts +2 -0
  89. package/dist/types/skillType.js +2 -0
  90. package/dist/types/sportCategoryType.d.ts +2 -0
  91. package/dist/types/sportCategoryType.js +2 -0
  92. package/dist/types/sportGroupDataType.d.ts +3 -0
  93. package/dist/types/sportGroupDataType.js +2 -0
  94. package/dist/types/sportInfoType.d.ts +2 -0
  95. package/dist/types/sportInfoType.js +2 -0
  96. package/dist/types/sportRoleType.d.ts +2 -0
  97. package/dist/types/sportRoleType.js +2 -0
  98. package/dist/types/sportSubCategoryType.d.ts +2 -0
  99. package/dist/types/sportSubCategoryType.js +2 -0
  100. package/dist/types/sportType.d.ts +2 -0
  101. package/dist/types/sportType.js +2 -0
  102. package/dist/types/unitType.d.ts +2 -0
  103. package/dist/types/unitType.js +2 -0
  104. package/package.json +1 -1
  105. package/dist/db/psql/migrations/20260714111425-change_status_enum_to_string_in_institutes.js +0 -46
  106. package/dist/db/psql/migrations/20260714131500-add_note_to_institutes.d.ts +0 -2
  107. package/dist/db/psql/migrations/20260714131500-add_note_to_institutes.js +0 -20
  108. package/dist/db/psql/migrations/20260715150000-create-ai-model-keys.d.ts +0 -2
  109. package/dist/db/psql/migrations/20260715150000-create-ai-model-keys.js +0 -156
  110. package/dist/db/psql/migrations/20260717071354-add_type_to_categories.d.ts +0 -2
  111. package/dist/db/psql/migrations/20260717071354-add_type_to_categories.js +0 -19
  112. package/dist/db/psql/migrations/20260717072745-add_type_to_sub_categories.d.ts +0 -2
  113. package/dist/db/psql/migrations/20260717072745-add_type_to_sub_categories.js +0 -19
  114. package/dist/db/psql/migrations/20260717095051-add_status_to_users.d.ts +0 -2
  115. package/dist/db/psql/migrations/20260717095051-add_status_to_users.js +0 -19
  116. package/dist/interfaces/aiModelKeysInterface.d.ts +0 -15
  117. package/dist/models/psql/aiModelKeysModel.d.ts +0 -20
  118. package/dist/models/psql/aiModelKeysModel.js +0 -70
  119. package/dist/types/aiModelKeysType.d.ts +0 -3
  120. /package/dist/db/psql/migrations/{20260714111425-change_status_enum_to_string_in_institutes.d.ts → 20260714095754-create-arena-models.d.ts} +0 -0
  121. /package/dist/interfaces/{aiModelKeysInterface.js → ageGroupInterface.js} +0 -0
  122. /package/dist/{types/aiModelKeysType.js → interfaces/assessmentTestInterface.js} +0 -0
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ import { IUnitModelAttributes } from '../interfaces/unitInterface';
2
+ export type TUnitModelCreationAttributes = Partial<IUnitModelAttributes>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.658",
3
+ "version": "1.1.659",
4
4
  "description": "Reusable DB core package with Postgres, MongoDB, models, services, interfaces, and types",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
@@ -1,46 +0,0 @@
1
- 'use strict';
2
- module.exports = {
3
- up: async (queryInterface, Sequelize) => {
4
- const table = await queryInterface.describeTable('institutes');
5
- if (table.status) {
6
- // In PostgreSQL, changing from ENUM to VARCHAR often requires a USING clause
7
- try {
8
- await queryInterface.sequelize.query('ALTER TABLE institutes ALTER COLUMN status TYPE VARCHAR(255) USING status::varchar;');
9
- await queryInterface.changeColumn('institutes', 'status', {
10
- type: Sequelize.STRING,
11
- allowNull: false,
12
- defaultValue: 'ACTIVE',
13
- });
14
- }
15
- catch (error) {
16
- // Fallback if the raw query fails
17
- await queryInterface.changeColumn('institutes', 'status', {
18
- type: Sequelize.STRING,
19
- allowNull: false,
20
- defaultValue: 'ACTIVE',
21
- });
22
- }
23
- }
24
- },
25
- down: async (queryInterface, Sequelize) => {
26
- const table = await queryInterface.describeTable('institutes');
27
- if (table.status) {
28
- try {
29
- await queryInterface.sequelize.query('ALTER TABLE institutes ALTER COLUMN status TYPE "enum_institutes_status" USING status::text::"enum_institutes_status";');
30
- await queryInterface.changeColumn('institutes', 'status', {
31
- type: Sequelize.ENUM('ACTIVE', 'INACTIVE', 'PENDING', 'BLOCKED'), // Typical statuses, can adapt if needed
32
- allowNull: false,
33
- defaultValue: 'ACTIVE',
34
- });
35
- }
36
- catch (error) {
37
- // Fallback
38
- await queryInterface.changeColumn('institutes', 'status', {
39
- type: Sequelize.ENUM('ACTIVE', 'INACTIVE', 'PENDING', 'BLOCKED'),
40
- allowNull: false,
41
- defaultValue: 'ACTIVE',
42
- });
43
- }
44
- }
45
- }
46
- };
@@ -1,2 +0,0 @@
1
- export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
- export function down(queryInterface: any): Promise<void>;
@@ -1,20 +0,0 @@
1
- 'use strict';
2
- const up = async (queryInterface, Sequelize) => {
3
- const table = await queryInterface.describeTable('institutes');
4
- if (!table.note) {
5
- await queryInterface.addColumn('institutes', 'note', {
6
- type: Sequelize.STRING,
7
- allowNull: true,
8
- });
9
- }
10
- };
11
- const down = async (queryInterface) => {
12
- const table = await queryInterface.describeTable('institutes');
13
- if (table.note) {
14
- await queryInterface.removeColumn('institutes', 'note');
15
- }
16
- };
17
- module.exports = {
18
- up,
19
- down,
20
- };
@@ -1,2 +0,0 @@
1
- export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
- export function down(queryInterface: any): Promise<void>;
@@ -1,156 +0,0 @@
1
- "use strict";
2
- const up = async (queryInterface, Sequelize) => {
3
- const tableName = 'ai_model_keys';
4
- const tableExists = await queryInterface
5
- .describeTable(tableName)
6
- .then(() => true)
7
- .catch(() => false);
8
- if (!tableExists) {
9
- await queryInterface.createTable(tableName, {
10
- id: {
11
- type: Sequelize.UUID,
12
- defaultValue: Sequelize.UUIDV4,
13
- allowNull: false,
14
- primaryKey: true,
15
- },
16
- key: {
17
- type: Sequelize.STRING,
18
- allowNull: false,
19
- unique: true,
20
- },
21
- hasValue: {
22
- type: Sequelize.STRING,
23
- allowNull: false,
24
- field: 'has_value',
25
- },
26
- type: {
27
- type: Sequelize.STRING,
28
- allowNull: false,
29
- },
30
- description: {
31
- type: Sequelize.TEXT,
32
- allowNull: false,
33
- },
34
- version: {
35
- type: Sequelize.INTEGER,
36
- allowNull: false,
37
- defaultValue: 1,
38
- },
39
- createdBy: {
40
- type: Sequelize.UUID,
41
- allowNull: true,
42
- field: 'created_by',
43
- },
44
- updatedBy: {
45
- type: Sequelize.UUID,
46
- allowNull: true,
47
- field: 'updated_by',
48
- },
49
- deletedBy: {
50
- type: Sequelize.UUID,
51
- allowNull: true,
52
- field: 'deleted_by',
53
- },
54
- createdAt: {
55
- type: Sequelize.DATE,
56
- allowNull: false,
57
- field: 'created_at',
58
- },
59
- updatedAt: {
60
- type: Sequelize.DATE,
61
- allowNull: false,
62
- field: 'updated_at',
63
- },
64
- deletedAt: {
65
- type: Sequelize.DATE,
66
- allowNull: true,
67
- field: 'deleted_at',
68
- },
69
- });
70
- }
71
- else {
72
- const tableDefinition = await queryInterface.describeTable(tableName);
73
- const columnsToAdd = {
74
- id: {
75
- type: Sequelize.UUID,
76
- defaultValue: Sequelize.UUIDV4,
77
- allowNull: false,
78
- primaryKey: true,
79
- },
80
- key: {
81
- type: Sequelize.STRING,
82
- allowNull: false,
83
- unique: true,
84
- },
85
- hasValue: {
86
- type: Sequelize.STRING,
87
- allowNull: false,
88
- field: 'has_value',
89
- },
90
- type: {
91
- type: Sequelize.STRING,
92
- allowNull: false,
93
- },
94
- description: {
95
- type: Sequelize.TEXT,
96
- allowNull: false,
97
- },
98
- version: {
99
- type: Sequelize.INTEGER,
100
- allowNull: false,
101
- defaultValue: 1,
102
- },
103
- createdBy: {
104
- type: Sequelize.UUID,
105
- allowNull: true,
106
- field: 'created_by',
107
- },
108
- updatedBy: {
109
- type: Sequelize.UUID,
110
- allowNull: true,
111
- field: 'updated_by',
112
- },
113
- deletedBy: {
114
- type: Sequelize.UUID,
115
- allowNull: true,
116
- field: 'deleted_by',
117
- },
118
- createdAt: {
119
- type: Sequelize.DATE,
120
- allowNull: false,
121
- field: 'created_at',
122
- },
123
- updatedAt: {
124
- type: Sequelize.DATE,
125
- allowNull: false,
126
- field: 'updated_at',
127
- },
128
- deletedAt: {
129
- type: Sequelize.DATE,
130
- allowNull: true,
131
- field: 'deleted_at',
132
- },
133
- };
134
- for (const column of Object.keys(columnsToAdd)) {
135
- const columnToAdd = columnsToAdd[column];
136
- const tableColumn = columnToAdd.field || column;
137
- if (!tableDefinition[tableColumn]) {
138
- await queryInterface.addColumn(tableName, tableColumn, columnToAdd);
139
- }
140
- }
141
- }
142
- };
143
- const down = async (queryInterface) => {
144
- const tableName = 'ai_model_keys';
145
- const tableExists = await queryInterface
146
- .describeTable(tableName)
147
- .then(() => true)
148
- .catch(() => false);
149
- if (tableExists) {
150
- await queryInterface.dropTable(tableName);
151
- }
152
- };
153
- module.exports = {
154
- up,
155
- down,
156
- };
@@ -1,2 +0,0 @@
1
- export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
- export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -1,19 +0,0 @@
1
- 'use strict';
2
- module.exports = {
3
- up: async (queryInterface, Sequelize) => {
4
- const table = await queryInterface.describeTable('categories');
5
- if (!table.type) {
6
- await queryInterface.addColumn('categories', 'type', {
7
- type: Sequelize.STRING,
8
- allowNull: true,
9
- defaultValue: 'INVENTORY',
10
- });
11
- }
12
- },
13
- down: async (queryInterface, Sequelize) => {
14
- const table = await queryInterface.describeTable('categories');
15
- if (table.type) {
16
- await queryInterface.removeColumn('categories', 'type');
17
- }
18
- }
19
- };
@@ -1,2 +0,0 @@
1
- export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
- export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -1,19 +0,0 @@
1
- 'use strict';
2
- module.exports = {
3
- up: async (queryInterface, Sequelize) => {
4
- const table = await queryInterface.describeTable('sub_categories');
5
- if (!table.type) {
6
- await queryInterface.addColumn('sub_categories', 'type', {
7
- type: Sequelize.STRING,
8
- allowNull: true,
9
- defaultValue: 'INVENTORY',
10
- });
11
- }
12
- },
13
- down: async (queryInterface, Sequelize) => {
14
- const table = await queryInterface.describeTable('sub_categories');
15
- if (table.type) {
16
- await queryInterface.removeColumn('sub_categories', 'type');
17
- }
18
- }
19
- };
@@ -1,2 +0,0 @@
1
- export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
- export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -1,19 +0,0 @@
1
- 'use strict';
2
- module.exports = {
3
- up: async (queryInterface, Sequelize) => {
4
- const table = await queryInterface.describeTable('users');
5
- if (!table.status) {
6
- await queryInterface.addColumn('users', 'status', {
7
- type: Sequelize.STRING,
8
- allowNull: true,
9
- defaultValue: 'ACTIVE',
10
- });
11
- }
12
- },
13
- down: async (queryInterface, Sequelize) => {
14
- const table = await queryInterface.describeTable('users');
15
- if (table.status) {
16
- await queryInterface.removeColumn('users', 'status');
17
- }
18
- }
19
- };
@@ -1,15 +0,0 @@
1
- import { AI_MODEL_KEYS, AI_MODEL_KEY_TYPES } from "../constants";
2
- export interface IAiModelKeyAttributes {
3
- id: string;
4
- key: AI_MODEL_KEYS;
5
- hasValue: string;
6
- type: AI_MODEL_KEY_TYPES;
7
- description: string;
8
- version: number;
9
- createdBy?: string;
10
- updatedBy?: string;
11
- deletedBy?: string;
12
- createdAt?: Date;
13
- updatedAt?: Date;
14
- deletedAt?: Date;
15
- }
@@ -1,20 +0,0 @@
1
- import { Model } from 'sequelize';
2
- import { AI_MODEL_KEYS, AI_MODEL_KEY_TYPES } from '../../constants';
3
- import { IAiModelKeyAttributes } from '../../interfaces/aiModelKeysInterface';
4
- import { TAiModelKeyCreationAttributes } from '../../types/aiModelKeysType';
5
- declare class AiModelKeyModel extends Model<IAiModelKeyAttributes, TAiModelKeyCreationAttributes> {
6
- id: string;
7
- key: AI_MODEL_KEYS;
8
- hasValue: string;
9
- type: AI_MODEL_KEY_TYPES;
10
- description: string;
11
- version: number;
12
- createdBy?: string;
13
- updatedBy?: string;
14
- deletedBy?: string;
15
- readonly createdAt?: Date;
16
- readonly updatedAt?: Date;
17
- readonly deletedAt?: Date;
18
- static associate(models: any): void;
19
- }
20
- export default AiModelKeyModel;
@@ -1,70 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const sequelize_1 = require("sequelize");
4
- const index_1 = require("./index");
5
- class AiModelKeyModel extends sequelize_1.Model {
6
- static associate(models) {
7
- const { UserModel } = models;
8
- AiModelKeyModel.belongsTo(UserModel, {
9
- foreignKey: {
10
- name: 'createdBy',
11
- allowNull: true,
12
- field: 'created_by',
13
- },
14
- as: 'createdByUser',
15
- });
16
- AiModelKeyModel.belongsTo(UserModel, {
17
- foreignKey: {
18
- name: 'updatedBy',
19
- allowNull: true,
20
- field: 'updated_by',
21
- },
22
- as: 'updatedByUser',
23
- });
24
- AiModelKeyModel.belongsTo(UserModel, {
25
- foreignKey: {
26
- name: 'deletedBy',
27
- allowNull: true,
28
- field: 'deleted_by',
29
- },
30
- as: 'deletedByUser',
31
- });
32
- }
33
- }
34
- AiModelKeyModel.init({
35
- id: {
36
- type: sequelize_1.DataTypes.UUID,
37
- defaultValue: sequelize_1.DataTypes.UUIDV4,
38
- primaryKey: true,
39
- allowNull: false,
40
- },
41
- key: {
42
- type: sequelize_1.DataTypes.STRING,
43
- allowNull: false,
44
- unique: true,
45
- },
46
- hasValue: {
47
- type: sequelize_1.DataTypes.STRING,
48
- allowNull: false,
49
- field: 'has_value',
50
- },
51
- type: {
52
- type: sequelize_1.DataTypes.STRING,
53
- allowNull: false,
54
- },
55
- description: {
56
- type: sequelize_1.DataTypes.TEXT,
57
- allowNull: false,
58
- },
59
- version: {
60
- type: sequelize_1.DataTypes.INTEGER,
61
- allowNull: false,
62
- defaultValue: 1,
63
- },
64
- }, {
65
- sequelize: index_1.sequelize,
66
- modelName: 'AiModelKeyModel',
67
- tableName: 'ai_model_keys',
68
- timestamps: true,
69
- });
70
- exports.default = AiModelKeyModel;
@@ -1,3 +0,0 @@
1
- import { Optional } from 'sequelize';
2
- import { IAiModelKeyAttributes } from '../interfaces/aiModelKeysInterface';
3
- export type TAiModelKeyCreationAttributes = Optional<IAiModelKeyAttributes, 'id' | 'version' | 'createdBy' | 'updatedBy' | 'deletedBy' | 'createdAt' | 'updatedAt' | 'deletedAt'>;