mblabs-roccato-backend-commons 1.0.48 → 1.0.50

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.
@@ -13,5 +13,6 @@ export default class AccountModuleEntity extends BaseEntity {
13
13
  canReview?: boolean;
14
14
  canDownload?: boolean;
15
15
  canUpload?: boolean;
16
+ canSupport?: boolean;
16
17
  constructor(partial: Partial<AccountModuleEntity>);
17
18
  }
@@ -27,6 +27,7 @@ let AccountModuleEntity = class AccountModuleEntity extends base_1.default {
27
27
  canReview;
28
28
  canDownload;
29
29
  canUpload;
30
+ canSupport;
30
31
  constructor(partial) {
31
32
  super();
32
33
  Object.assign(this, partial);
@@ -77,6 +78,10 @@ __decorate([
77
78
  (0, typeorm_1.Column)({ type: 'boolean', nullable: true }),
78
79
  __metadata("design:type", Boolean)
79
80
  ], AccountModuleEntity.prototype, "canUpload", void 0);
81
+ __decorate([
82
+ (0, typeorm_1.Column)({ type: 'boolean', nullable: true }),
83
+ __metadata("design:type", Boolean)
84
+ ], AccountModuleEntity.prototype, "canSupport", void 0);
80
85
  AccountModuleEntity = __decorate([
81
86
  (0, typeorm_1.Entity)('account_module'),
82
87
  __metadata("design:paramtypes", [Object])
@@ -13,5 +13,6 @@ export default class GroupModuleEntity extends BaseEntity {
13
13
  canReview?: boolean;
14
14
  canDownload?: boolean;
15
15
  canUpload?: boolean;
16
+ canSupport?: boolean;
16
17
  constructor(partial: Partial<GroupModuleEntity>);
17
18
  }
@@ -27,6 +27,7 @@ let GroupModuleEntity = class GroupModuleEntity extends base_1.default {
27
27
  canReview;
28
28
  canDownload;
29
29
  canUpload;
30
+ canSupport;
30
31
  constructor(partial) {
31
32
  super();
32
33
  Object.assign(this, partial);
@@ -77,6 +78,10 @@ __decorate([
77
78
  (0, typeorm_1.Column)({ type: 'boolean', nullable: true }),
78
79
  __metadata("design:type", Boolean)
79
80
  ], GroupModuleEntity.prototype, "canUpload", void 0);
81
+ __decorate([
82
+ (0, typeorm_1.Column)({ type: 'boolean', nullable: true }),
83
+ __metadata("design:type", Boolean)
84
+ ], GroupModuleEntity.prototype, "canSupport", void 0);
80
85
  GroupModuleEntity = __decorate([
81
86
  (0, typeorm_1.Entity)('group_module'),
82
87
  __metadata("design:paramtypes", [Object])
@@ -13,5 +13,6 @@ export default class ProfileModuleEntity extends BaseEntity {
13
13
  canReview?: boolean;
14
14
  canDownload?: boolean;
15
15
  canUpload?: boolean;
16
+ canSupport?: boolean;
16
17
  constructor(partial: Partial<ProfileModuleEntity>);
17
18
  }
@@ -27,6 +27,7 @@ let ProfileModuleEntity = class ProfileModuleEntity extends base_1.default {
27
27
  canReview;
28
28
  canDownload;
29
29
  canUpload;
30
+ canSupport;
30
31
  constructor(partial) {
31
32
  super();
32
33
  Object.assign(this, partial);
@@ -77,6 +78,10 @@ __decorate([
77
78
  (0, typeorm_1.Column)({ type: 'boolean', nullable: true }),
78
79
  __metadata("design:type", Boolean)
79
80
  ], ProfileModuleEntity.prototype, "canUpload", void 0);
81
+ __decorate([
82
+ (0, typeorm_1.Column)({ type: 'boolean', nullable: true }),
83
+ __metadata("design:type", Boolean)
84
+ ], ProfileModuleEntity.prototype, "canSupport", void 0);
80
85
  ProfileModuleEntity = __decorate([
81
86
  (0, typeorm_1.Entity)('profile_module'),
82
87
  __metadata("design:paramtypes", [Object])
@@ -71,6 +71,11 @@ class CreateGroupModuleTable1748449000200 {
71
71
  type: 'boolean',
72
72
  isNullable: true,
73
73
  },
74
+ {
75
+ name: 'canSupport',
76
+ type: 'boolean',
77
+ isNullable: true,
78
+ },
74
79
  {
75
80
  name: 'createdBy',
76
81
  type: 'varchar',
@@ -71,6 +71,11 @@ class CreateAccountModuleTable1748449000300 {
71
71
  type: 'boolean',
72
72
  isNullable: true,
73
73
  },
74
+ {
75
+ name: 'canSupport',
76
+ type: 'boolean',
77
+ isNullable: true,
78
+ },
74
79
  {
75
80
  name: 'createdBy',
76
81
  type: 'varchar',
@@ -24,6 +24,7 @@ class CreateProfileModuleTable1751576312683 {
24
24
  { name: 'canAssign', type: 'boolean', isNullable: true },
25
25
  { name: 'canReview', type: 'boolean', isNullable: true },
26
26
  { name: 'canDownload', type: 'boolean', isNullable: true },
27
+ { name: 'canSupport', type: 'boolean', isNullable: true },
27
28
  { name: 'canUpload', type: 'boolean', isNullable: true },
28
29
  { name: 'createdBy', type: 'varchar', isNullable: true },
29
30
  { name: 'createdAt', type: 'timestamptz', default: 'now()' },
@@ -24,7 +24,7 @@ declare class DateService {
24
24
  getCurrentTimestamp(): number;
25
25
  getMillisFromFormattedDate(date: string, format?: string): number;
26
26
  getMonthsInRange(startDate: Date, endDate: Date): string[];
27
- isSameDay(inp: Date, compare?: Date): boolean;
27
+ isSameDay(inp: Date | string, compare?: Date): boolean;
28
28
  isToday(date: Date): boolean;
29
29
  }
30
30
  declare const _default: DateService;
@@ -13,6 +13,7 @@ class DateService {
13
13
  if (luxon_1.DateTime.fromFormat(inp, format).isValid) {
14
14
  return luxon_1.DateTime.fromFormat(inp, format).toJSDate();
15
15
  }
16
+ return luxon_1.DateTime.local().toJSDate();
16
17
  }
17
18
  toFormat(inp, format = constants_1.DATE.SYSTEM.COMMON_DATE) {
18
19
  if (inp instanceof Date) {
@@ -107,9 +108,9 @@ class DateService {
107
108
  return months;
108
109
  }
109
110
  isSameDay(inp, compare = this.getCurrentDate()) {
110
- const date = luxon_1.DateTime.fromJSDate(inp).startOf('day');
111
- const compareDate = luxon_1.DateTime.fromJSDate(compare).startOf('day');
112
- return date.equals(compareDate);
111
+ const startDate = luxon_1.DateTime.fromJSDate(this.toDate(inp)).startOf('day');
112
+ const endDate = luxon_1.DateTime.fromJSDate(this.toDate(compare)).startOf('day');
113
+ return startDate.equals(endDate);
113
114
  }
114
115
  isToday(date) {
115
116
  return this.isSameDay(date);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mblabs-roccato-backend-commons",
3
- "version": "1.0.48",
3
+ "version": "1.0.50",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -39,6 +39,9 @@ export default class AccountModuleEntity extends BaseEntity {
39
39
  @Column({ type: 'boolean', nullable: true })
40
40
  public canUpload?: boolean;
41
41
 
42
+ @Column({ type: 'boolean', nullable: true })
43
+ public canSupport?: boolean;
44
+
42
45
  constructor (partial: Partial<AccountModuleEntity>) {
43
46
  super();
44
47
  Object.assign(this, partial);
@@ -39,6 +39,9 @@ export default class GroupModuleEntity extends BaseEntity {
39
39
  @Column({ type: 'boolean', nullable: true })
40
40
  public canUpload?: boolean;
41
41
 
42
+ @Column({ type: 'boolean', nullable: true })
43
+ public canSupport?: boolean;
44
+
42
45
  constructor (partial: Partial<GroupModuleEntity>) {
43
46
  super();
44
47
  Object.assign(this, partial);
@@ -49,6 +49,9 @@ export default class ProfileModuleEntity extends BaseEntity {
49
49
  @Column({ type: 'boolean', nullable: true })
50
50
  public canUpload?: boolean;
51
51
 
52
+ @Column({ type: 'boolean', nullable: true })
53
+ public canSupport?: boolean;
54
+
52
55
  constructor (partial: Partial<ProfileModuleEntity>) {
53
56
  super();
54
57
  Object.assign(this, partial);
@@ -69,6 +69,11 @@ export class CreateGroupModuleTable1748449000200 implements MigrationInterface {
69
69
  type: 'boolean',
70
70
  isNullable: true,
71
71
  },
72
+ {
73
+ name: 'canSupport',
74
+ type: 'boolean',
75
+ isNullable: true,
76
+ },
72
77
  {
73
78
  name: 'createdBy',
74
79
  type: 'varchar',
@@ -69,6 +69,11 @@ export class CreateAccountModuleTable1748449000300 implements MigrationInterface
69
69
  type: 'boolean',
70
70
  isNullable: true,
71
71
  },
72
+ {
73
+ name: 'canSupport',
74
+ type: 'boolean',
75
+ isNullable: true,
76
+ },
72
77
  {
73
78
  name: 'createdBy',
74
79
  type: 'varchar',
@@ -22,6 +22,7 @@ export class CreateProfileModuleTable1751576312683 implements MigrationInterface
22
22
  { name: 'canAssign', type: 'boolean', isNullable: true },
23
23
  { name: 'canReview', type: 'boolean', isNullable: true },
24
24
  { name: 'canDownload', type: 'boolean', isNullable: true },
25
+ { name: 'canSupport', type: 'boolean', isNullable: true },
25
26
  { name: 'canUpload', type: 'boolean', isNullable: true },
26
27
  { name: 'createdBy', type: 'varchar', isNullable: true },
27
28
  { name: 'createdAt', type: 'timestamptz', default: 'now()' },
@@ -15,6 +15,8 @@ class DateService {
15
15
  if (DateTime.fromFormat(inp, format).isValid) {
16
16
  return DateTime.fromFormat(inp, format).toJSDate();
17
17
  }
18
+
19
+ return DateTime.local().toJSDate();
18
20
  }
19
21
 
20
22
  public toFormat (inp: Date | string, format = DATE.SYSTEM.COMMON_DATE): string {
@@ -141,11 +143,11 @@ class DateService {
141
143
  return months;
142
144
  }
143
145
 
144
- public isSameDay (inp: Date, compare = this.getCurrentDate()): boolean {
145
- const date = DateTime.fromJSDate(inp).startOf('day');
146
- const compareDate = DateTime.fromJSDate(compare).startOf('day');
146
+ public isSameDay (inp: Date | string, compare = this.getCurrentDate()): boolean {
147
+ const startDate = DateTime.fromJSDate(this.toDate(inp)).startOf('day');
148
+ const endDate = DateTime.fromJSDate(this.toDate(compare)).startOf('day');
147
149
 
148
- return date.equals(compareDate);
150
+ return startDate.equals(endDate);
149
151
  }
150
152
 
151
153
  public isToday (date: Date): boolean {