@kipicore/dbcore 1.1.633 → 1.1.635

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.
@@ -0,0 +1,2 @@
1
+ export function up(queryInterface: any, Sequelize: any): Promise<void>;
2
+ export function down(queryInterface: any, Sequelize: any): Promise<void>;
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+ module.exports = {
3
+ up: async (queryInterface, Sequelize) => {
4
+ const [results] = await queryInterface.sequelize.query(`
5
+ SELECT data_type
6
+ FROM information_schema.columns
7
+ WHERE table_name = 'class_room_event'
8
+ AND column_name = 'entity_id';
9
+ `);
10
+ if (results.length > 0 && results[0].data_type !== 'ARRAY') {
11
+ await queryInterface.sequelize.query(`
12
+ ALTER TABLE class_room_event
13
+ ALTER COLUMN entity_id TYPE VARCHAR[]
14
+ USING ARRAY[entity_id]::VARCHAR[];
15
+ `);
16
+ }
17
+ },
18
+ down: async (queryInterface, Sequelize) => {
19
+ const [results] = await queryInterface.sequelize.query(`
20
+ SELECT data_type
21
+ FROM information_schema.columns
22
+ WHERE table_name = 'class_room_event'
23
+ AND column_name = 'entity_id';
24
+ `);
25
+ if (results.length > 0 && results[0].data_type === 'ARRAY') {
26
+ await queryInterface.sequelize.query(`
27
+ ALTER TABLE class_room_event
28
+ ALTER COLUMN entity_id TYPE UUID
29
+ USING (entity_id[1])::UUID;
30
+ `);
31
+ }
32
+ }
33
+ };
@@ -2,33 +2,42 @@ import { Document } from 'mongoose';
2
2
  import { IDefaultAttributes } from './commonInterface';
3
3
  import { VENDOR_COMPANY_META_STATUS } from '../constants/app';
4
4
  export interface IBankDetails {
5
- accountHolderName?: string;
6
- accountNumber?: string;
7
- ifscCode?: string;
8
- bankName?: string;
9
- branchName?: string;
5
+ accountHolderName: string;
6
+ accountNumber: string;
7
+ ifscCode: string;
8
+ bankName: string;
9
+ branchName: string;
10
+ }
11
+ export interface ICompanyDocument {
12
+ documentType: string;
13
+ fileStorageId: string;
14
+ isVerified?: boolean;
15
+ verifiedAt?: Date;
16
+ uploadedAt?: Date;
10
17
  }
11
18
  export interface IVendorCompanyMetaAttributes extends IDefaultAttributes, Document {
12
19
  id: string;
13
20
  vendorId: string;
14
21
  companyName: string;
15
22
  companyCode: string;
16
- email?: string;
17
- contact?: string;
18
- mobile: string;
19
- gstNumber?: string;
20
- panNumber?: string;
23
+ email: string;
24
+ mobile?: string;
25
+ gstNumber: string;
26
+ panNumber: string;
21
27
  website?: string;
22
28
  logo?: string;
23
- address1?: string;
24
- address2?: string;
25
- area?: string;
29
+ banner?: string;
30
+ address1: string;
31
+ address2: string;
32
+ area: string;
26
33
  district?: string;
27
- pinCode?: string;
34
+ pinCode: string;
28
35
  taluka?: string;
29
- country?: number;
30
- state?: number;
31
- city?: number;
32
- bankDetails?: IBankDetails;
36
+ country: number;
37
+ state: number;
38
+ city: number;
33
39
  status: VENDOR_COMPANY_META_STATUS;
40
+ description?: string;
41
+ documents: ICompanyDocument[];
42
+ bankDetails: IBankDetails;
34
43
  }
@@ -34,14 +34,54 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  const mongoose_1 = __importStar(require("mongoose"));
37
- const app_1 = require("../../constants/app");
37
+ const constants_1 = require("../../constants");
38
38
  const bankDetailsSchema = new mongoose_1.Schema({
39
- accountHolderName: { type: String, required: false },
40
- accountNumber: { type: String, required: false },
41
- ifscCode: { type: String, required: false },
42
- bankName: { type: String, required: false },
43
- branchName: { type: String, required: false },
44
- }, { _id: false });
39
+ accountHolderName: {
40
+ type: String,
41
+ required: true,
42
+ },
43
+ accountNumber: {
44
+ type: String,
45
+ required: true,
46
+ },
47
+ ifscCode: {
48
+ type: String,
49
+ required: true,
50
+ },
51
+ bankName: {
52
+ type: String,
53
+ required: true,
54
+ },
55
+ branchName: {
56
+ type: String,
57
+ required: true,
58
+ },
59
+ }, {
60
+ _id: false,
61
+ });
62
+ const companyDocumentSchema = new mongoose_1.Schema({
63
+ documentType: {
64
+ type: String,
65
+ required: true,
66
+ },
67
+ fileStorageId: {
68
+ type: String,
69
+ required: true,
70
+ },
71
+ isVerified: {
72
+ type: Boolean,
73
+ default: false,
74
+ },
75
+ verifiedAt: {
76
+ type: Date,
77
+ },
78
+ uploadedAt: {
79
+ type: Date,
80
+ default: Date.now,
81
+ },
82
+ }, {
83
+ _id: false,
84
+ });
45
85
  const vendorCompanyMetaSchema = new mongoose_1.Schema({
46
86
  vendorId: {
47
87
  type: String,
@@ -50,30 +90,34 @@ const vendorCompanyMetaSchema = new mongoose_1.Schema({
50
90
  companyName: {
51
91
  type: String,
52
92
  required: true,
93
+ trim: true,
53
94
  },
54
95
  companyCode: {
55
96
  type: String,
56
97
  required: true,
98
+ trim: true,
57
99
  },
58
- contact: {
59
- type: String,
60
- required: false,
61
- },
62
- mobile: {
100
+ email: {
63
101
  type: String,
64
102
  required: true,
103
+ trim: true,
104
+ lowercase: true,
65
105
  },
66
- email: {
106
+ mobile: {
67
107
  type: String,
68
108
  required: false,
69
109
  },
70
110
  gstNumber: {
71
111
  type: String,
72
- required: false,
112
+ required: true,
113
+ trim: true,
114
+ uppercase: true,
73
115
  },
74
116
  panNumber: {
75
117
  type: String,
76
- required: false,
118
+ required: true,
119
+ trim: true,
120
+ uppercase: true,
77
121
  },
78
122
  website: {
79
123
  type: String,
@@ -83,17 +127,21 @@ const vendorCompanyMetaSchema = new mongoose_1.Schema({
83
127
  type: String,
84
128
  required: false,
85
129
  },
86
- address1: {
130
+ banner: {
87
131
  type: String,
88
132
  required: false,
89
133
  },
134
+ address1: {
135
+ type: String,
136
+ required: true,
137
+ },
90
138
  address2: {
91
139
  type: String,
92
- required: false,
140
+ required: true,
93
141
  },
94
142
  area: {
95
143
  type: String,
96
- required: false,
144
+ required: true,
97
145
  },
98
146
  district: {
99
147
  type: String,
@@ -101,7 +149,7 @@ const vendorCompanyMetaSchema = new mongoose_1.Schema({
101
149
  },
102
150
  pinCode: {
103
151
  type: String,
104
- required: false,
152
+ required: true,
105
153
  },
106
154
  taluka: {
107
155
  type: String,
@@ -109,24 +157,33 @@ const vendorCompanyMetaSchema = new mongoose_1.Schema({
109
157
  },
110
158
  country: {
111
159
  type: Number,
112
- required: false,
160
+ required: true,
113
161
  },
114
162
  state: {
115
163
  type: Number,
116
- required: false,
164
+ required: true,
117
165
  },
118
166
  city: {
119
167
  type: Number,
168
+ required: true,
169
+ },
170
+ description: {
171
+ type: String,
120
172
  required: false,
173
+ default: '',
174
+ },
175
+ documents: {
176
+ type: [companyDocumentSchema],
177
+ default: [],
121
178
  },
122
179
  bankDetails: {
123
180
  type: bankDetailsSchema,
124
- required: false,
181
+ required: true,
125
182
  },
126
183
  status: {
127
184
  type: String,
128
- enum: Object.values(app_1.VENDOR_COMPANY_META_STATUS),
129
- default: app_1.VENDOR_COMPANY_META_STATUS.PENDING,
185
+ enum: Object.values(constants_1.VENDOR_COMPANY_META_STATUS),
186
+ default: constants_1.VENDOR_COMPANY_META_STATUS.PENDING,
130
187
  },
131
188
  createdBy: {
132
189
  type: String,
@@ -103,7 +103,7 @@ ClassRoomEventModel.init({
103
103
  allowNull: true,
104
104
  },
105
105
  entityId: {
106
- type: sequelize_1.DataTypes.UUID,
106
+ type: sequelize_1.DataTypes.ARRAY(sequelize_1.DataTypes.STRING),
107
107
  field: 'entity_id',
108
108
  allowNull: true,
109
109
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.633",
3
+ "version": "1.1.635",
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",