gemcap-be-common 1.4.242 → 1.4.244

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.
@@ -74,6 +74,9 @@ export declare const convertDataToFileWithStyle: (dataToConvert: {
74
74
  showGridLines?: boolean;
75
75
  };
76
76
  };
77
+ conditionalFormatting?: {
78
+ [sheetName: string]: ExcelJS.ConditionalFormattingOptions[];
79
+ };
77
80
  }) => Promise<Buffer>;
78
81
  export declare const addHeaderToData: (header: {
79
82
  [key: string]: string;
@@ -221,6 +221,12 @@ const convertDataToFileWithStyle = async (dataToConvert, options) => {
221
221
  sheet.columns = Array.from(colLetters).map((colId) => ({
222
222
  width: options?.width?.[sheetName]?.[colId] ?? defaultColumnWidth,
223
223
  }));
224
+ const formatting = options?.conditionalFormatting?.[sheetName];
225
+ if (formatting) {
226
+ formatting.forEach((rule) => {
227
+ sheet.addConditionalFormatting(rule);
228
+ });
229
+ }
224
230
  }
225
231
  const buffer = await workbook.xlsx.writeBuffer();
226
232
  return Buffer.from(buffer);
@@ -173,6 +173,9 @@ export const convertDataToFileWithStyle = async (
173
173
  showGridLines?: boolean;
174
174
  };
175
175
  };
176
+ conditionalFormatting?: {
177
+ [sheetName: string]: ExcelJS.ConditionalFormattingOptions[];
178
+ };
176
179
  },
177
180
  ): Promise<Buffer> => {
178
181
 
@@ -254,6 +257,14 @@ export const convertDataToFileWithStyle = async (
254
257
  sheet.columns = Array.from(colLetters).map((colId) => ({
255
258
  width: options?.width?.[sheetName]?.[colId] ?? defaultColumnWidth,
256
259
  }));
260
+
261
+ const formatting = options?.conditionalFormatting?.[sheetName];
262
+
263
+ if (formatting) {
264
+ formatting.forEach((rule) => {
265
+ sheet.addConditionalFormatting(rule);
266
+ });
267
+ }
257
268
  }
258
269
 
259
270
  const buffer = await workbook.xlsx.writeBuffer();
@@ -22,20 +22,30 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
- import mongoose, { Document, Model } from 'mongoose';
25
+ import mongoose from 'mongoose';
26
26
  import Joi from 'joi';
27
27
  export interface IAuditor {
28
28
  isDeleted: boolean;
29
29
  name: string;
30
30
  order?: number;
31
31
  }
32
- export interface IAuditorWithID extends IAuditor {
33
- _id: string;
32
+ export interface IAuditorDoc extends IAuditor, mongoose.Document {
33
+ _id: mongoose.Types.ObjectId;
34
+ createdAt: Date;
35
+ updatedAt: Date;
34
36
  }
35
- export interface IAuditorDoc extends IAuditor, Document {
37
+ export interface IAuditorLean extends IAuditor {
38
+ _id: mongoose.Types.ObjectId;
39
+ createdAt: Date;
40
+ updatedAt: Date;
41
+ }
42
+ export interface IAuditorPlain extends IAuditor {
43
+ _id: string;
44
+ createdAt: Date;
45
+ updatedAt: Date;
36
46
  }
37
47
  export declare const AuditorValidationSchema: Joi.ObjectSchema<any>;
38
- export type AuditorModel = Model<IAuditor, object, object>;
48
+ export type AuditorModel = mongoose.Model<IAuditor>;
39
49
  export declare const AuditorSchema: mongoose.Schema<IAuditor, AuditorModel, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IAuditor, mongoose.Document<unknown, {}, mongoose.FlatRecord<IAuditor>> & mongoose.FlatRecord<IAuditor> & {
40
50
  _id: mongoose.Types.ObjectId;
41
51
  }>;
@@ -1,4 +1,4 @@
1
- import mongoose, { Document, Model } from 'mongoose';
1
+ import mongoose from 'mongoose';
2
2
  import Joi from 'joi';
3
3
 
4
4
  import { MODEL_NAMES } from './_models';
@@ -9,11 +9,22 @@ export interface IAuditor {
9
9
  order?: number;
10
10
  }
11
11
 
12
- export interface IAuditorWithID extends IAuditor {
13
- _id: string;
12
+ export interface IAuditorDoc extends IAuditor, mongoose.Document {
13
+ _id: mongoose.Types.ObjectId;
14
+ createdAt: Date;
15
+ updatedAt: Date;
16
+ }
17
+
18
+ export interface IAuditorLean extends IAuditor {
19
+ _id: mongoose.Types.ObjectId;
20
+ createdAt: Date;
21
+ updatedAt: Date;
14
22
  }
15
23
 
16
- export interface IAuditorDoc extends IAuditor, Document {
24
+ export interface IAuditorPlain extends IAuditor {
25
+ _id: string;
26
+ createdAt: Date;
27
+ updatedAt: Date;
17
28
  }
18
29
 
19
30
  export const AuditorValidationSchema = Joi.object({
@@ -23,7 +34,7 @@ export const AuditorValidationSchema = Joi.object({
23
34
  order: Joi.number().required().allow (null),
24
35
  });
25
36
 
26
- export type AuditorModel = Model<IAuditor, object, object>;
37
+ export type AuditorModel = mongoose.Model<IAuditor>;
27
38
 
28
39
  export const AuditorSchema = new mongoose.Schema<IAuditor, AuditorModel>(
29
40
  {
@@ -22,14 +22,27 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
- import mongoose, { Document, Model } from 'mongoose';
25
+ import mongoose from 'mongoose';
26
26
  export interface IAuditorAccess {
27
27
  email: string;
28
28
  hashedPassword: string;
29
29
  }
30
- export interface IAuditorAccessDoc extends IAuditorAccess, Document {
30
+ export interface IAuditorAccessDoc extends IAuditorAccess, mongoose.Document {
31
+ _id: mongoose.Types.ObjectId;
32
+ createdAt: Date;
33
+ updatedAt: Date;
34
+ }
35
+ export interface IAuditorAccessLean extends IAuditorAccess {
36
+ _id: mongoose.Types.ObjectId;
37
+ createdAt: Date;
38
+ updatedAt: Date;
39
+ }
40
+ export interface IAuditorAccessPlain extends IAuditorAccess {
41
+ _id: string;
42
+ createdAt: Date;
43
+ updatedAt: Date;
31
44
  }
32
- export type AuditorAccessModel = Model<IAuditorAccess, object, object>;
45
+ export type AuditorAccessModel = mongoose.Model<IAuditorAccess>;
33
46
  export declare const AuditorAccessSchema: mongoose.Schema<IAuditorAccess, AuditorAccessModel, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IAuditorAccess, mongoose.Document<unknown, {}, mongoose.FlatRecord<IAuditorAccess>> & mongoose.FlatRecord<IAuditorAccess> & {
34
47
  _id: mongoose.Types.ObjectId;
35
48
  }>;
@@ -1,4 +1,4 @@
1
- import mongoose, { Document, Model } from 'mongoose';
1
+ import mongoose from 'mongoose';
2
2
 
3
3
  import { MODEL_NAMES } from './_models';
4
4
 
@@ -7,10 +7,25 @@ export interface IAuditorAccess {
7
7
  hashedPassword: string;
8
8
  }
9
9
 
10
- export interface IAuditorAccessDoc extends IAuditorAccess, Document {
10
+ export interface IAuditorAccessDoc extends IAuditorAccess, mongoose.Document {
11
+ _id: mongoose.Types.ObjectId;
12
+ createdAt: Date;
13
+ updatedAt: Date;
11
14
  }
12
15
 
13
- export type AuditorAccessModel = Model<IAuditorAccess, object, object>;
16
+ export interface IAuditorAccessLean extends IAuditorAccess {
17
+ _id: mongoose.Types.ObjectId;
18
+ createdAt: Date;
19
+ updatedAt: Date;
20
+ }
21
+
22
+ export interface IAuditorAccessPlain extends IAuditorAccess {
23
+ _id: string;
24
+ createdAt: Date;
25
+ updatedAt: Date;
26
+ }
27
+
28
+ export type AuditorAccessModel = mongoose.Model<IAuditorAccess>;
14
29
 
15
30
  export const AuditorAccessSchema = new mongoose.Schema<IAuditorAccess, AuditorAccessModel>(
16
31
  {
@@ -22,7 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
- import mongoose, { Document, Model } from 'mongoose';
25
+ import mongoose from 'mongoose';
26
26
  import Joi from 'joi';
27
27
  export interface IAuditorContact {
28
28
  auditorId: mongoose.Types.ObjectId;
@@ -34,13 +34,24 @@ export interface IAuditorContact {
34
34
  comment?: string;
35
35
  order?: number;
36
36
  }
37
- export interface IAuditorContactWithID extends IAuditorContact {
38
- _id: string;
37
+ export interface IAuditorContactDoc extends IAuditorContact, mongoose.Document {
38
+ _id: mongoose.Types.ObjectId;
39
+ createdAt: Date;
40
+ updatedAt: Date;
39
41
  }
40
- export interface IAuditorContactDoc extends IAuditorContact, Document {
42
+ export interface IAuditorContactLean extends IAuditorContact {
43
+ _id: mongoose.Types.ObjectId;
44
+ createdAt: Date;
45
+ updatedAt: Date;
46
+ }
47
+ export interface IAuditorContactPlain extends Omit<IAuditorContact, 'auditorId'> {
48
+ _id: string;
49
+ auditorId: string;
50
+ createdAt: Date;
51
+ updatedAt: Date;
41
52
  }
42
53
  export declare const AuditorContactValidationSchema: Joi.ObjectSchema<any>;
43
- export type AuditorContactModel = Model<IAuditorContact, object, object>;
54
+ export type AuditorContactModel = mongoose.Model<IAuditorContact>;
44
55
  export declare const AuditorContactSchema: mongoose.Schema<IAuditorContact, AuditorContactModel, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IAuditorContact, mongoose.Document<unknown, {}, mongoose.FlatRecord<IAuditorContact>> & mongoose.FlatRecord<IAuditorContact> & {
45
56
  _id: mongoose.Types.ObjectId;
46
57
  }>;
@@ -1,4 +1,4 @@
1
- import mongoose, { Document, Model } from 'mongoose';
1
+ import mongoose from 'mongoose';
2
2
  import Joi from 'joi';
3
3
 
4
4
  import { MODEL_NAMES } from './_models';
@@ -14,11 +14,23 @@ export interface IAuditorContact {
14
14
  order?: number;
15
15
  }
16
16
 
17
- export interface IAuditorContactWithID extends IAuditorContact {
18
- _id: string;
17
+ export interface IAuditorContactDoc extends IAuditorContact, mongoose.Document {
18
+ _id: mongoose.Types.ObjectId;
19
+ createdAt: Date;
20
+ updatedAt: Date;
21
+ }
22
+
23
+ export interface IAuditorContactLean extends IAuditorContact {
24
+ _id: mongoose.Types.ObjectId;
25
+ createdAt: Date;
26
+ updatedAt: Date;
19
27
  }
20
28
 
21
- export interface IAuditorContactDoc extends IAuditorContact, Document {
29
+ export interface IAuditorContactPlain extends Omit<IAuditorContact, 'auditorId'> {
30
+ _id: string;
31
+ auditorId: string;
32
+ createdAt: Date;
33
+ updatedAt: Date;
22
34
  }
23
35
 
24
36
  export const AuditorContactValidationSchema = Joi.object({
@@ -32,7 +44,7 @@ export const AuditorContactValidationSchema = Joi.object({
32
44
  order: Joi.number().required().allow(null),
33
45
  });
34
46
 
35
- export type AuditorContactModel = Model<IAuditorContact, object, object>;
47
+ export type AuditorContactModel = mongoose.Model<IAuditorContact>;
36
48
 
37
49
  export const AuditorContactSchema = new mongoose.Schema<IAuditorContact, AuditorContactModel>(
38
50
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.4.242",
3
+ "version": "1.4.244",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {