@flusys/nestjs-auth 5.0.0 → 5.0.1
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.
- package/cjs/entities/company-branch.entity.js +1 -1
- package/cjs/entities/company.entity.js +2 -2
- package/cjs/entities/pending-registration.entity.js +3 -2
- package/cjs/services/user.service.js +4 -4
- package/fesm/entities/company-branch.entity.js +2 -2
- package/fesm/entities/company.entity.js +3 -3
- package/fesm/entities/pending-registration.entity.js +3 -2
- package/fesm/services/user.service.js +4 -4
- package/package.json +4 -4
|
@@ -123,14 +123,14 @@ _ts_decorate([
|
|
|
123
123
|
], Company.prototype, "isActive", void 0);
|
|
124
124
|
_ts_decorate([
|
|
125
125
|
(0, _typeorm.Column)({
|
|
126
|
-
type:
|
|
126
|
+
type: (0, _nestjsshared.getJsonColumnType)(),
|
|
127
127
|
nullable: true
|
|
128
128
|
}),
|
|
129
129
|
_ts_metadata("design:type", Object)
|
|
130
130
|
], Company.prototype, "settings", void 0);
|
|
131
131
|
_ts_decorate([
|
|
132
132
|
(0, _typeorm.Column)({
|
|
133
|
-
type:
|
|
133
|
+
type: (0, _nestjsshared.getJsonColumnType)(),
|
|
134
134
|
nullable: true
|
|
135
135
|
}),
|
|
136
136
|
_ts_metadata("design:type", Object)
|
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "PendingRegistration", {
|
|
|
8
8
|
return PendingRegistration;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
const _nestjsshared = require("@flusys/nestjs-shared");
|
|
11
12
|
const _typeorm = require("typeorm");
|
|
12
13
|
function _define_property(obj, key, value) {
|
|
13
14
|
if (key in obj) {
|
|
@@ -95,7 +96,7 @@ _ts_decorate([
|
|
|
95
96
|
], PendingRegistration.prototype, "expiresAt", void 0);
|
|
96
97
|
_ts_decorate([
|
|
97
98
|
(0, _typeorm.Column)({
|
|
98
|
-
type:
|
|
99
|
+
type: (0, _nestjsshared.getJsonColumnType)(),
|
|
99
100
|
nullable: true,
|
|
100
101
|
name: 'company_data'
|
|
101
102
|
}),
|
|
@@ -103,7 +104,7 @@ _ts_decorate([
|
|
|
103
104
|
], PendingRegistration.prototype, "companyData", void 0);
|
|
104
105
|
_ts_decorate([
|
|
105
106
|
(0, _typeorm.Column)({
|
|
106
|
-
type:
|
|
107
|
+
type: (0, _nestjsshared.getJsonColumnType)(),
|
|
107
108
|
nullable: true,
|
|
108
109
|
name: 'additional_fields'
|
|
109
110
|
}),
|
|
@@ -244,7 +244,7 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
|
|
|
244
244
|
return entities.map((entity)=>this.convertEntityToResponseDto(entity, isRaw));
|
|
245
245
|
}
|
|
246
246
|
async getGlobalSearchQuery(query, search, _user) {
|
|
247
|
-
query.andWhere('(user.name LIKE :search OR user.email LIKE :search OR user.phone LIKE :search)', {
|
|
247
|
+
query.andWhere('("user".name LIKE :search OR "user".email LIKE :search OR "user".phone LIKE :search)', {
|
|
248
248
|
search: `%${search}%`
|
|
249
249
|
});
|
|
250
250
|
return {
|
|
@@ -263,7 +263,7 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
|
|
|
263
263
|
}
|
|
264
264
|
if (user?.companyId && this.permissionRepository) {
|
|
265
265
|
query.addSelect(`(SELECT perm.is_active FROM user_company_permissions perm
|
|
266
|
-
WHERE perm.user_id = user.id
|
|
266
|
+
WHERE perm.user_id = "user".id
|
|
267
267
|
AND perm.permission_type = :permissionType
|
|
268
268
|
AND perm.target_id = :companyId
|
|
269
269
|
LIMIT 1)`, 'user_companyIsActive');
|
|
@@ -272,7 +272,7 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
|
|
|
272
272
|
if (filterAndPaginationDto.filter?.isActive !== undefined) {
|
|
273
273
|
query.andWhere(`EXISTS (
|
|
274
274
|
SELECT 1 FROM user_company_permissions perm
|
|
275
|
-
WHERE perm.user_id = user.id
|
|
275
|
+
WHERE perm.user_id = "user".id
|
|
276
276
|
AND perm.permission_type = :permissionType
|
|
277
277
|
AND perm.target_id = :companyId
|
|
278
278
|
AND perm.is_active = :isActiveValue
|
|
@@ -284,7 +284,7 @@ let UserService = class UserService extends _classes.RequestScopedApiService {
|
|
|
284
284
|
}
|
|
285
285
|
query.andWhere(`EXISTS (
|
|
286
286
|
SELECT 1 FROM user_company_permissions perm
|
|
287
|
-
WHERE perm.user_id = user.id
|
|
287
|
+
WHERE perm.user_id = "user".id
|
|
288
288
|
AND perm.permission_type = :permissionType
|
|
289
289
|
AND perm.target_id = :companyId
|
|
290
290
|
)`, {
|
|
@@ -20,7 +20,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
20
20
|
function _ts_metadata(k, v) {
|
|
21
21
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
22
|
}
|
|
23
|
-
import { Identity } from '@flusys/nestjs-shared';
|
|
23
|
+
import { getJsonColumnType, Identity } from '@flusys/nestjs-shared';
|
|
24
24
|
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, Unique } from 'typeorm';
|
|
25
25
|
import { Company } from './company.entity';
|
|
26
26
|
export class CompanyBranch extends Identity {
|
|
@@ -99,7 +99,7 @@ _ts_decorate([
|
|
|
99
99
|
], CompanyBranch.prototype, "isActive", void 0);
|
|
100
100
|
_ts_decorate([
|
|
101
101
|
Column({
|
|
102
|
-
type:
|
|
102
|
+
type: getJsonColumnType(),
|
|
103
103
|
nullable: true
|
|
104
104
|
}),
|
|
105
105
|
_ts_metadata("design:type", Object)
|
|
@@ -20,7 +20,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
20
20
|
function _ts_metadata(k, v) {
|
|
21
21
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
22
|
}
|
|
23
|
-
import { Identity } from '@flusys/nestjs-shared';
|
|
23
|
+
import { getJsonColumnType, Identity } from '@flusys/nestjs-shared';
|
|
24
24
|
import { Column, Entity, OneToMany } from 'typeorm';
|
|
25
25
|
import { CompanyBranch } from './company-branch.entity';
|
|
26
26
|
export class Company extends Identity {
|
|
@@ -113,14 +113,14 @@ _ts_decorate([
|
|
|
113
113
|
], Company.prototype, "isActive", void 0);
|
|
114
114
|
_ts_decorate([
|
|
115
115
|
Column({
|
|
116
|
-
type:
|
|
116
|
+
type: getJsonColumnType(),
|
|
117
117
|
nullable: true
|
|
118
118
|
}),
|
|
119
119
|
_ts_metadata("design:type", Object)
|
|
120
120
|
], Company.prototype, "settings", void 0);
|
|
121
121
|
_ts_decorate([
|
|
122
122
|
Column({
|
|
123
|
-
type:
|
|
123
|
+
type: getJsonColumnType(),
|
|
124
124
|
nullable: true
|
|
125
125
|
}),
|
|
126
126
|
_ts_metadata("design:type", Object)
|
|
@@ -20,6 +20,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
20
20
|
function _ts_metadata(k, v) {
|
|
21
21
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
22
|
}
|
|
23
|
+
import { getJsonColumnType } from '@flusys/nestjs-shared';
|
|
23
24
|
import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';
|
|
24
25
|
export class PendingRegistration {
|
|
25
26
|
constructor(){
|
|
@@ -85,7 +86,7 @@ _ts_decorate([
|
|
|
85
86
|
], PendingRegistration.prototype, "expiresAt", void 0);
|
|
86
87
|
_ts_decorate([
|
|
87
88
|
Column({
|
|
88
|
-
type:
|
|
89
|
+
type: getJsonColumnType(),
|
|
89
90
|
nullable: true,
|
|
90
91
|
name: 'company_data'
|
|
91
92
|
}),
|
|
@@ -93,7 +94,7 @@ _ts_decorate([
|
|
|
93
94
|
], PendingRegistration.prototype, "companyData", void 0);
|
|
94
95
|
_ts_decorate([
|
|
95
96
|
Column({
|
|
96
|
-
type:
|
|
97
|
+
type: getJsonColumnType(),
|
|
97
98
|
nullable: true,
|
|
98
99
|
name: 'additional_fields'
|
|
99
100
|
}),
|
|
@@ -193,7 +193,7 @@ export class UserService extends RequestScopedApiService {
|
|
|
193
193
|
return entities.map((entity)=>this.convertEntityToResponseDto(entity, isRaw));
|
|
194
194
|
}
|
|
195
195
|
async getGlobalSearchQuery(query, search, _user) {
|
|
196
|
-
query.andWhere('(user.name LIKE :search OR user.email LIKE :search OR user.phone LIKE :search)', {
|
|
196
|
+
query.andWhere('("user".name LIKE :search OR "user".email LIKE :search OR "user".phone LIKE :search)', {
|
|
197
197
|
search: `%${search}%`
|
|
198
198
|
});
|
|
199
199
|
return {
|
|
@@ -212,7 +212,7 @@ export class UserService extends RequestScopedApiService {
|
|
|
212
212
|
}
|
|
213
213
|
if (user?.companyId && this.permissionRepository) {
|
|
214
214
|
query.addSelect(`(SELECT perm.is_active FROM user_company_permissions perm
|
|
215
|
-
WHERE perm.user_id = user.id
|
|
215
|
+
WHERE perm.user_id = "user".id
|
|
216
216
|
AND perm.permission_type = :permissionType
|
|
217
217
|
AND perm.target_id = :companyId
|
|
218
218
|
LIMIT 1)`, 'user_companyIsActive');
|
|
@@ -221,7 +221,7 @@ export class UserService extends RequestScopedApiService {
|
|
|
221
221
|
if (filterAndPaginationDto.filter?.isActive !== undefined) {
|
|
222
222
|
query.andWhere(`EXISTS (
|
|
223
223
|
SELECT 1 FROM user_company_permissions perm
|
|
224
|
-
WHERE perm.user_id = user.id
|
|
224
|
+
WHERE perm.user_id = "user".id
|
|
225
225
|
AND perm.permission_type = :permissionType
|
|
226
226
|
AND perm.target_id = :companyId
|
|
227
227
|
AND perm.is_active = :isActiveValue
|
|
@@ -233,7 +233,7 @@ export class UserService extends RequestScopedApiService {
|
|
|
233
233
|
}
|
|
234
234
|
query.andWhere(`EXISTS (
|
|
235
235
|
SELECT 1 FROM user_company_permissions perm
|
|
236
|
-
WHERE perm.user_id = user.id
|
|
236
|
+
WHERE perm.user_id = "user".id
|
|
237
237
|
AND perm.permission_type = :permissionType
|
|
238
238
|
AND perm.target_id = :companyId
|
|
239
239
|
)`, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flusys/nestjs-auth",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Authentication and authorization infrastructure for NestJS applications",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "fesm/index.js",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@nestjs/passport": "^10.0.0 || ^11.0.0",
|
|
82
82
|
"@nestjs/swagger": "^7.0.0 || ^11.0.0",
|
|
83
83
|
"@nestjs/typeorm": "^10.0.0 || ^11.0.0",
|
|
84
|
-
"bcrypt": "^5.0.
|
|
84
|
+
"bcrypt": "^5.0.1 || ^6.0.0",
|
|
85
85
|
"class-transformer": "^0.5.0",
|
|
86
86
|
"class-validator": "^0.14.0",
|
|
87
87
|
"nodemailer": "^7.0.0",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"rxjs": "^7.8.0"
|
|
94
94
|
},
|
|
95
95
|
"dependencies": {
|
|
96
|
-
"@flusys/nestjs-core": "5.0.
|
|
97
|
-
"@flusys/nestjs-shared": "5.0.
|
|
96
|
+
"@flusys/nestjs-core": "5.0.1",
|
|
97
|
+
"@flusys/nestjs-shared": "5.0.1"
|
|
98
98
|
}
|
|
99
99
|
}
|