gemcap-be-common 1.4.61 → 1.4.63

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.
@@ -29,6 +29,21 @@ export interface IExcelJsCell {
29
29
  border?: Partial<ExcelJS.Borders>;
30
30
  };
31
31
  }
32
+ export declare const cellStyles: {
33
+ title: {
34
+ font: {
35
+ bold: boolean;
36
+ };
37
+ border: {
38
+ bottom: {
39
+ style: ExcelJS.BorderStyle;
40
+ color: {
41
+ argb: string;
42
+ };
43
+ };
44
+ };
45
+ };
46
+ };
32
47
  export declare const convertDataToFile: (dataToConvert: {
33
48
  [sheetName: string]: any[];
34
49
  }[]) => Promise<any>;
@@ -63,3 +78,9 @@ export declare const convertDataToFileWithStyle: (dataToConvert: {
63
78
  export declare const addHeaderToData: (header: {
64
79
  [key: string]: string;
65
80
  }, data: object[]) => {}[];
81
+ export declare const getColumnsWidths: (sheetNames: string[], columnWidth: {
82
+ [columnLetter: string]: number;
83
+ }) => {};
84
+ export declare const getSheetsOptions: (sheetNames: string[], options: {
85
+ showGridLines: boolean;
86
+ }) => {};
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.addHeaderToData = exports.convertDataToFileWithStyle = exports.convertDataToFileWithStyleOld = exports.convertDataToFile = exports.NUMBER_FORMATS = void 0;
29
+ exports.getSheetsOptions = exports.getColumnsWidths = exports.addHeaderToData = exports.convertDataToFileWithStyle = exports.convertDataToFileWithStyleOld = exports.convertDataToFile = exports.cellStyles = exports.NUMBER_FORMATS = void 0;
30
30
  const XLSX = __importStar(require("xlsx"));
31
31
  const XLSXStyle = __importStar(require("xlsx-js-style"));
32
32
  const exceljs_1 = __importDefault(require("exceljs"));
@@ -42,6 +42,14 @@ exports.NUMBER_FORMATS = {
42
42
  currencyFull$: '$#,##0.00',
43
43
  currencyShort$: '$#,##0',
44
44
  };
45
+ exports.cellStyles = {
46
+ title: {
47
+ font: { bold: true },
48
+ border: {
49
+ bottom: { style: 'medium', color: { argb: 'FF000000' } },
50
+ },
51
+ },
52
+ };
45
53
  const defaultColumnWidth = 20;
46
54
  const convertDataToFile = async (dataToConvert) => {
47
55
  const wb = XLSX.utils.book_new();
@@ -229,3 +237,19 @@ const addHeaderToData = (header, data) => {
229
237
  return [header, ...processedItems];
230
238
  };
231
239
  exports.addHeaderToData = addHeaderToData;
240
+ const getColumnsWidths = (sheetNames, columnWidth) => {
241
+ return sheetNames.reduce((acc, sheetName) => {
242
+ return {
243
+ ...acc,
244
+ [sheetName]: columnWidth,
245
+ };
246
+ }, {});
247
+ };
248
+ exports.getColumnsWidths = getColumnsWidths;
249
+ const getSheetsOptions = (sheetNames, options) => {
250
+ return sheetNames.reduce((acc, sheetName) => ({
251
+ ...acc,
252
+ [sheetName]: options,
253
+ }), {});
254
+ };
255
+ exports.getSheetsOptions = getSheetsOptions;
@@ -34,6 +34,15 @@ export interface IExcelJsCell {
34
34
  };
35
35
  }
36
36
 
37
+ export const cellStyles = {
38
+ title: {
39
+ font: { bold: true },
40
+ border: {
41
+ bottom: { style: 'medium' as ExcelJS.BorderStyle, color: { argb: 'FF000000' } },
42
+ },
43
+ },
44
+ };
45
+
37
46
  const defaultColumnWidth = 20;
38
47
 
39
48
  export const convertDataToFile = async (dataToConvert: { [sheetName: string]: any[] }[]) => {
@@ -109,7 +118,7 @@ const checkData = (dataToConvert: { [sheetName: string]: IExcelDataCellWithStyle
109
118
  });
110
119
  });
111
120
  }
112
- }
121
+ };
113
122
 
114
123
  export const convertDataToFileWithStyleOld = async (
115
124
  dataToConvert: { [sheetName: string]: IExcelDataCellWithStyles[][] },
@@ -260,4 +269,23 @@ export const addHeaderToData = (header: { [key: string]: string }, data: object[
260
269
  };
261
270
  const processedItems = data.map(filterAndReorder);
262
271
  return [header, ...processedItems];
263
- }
272
+ };
273
+
274
+ export const getColumnsWidths = (sheetNames: string[], columnWidth: { [columnLetter: string]: number }) => {
275
+ return sheetNames.reduce((acc, sheetName) => {
276
+ return {
277
+ ...acc,
278
+ [sheetName]: columnWidth,
279
+ };
280
+ }, {});
281
+ };
282
+
283
+ export const getSheetsOptions = (sheetNames: string[], options: { showGridLines: boolean }) => {
284
+ return sheetNames.reduce(
285
+ (acc, sheetName) => ({
286
+ ...acc,
287
+ [sheetName]: options,
288
+ }),
289
+ {},
290
+ );
291
+ };
@@ -31,13 +31,23 @@ export interface IUnderwriter {
31
31
  order?: number;
32
32
  userId?: string;
33
33
  }
34
- export interface IUnderwriterWithId extends IUnderwriter {
35
- _id: string;
36
- }
37
34
  export interface IUnderwriterDoc extends IUnderwriter, Document {
35
+ _id: mongoose.Types.ObjectId;
36
+ createdAt: Date;
37
+ updatedAt: Date;
38
+ }
39
+ export interface IUnderwriterLean extends IUnderwriter {
40
+ _id: mongoose.Types.ObjectId;
41
+ createdAt: Date;
42
+ updatedAt: Date;
43
+ }
44
+ export interface IUnderwriterPlain extends IUnderwriter {
45
+ _id: string;
46
+ createdAt: Date;
47
+ updatedAt: Date;
38
48
  }
49
+ export type UnderwriterModel = Model<IUnderwriterDoc>;
39
50
  export declare const UnderwriterValidationSchema: Joi.ObjectSchema<any>;
40
- export type UnderwriterModel = Model<IUnderwriter, object, object>;
41
51
  export declare const UnderwriterSchema: mongoose.Schema<IUnderwriter, UnderwriterModel, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IUnderwriter, mongoose.Document<unknown, {}, mongoose.FlatRecord<IUnderwriter>> & mongoose.FlatRecord<IUnderwriter> & {
42
52
  _id: mongoose.Types.ObjectId;
43
53
  }>;
@@ -11,24 +11,35 @@ export interface IUnderwriter {
11
11
  userId?: string;
12
12
  }
13
13
 
14
- export interface IUnderwriterWithId extends IUnderwriter {
15
- _id: string;
14
+ export interface IUnderwriterDoc extends IUnderwriter, Document {
15
+ _id: mongoose.Types.ObjectId;
16
+ createdAt: Date;
17
+ updatedAt: Date;
16
18
  }
17
19
 
18
- export interface IUnderwriterDoc extends IUnderwriter, Document {
20
+ export interface IUnderwriterLean extends IUnderwriter {
21
+ _id: mongoose.Types.ObjectId;
22
+ createdAt: Date;
23
+ updatedAt: Date;
24
+ }
25
+
26
+ export interface IUnderwriterPlain extends IUnderwriter {
27
+ _id: string;
28
+ createdAt: Date;
29
+ updatedAt: Date;
19
30
  }
20
31
 
32
+ export type UnderwriterModel = Model<IUnderwriterDoc>;
33
+
21
34
  export const UnderwriterValidationSchema = Joi.object({
22
35
  _id: Joi.string(),
23
36
  name: Joi.string().required(),
24
37
  email: Joi.string(),
25
38
  userId: Joi.string(),
26
39
  isDeleted: Joi.boolean(),
27
- order: Joi.number().required().allow (null),
40
+ order: Joi.number().required().allow(null),
28
41
  });
29
42
 
30
- export type UnderwriterModel = Model<IUnderwriter, object, object>;
31
-
32
43
  export const UnderwriterSchema = new mongoose.Schema<IUnderwriter, UnderwriterModel>(
33
44
  {
34
45
  isDeleted: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.4.61",
3
+ "version": "1.4.63",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {