@flusys/nestjs-notification 5.1.3 → 5.2.0

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.
@@ -81,6 +81,24 @@ let NotificationService = class NotificationService extends _classes.ApiService
81
81
  }
82
82
  return merged;
83
83
  }
84
+ async getSelectQuery(query, _user, select) {
85
+ const fields = select && select.length ? select : [];
86
+ const always = [
87
+ 'createdAt',
88
+ 'updatedAt'
89
+ ];
90
+ const merged = [
91
+ ...new Set([
92
+ ...fields,
93
+ ...always
94
+ ])
95
+ ];
96
+ query.addSelect(merged.map((f)=>`${this.entityName}.${f}`));
97
+ return {
98
+ query,
99
+ isRaw: false
100
+ };
101
+ }
84
102
  async getFilterQuery(query, filter, _user) {
85
103
  for (const [key, value] of Object.entries(filter)){
86
104
  if (key === 'isRead' && typeof value === 'boolean') {
@@ -26,7 +26,7 @@ function _ts_param(paramIndex, decorator) {
26
26
  };
27
27
  }
28
28
  import { LogAction } from '@flusys/nestjs-shared';
29
- import { HybridCache, ApiService } from '@flusys/nestjs-shared/classes';
29
+ import { ApiService, HybridCache } from '@flusys/nestjs-shared/classes';
30
30
  import { ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
31
31
  import { UtilsService } from '@flusys/nestjs-shared/modules';
32
32
  import { applyCompanyFilter } from '@flusys/nestjs-shared/utils';
@@ -71,6 +71,24 @@ export class NotificationService extends ApiService {
71
71
  }
72
72
  return merged;
73
73
  }
74
+ async getSelectQuery(query, _user, select) {
75
+ const fields = select && select.length ? select : [];
76
+ const always = [
77
+ 'createdAt',
78
+ 'updatedAt'
79
+ ];
80
+ const merged = [
81
+ ...new Set([
82
+ ...fields,
83
+ ...always
84
+ ])
85
+ ];
86
+ query.addSelect(merged.map((f)=>`${this.entityName}.${f}`));
87
+ return {
88
+ query,
89
+ isRaw: false
90
+ };
91
+ }
74
92
  async getFilterQuery(query, filter, _user) {
75
93
  for (const [key, value] of Object.entries(filter)){
76
94
  if (key === 'isRead' && typeof value === 'boolean') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flusys/nestjs-notification",
3
- "version": "5.1.3",
3
+ "version": "5.2.0",
4
4
  "description": "Notification module with real-time Socket.IO support",
5
5
  "main": "cjs/index.js",
6
6
  "module": "fesm/index.js",
@@ -92,8 +92,8 @@
92
92
  "express": "^4.18.0 || ^5.0.0"
93
93
  },
94
94
  "dependencies": {
95
- "@flusys/nestjs-core": "5.1.3",
96
- "@flusys/nestjs-shared": "5.1.3",
95
+ "@flusys/nestjs-core": "5.2.0",
96
+ "@flusys/nestjs-shared": "5.2.0",
97
97
  "jsonwebtoken": "^9.0.0"
98
98
  }
99
99
  }
@@ -1,4 +1,4 @@
1
- import { HybridCache, ApiService } from '@flusys/nestjs-shared/classes';
1
+ import { ApiService, HybridCache } from '@flusys/nestjs-shared/classes';
2
2
  import { ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
3
3
  import { UtilsService } from '@flusys/nestjs-shared/modules';
4
4
  import { EntityTarget, QueryRunner, SelectQueryBuilder } from 'typeorm';
@@ -16,6 +16,10 @@ export declare class NotificationService extends ApiService<CreateNotificationDt
16
16
  constructor(cacheManager: HybridCache, utilsService: UtilsService, notificationConfig: NotificationConfigService, dataSourceProvider: NotificationDataSourceProvider, gateway?: NotificationGateway | undefined);
17
17
  protected resolveEntity(): EntityTarget<NotificationBase>;
18
18
  convertSingleDtoToEntity(dto: CreateNotificationDto | UpdateNotificationDto, user: ILoggedUserInfo | null): Promise<NotificationBase>;
19
+ protected getSelectQuery(query: SelectQueryBuilder<NotificationBase>, _user: ILoggedUserInfo | null, select?: string[]): Promise<{
20
+ query: SelectQueryBuilder<NotificationBase>;
21
+ isRaw: boolean;
22
+ }>;
19
23
  protected getFilterQuery(query: SelectQueryBuilder<NotificationBase>, filter: Record<string, unknown>, _user: ILoggedUserInfo | null): Promise<{
20
24
  query: SelectQueryBuilder<NotificationBase>;
21
25
  isRaw: boolean;