@lenne.tech/nest-server 11.2.0 → 11.4.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.
Files changed (73) hide show
  1. package/bin/migrate.js +40 -0
  2. package/dist/core/common/decorators/unified-field.decorator.d.ts +2 -0
  3. package/dist/core/common/decorators/unified-field.decorator.js +26 -9
  4. package/dist/core/common/decorators/unified-field.decorator.js.map +1 -1
  5. package/dist/core/common/models/core-persistence.model.js +2 -2
  6. package/dist/core/common/models/core-persistence.model.js.map +1 -1
  7. package/dist/core/modules/file/core-file-info.model.js +41 -23
  8. package/dist/core/modules/file/core-file-info.model.js.map +1 -1
  9. package/dist/core/modules/migrate/cli/migrate-cli.d.ts +3 -0
  10. package/dist/core/modules/migrate/cli/migrate-cli.js +221 -0
  11. package/dist/core/modules/migrate/cli/migrate-cli.js.map +1 -0
  12. package/dist/core/modules/migrate/helpers/migration.helper.d.ts +12 -0
  13. package/dist/core/modules/migrate/helpers/migration.helper.js +57 -0
  14. package/dist/core/modules/migrate/helpers/migration.helper.js.map +1 -0
  15. package/dist/core/modules/migrate/helpers/ts-compiler.d.ts +2 -0
  16. package/dist/core/modules/migrate/helpers/ts-compiler.js +3 -0
  17. package/dist/core/modules/migrate/helpers/ts-compiler.js.map +1 -0
  18. package/dist/core/modules/migrate/index.d.ts +4 -0
  19. package/dist/core/modules/migrate/index.js +21 -0
  20. package/dist/core/modules/migrate/index.js.map +1 -0
  21. package/dist/core/modules/migrate/migration-runner.d.ts +26 -0
  22. package/dist/core/modules/migrate/migration-runner.js +124 -0
  23. package/dist/core/modules/migrate/migration-runner.js.map +1 -0
  24. package/dist/core/modules/migrate/mongo-state-store.d.ts +30 -0
  25. package/dist/core/modules/migrate/mongo-state-store.js +105 -0
  26. package/dist/core/modules/migrate/mongo-state-store.js.map +1 -0
  27. package/dist/core/modules/migrate/templates/migration-with-helper.template.d.ts +2 -0
  28. package/dist/core/modules/migrate/templates/migration-with-helper.template.js +10 -0
  29. package/dist/core/modules/migrate/templates/migration-with-helper.template.js.map +1 -0
  30. package/dist/core/modules/migrate/templates/migration.template.d.ts +2 -0
  31. package/dist/core/modules/migrate/templates/migration.template.js +15 -0
  32. package/dist/core/modules/migrate/templates/migration.template.js.map +1 -0
  33. package/dist/core/modules/user/core-user.model.js +95 -54
  34. package/dist/core/modules/user/core-user.model.js.map +1 -1
  35. package/dist/index.d.ts +1 -0
  36. package/dist/index.js +1 -0
  37. package/dist/index.js.map +1 -1
  38. package/dist/main.js +22 -0
  39. package/dist/main.js.map +1 -1
  40. package/dist/server/common/models/persistence.model.js +13 -11
  41. package/dist/server/common/models/persistence.model.js.map +1 -1
  42. package/dist/server/modules/auth/auth.model.js +6 -2
  43. package/dist/server/modules/auth/auth.model.js.map +1 -1
  44. package/dist/server/modules/user/user.controller.d.ts +19 -0
  45. package/dist/server/modules/user/user.controller.js +256 -0
  46. package/dist/server/modules/user/user.controller.js.map +1 -0
  47. package/dist/server/modules/user/user.model.js +37 -24
  48. package/dist/server/modules/user/user.model.js.map +1 -1
  49. package/dist/server/modules/user/user.module.js +2 -1
  50. package/dist/server/modules/user/user.module.js.map +1 -1
  51. package/dist/tsconfig.build.tsbuildinfo +1 -1
  52. package/package.json +33 -29
  53. package/src/core/common/decorators/unified-field.decorator.ts +49 -10
  54. package/src/core/common/models/core-persistence.model.ts +3 -3
  55. package/src/core/modules/file/core-file-info.model.ts +40 -22
  56. package/src/core/modules/migrate/MIGRATION_FROM_NODEPIT.md +219 -0
  57. package/src/core/modules/migrate/README.md +452 -0
  58. package/src/core/modules/migrate/cli/migrate-cli.ts +319 -0
  59. package/src/core/modules/migrate/helpers/migration.helper.ts +117 -0
  60. package/src/core/modules/migrate/helpers/ts-compiler.js +14 -0
  61. package/src/core/modules/migrate/index.ts +41 -0
  62. package/src/core/modules/migrate/migration-runner.ts +230 -0
  63. package/src/core/modules/migrate/mongo-state-store.ts +283 -0
  64. package/src/core/modules/migrate/templates/migration-with-helper.template.ts +72 -0
  65. package/src/core/modules/migrate/templates/migration.template.ts +59 -0
  66. package/src/core/modules/user/core-user.model.ts +120 -78
  67. package/src/index.ts +9 -3
  68. package/src/main.ts +25 -0
  69. package/src/server/common/models/persistence.model.ts +15 -13
  70. package/src/server/modules/auth/auth.model.ts +7 -3
  71. package/src/server/modules/user/user.controller.ts +242 -0
  72. package/src/server/modules/user/user.model.ts +39 -26
  73. package/src/server/modules/user/user.module.ts +2 -1
@@ -1,10 +1,10 @@
1
- import { Field, ObjectType } from '@nestjs/graphql';
1
+ import { ObjectType } from '@nestjs/graphql';
2
2
  import { Schema as MongooseSchema, Prop, raw } from '@nestjs/mongoose';
3
3
  import { ApiExtraModels, ApiProperty } from '@nestjs/swagger';
4
- import { IsOptional } from 'class-validator';
5
4
  import { Document } from 'mongoose';
6
5
 
7
6
  import { Restricted } from '../../common/decorators/restricted.decorator';
7
+ import { UnifiedField } from '../../common/decorators/unified-field.decorator';
8
8
  import { RoleEnum } from '../../common/enums/role.enum';
9
9
  import { CorePersistenceModel } from '../../common/models/core-persistence.model';
10
10
  import { CoreTokenData } from '../auth/interfaces/core-token-data.interface';
@@ -26,67 +26,78 @@ export abstract class CoreUserModel extends CorePersistenceModel {
26
26
  /**
27
27
  * E-Mail address of the user
28
28
  */
29
- @ApiProperty()
30
- @Field({ description: 'Email of the user', nullable: true })
31
- @Prop({ index: true, lowercase: true, trim: true })
32
- @Restricted(RoleEnum.S_EVERYONE)
29
+ @UnifiedField({
30
+ description: 'Email of the user',
31
+ isOptional: true,
32
+ mongoose: { index: true, lowercase: true, trim: true },
33
+ roles: RoleEnum.S_EVERYONE,
34
+ })
33
35
  email: string = undefined;
34
36
 
35
37
  /**
36
38
  * First name of the user
37
39
  */
38
- @ApiProperty()
39
- @Field({ description: 'First name of the user', nullable: true })
40
- @IsOptional()
41
- @Prop()
42
- @Restricted(RoleEnum.S_EVERYONE)
40
+ @UnifiedField({
41
+ description: 'First name of the user',
42
+ isOptional: true,
43
+ mongoose: true,
44
+ roles: RoleEnum.S_EVERYONE,
45
+ })
43
46
  firstName: string = undefined;
44
47
 
45
48
  /**
46
49
  * Last name of the user
47
50
  */
48
- @ApiProperty()
49
- @Field({ description: 'Last name of the user', nullable: true })
50
- @IsOptional()
51
- @Prop()
52
- @Restricted(RoleEnum.S_EVERYONE)
51
+ @UnifiedField({
52
+ description: 'Last name of the user',
53
+ isOptional: true,
54
+ mongoose: true,
55
+ roles: RoleEnum.S_EVERYONE,
56
+ })
53
57
  lastName: string = undefined;
54
58
 
55
59
  /**
56
60
  * Password of the user
57
61
  */
58
- @ApiProperty()
59
- @Prop()
60
- @Restricted(RoleEnum.S_NO_ONE)
62
+ @UnifiedField({
63
+ isOptional: true,
64
+ mongoose: true,
65
+ roles: RoleEnum.S_NO_ONE,
66
+ })
61
67
  password: string = undefined;
62
68
 
63
69
  /**
64
70
  * Roles of the user
65
71
  */
66
- @ApiProperty()
67
- @Field(() => [String], { description: 'Roles of the user', nullable: true })
68
- @IsOptional()
69
- @Prop([String])
70
- @Restricted(RoleEnum.S_EVERYONE)
72
+ @UnifiedField({
73
+ description: 'Roles of the user',
74
+ isArray: true,
75
+ isOptional: true,
76
+ mongoose: [String],
77
+ roles: RoleEnum.S_EVERYONE,
78
+ type: () => String,
79
+ })
71
80
  roles: string[] = undefined;
72
81
 
73
82
  /**
74
83
  * Username of the user
75
84
  */
76
- @ApiProperty()
77
- @Field({ description: 'Username of the user', nullable: true })
78
- @IsOptional()
79
- @Prop()
80
- @Restricted(RoleEnum.S_EVERYONE)
85
+ @UnifiedField({
86
+ description: 'Username of the user',
87
+ isOptional: true,
88
+ mongoose: true,
89
+ roles: RoleEnum.S_EVERYONE,
90
+ })
81
91
  username: string = undefined;
82
92
 
83
93
  /**
84
94
  * Password reset token of the user
85
95
  */
86
- @ApiProperty()
87
- @IsOptional()
88
- @Prop()
89
- @Restricted(RoleEnum.S_NO_ONE)
96
+ @UnifiedField({
97
+ isOptional: true,
98
+ mongoose: true,
99
+ roles: RoleEnum.S_NO_ONE,
100
+ })
90
101
  passwordResetToken: string = undefined;
91
102
 
92
103
  /**
@@ -96,30 +107,41 @@ export abstract class CoreUserModel extends CorePersistenceModel {
96
107
  */
97
108
  @ApiProperty({ isArray: true })
98
109
  @ApiProperty({
99
- additionalProperties: {
110
+ additionalProperties: {
100
111
  properties: {
101
- deviceDescription: { description: 'Description of the device from which the token was generated', nullable: true, type: 'string' },
102
- deviceId: { description: 'ID of the device from which the token was generated', nullable: true, type: 'string' },
103
- tokenId: { description: 'Token ID to make sure that there is only one RefreshToken for each device', nullable: false, type: 'string' },
112
+ deviceDescription: {
113
+ description: 'Description of the device from which the token was generated',
114
+ nullable: true,
115
+ type: 'string',
116
+ },
117
+ deviceId: {
118
+ description: 'ID of the device from which the token was generated',
119
+ nullable: true,
120
+ type: 'string',
121
+ },
122
+ tokenId: {
123
+ description: 'Token ID to make sure that there is only one RefreshToken for each device',
124
+ nullable: false,
125
+ type: 'string',
126
+ },
104
127
  },
105
128
  type: 'object',
106
129
  },
107
130
  description: 'Refresh tokens for devices (key: Token, value: TokenData)',
108
131
  example: {
109
- '49b5c7d6-94ae-4efe-b377-9b50d1a9c2cb': {
110
- deviceDescription: null,
111
- deviceId: '49b5c7d6-94ae-4efe-b377-9b50d1a9c2cb',
112
- tokenId: '50937407-4282-480e-8679-14ecc113f9c7',
113
- },
114
- 'e9e60a3e-2004-479f-8e79-13a0d1981d76': {
115
- deviceDescription: null,
116
- deviceId: 'e9e60a3e-2004-479f-8e79-13a0d1981d76',
117
- tokenId: '0604aa59-4fc8-4848-9fe7-c12d9cdf6ec0',
118
- },
132
+ '49b5c7d6-94ae-4efe-b377-9b50d1a9c2cb': {
133
+ deviceDescription: null,
134
+ deviceId: '49b5c7d6-94ae-4efe-b377-9b50d1a9c2cb',
135
+ tokenId: '50937407-4282-480e-8679-14ecc113f9c7',
136
+ },
137
+ 'e9e60a3e-2004-479f-8e79-13a0d1981d76': {
138
+ deviceDescription: null,
139
+ deviceId: 'e9e60a3e-2004-479f-8e79-13a0d1981d76',
140
+ tokenId: '0604aa59-4fc8-4848-9fe7-c12d9cdf6ec0',
119
141
  },
142
+ },
120
143
  type: 'object',
121
144
  })
122
- @IsOptional()
123
145
  @Prop(raw({}))
124
146
  @Restricted(RoleEnum.S_NO_ONE)
125
147
  refreshTokens: Record<string, CoreTokenData> = undefined;
@@ -130,30 +152,44 @@ export abstract class CoreUserModel extends CorePersistenceModel {
130
152
  */
131
153
  @ApiProperty()
132
154
  @ApiProperty({
133
- additionalProperties: {
155
+ additionalProperties: {
134
156
  properties: {
135
- createdAt: { description: 'Token Created At', example: 1740037703939, format: 'int64', nullable: true, type: 'number' },
136
- deviceId: { description: 'ID of the device from which the token was generated', nullable: true, type: 'string' },
137
- tokenId: { description: 'Token ID to make sure that there is only one RefreshToken for each device', nullable: false, type: 'string' },
157
+ createdAt: {
158
+ description: 'Token Created At',
159
+ example: 1740037703939,
160
+ format: 'int64',
161
+ nullable: true,
162
+ type: 'number',
163
+ },
164
+ deviceId: {
165
+ description: 'ID of the device from which the token was generated',
166
+ nullable: true,
167
+ type: 'string',
168
+ },
169
+ tokenId: {
170
+ description: 'Token ID to make sure that there is only one RefreshToken for each device',
171
+ nullable: false,
172
+ type: 'string',
173
+ },
138
174
  },
139
175
  type: 'object',
140
176
  },
141
177
  description: 'Temporary token for parallel requests during the token refresh process',
142
- example: { // 👈 Add explicit example keys
143
- '49b5c7d6-94ae-4efe-b377-9b50d1a9c2cb': {
144
- createdAt: 1740037703939,
145
- deviceId: '49b5c7d6-94ae-4efe-b377-9b50d1a9c2cb',
146
- tokenId: '50937407-4282-480e-8679-14ecc113f9c7',
147
- },
148
- 'f83ae5f6-90bf-4b4e-b318-651e0eaa67ae': {
149
- createdAt: 1740037703940,
150
- deviceId: 'f83ae5f6-90bf-4b4e-b318-651e0eaa67ae',
151
- tokenId: '4f0dc3c5-e74e-41f4-9bd9-642869462c1e',
152
- },
178
+ example: {
179
+ // 👈 Add explicit example keys
180
+ '49b5c7d6-94ae-4efe-b377-9b50d1a9c2cb': {
181
+ createdAt: 1740037703939,
182
+ deviceId: '49b5c7d6-94ae-4efe-b377-9b50d1a9c2cb',
183
+ tokenId: '50937407-4282-480e-8679-14ecc113f9c7',
153
184
  },
185
+ 'f83ae5f6-90bf-4b4e-b318-651e0eaa67ae': {
186
+ createdAt: 1740037703940,
187
+ deviceId: 'f83ae5f6-90bf-4b4e-b318-651e0eaa67ae',
188
+ tokenId: '4f0dc3c5-e74e-41f4-9bd9-642869462c1e',
189
+ },
190
+ },
154
191
  type: 'object',
155
192
  })
156
- @IsOptional()
157
193
  @Prop(raw({}))
158
194
  @Restricted(RoleEnum.S_NO_ONE)
159
195
  tempTokens: Record<string, { createdAt: number; deviceId: string; tokenId: string }> = undefined;
@@ -161,28 +197,34 @@ export abstract class CoreUserModel extends CorePersistenceModel {
161
197
  /**
162
198
  * Verification token of the user
163
199
  */
164
- @ApiProperty()
165
- @IsOptional()
166
- @Prop()
167
- @Restricted(RoleEnum.S_NO_ONE)
200
+ @UnifiedField({
201
+ isOptional: true,
202
+ mongoose: true,
203
+ roles: RoleEnum.S_NO_ONE,
204
+ })
168
205
  verificationToken: string = undefined;
169
206
 
170
207
  /**
171
208
  * Verification of the user
172
209
  */
173
- @ApiProperty()
174
- @Field(() => Boolean, { description: 'Verification state of the user', nullable: true })
175
- @Prop({ type: Boolean })
176
- @Restricted(RoleEnum.S_EVERYONE)
210
+ @UnifiedField({
211
+ description: 'Verification state of the user',
212
+ isOptional: true,
213
+ mongoose: { type: Boolean },
214
+ roles: RoleEnum.S_EVERYONE,
215
+ type: () => Boolean,
216
+ })
177
217
  verified: boolean = undefined;
178
218
 
179
219
  /**
180
220
  * Verification date
181
221
  */
182
- @ApiProperty()
183
- @Field({ description: 'Verified date', nullable: true })
184
- @Prop()
185
- @Restricted(RoleEnum.S_EVERYONE)
222
+ @UnifiedField({
223
+ description: 'Verified date',
224
+ isOptional: true,
225
+ mongoose: true,
226
+ roles: RoleEnum.S_EVERYONE,
227
+ })
186
228
  verifiedAt: Date = undefined;
187
229
 
188
230
  // ===================================================================================================================
@@ -199,7 +241,7 @@ export abstract class CoreUserModel extends CorePersistenceModel {
199
241
  if (!this.roles || this.roles.length < 1) {
200
242
  return false;
201
243
  }
202
- return !roles || roles.length < 1 ? true : this.roles.some(role => roles.includes(role));
244
+ return !roles || roles.length < 1 ? true : this.roles.some((role) => roles.includes(role));
203
245
  }
204
246
 
205
247
  /**
@@ -212,7 +254,7 @@ export abstract class CoreUserModel extends CorePersistenceModel {
212
254
  if (!this.roles || this.roles.length < 1) {
213
255
  return false;
214
256
  }
215
- return !roles ? true : roles.every(role => this.roles.includes(role));
257
+ return !roles ? true : roles.every((role) => this.roles.includes(role));
216
258
  }
217
259
 
218
260
  /**
package/src/index.ts CHANGED
@@ -132,19 +132,25 @@ export * from './core/modules/file/interfaces/file-service-options.interface';
132
132
  export * from './core/modules/file/interfaces/file-upload.interface';
133
133
 
134
134
  // =====================================================================================================================
135
- // Core - Modules - User
135
+ // Core - Modules - HealthCheck
136
136
  // =====================================================================================================================
137
137
 
138
138
  export * from './core/modules/health-check/core-health-check-result.model';
139
139
  export * from './core/modules/health-check/core-health-check.controller';
140
140
  export * from './core/modules/health-check/core-health-check.module';
141
141
  export * from './core/modules/health-check/core-health-check.resolver';
142
+ export * from './core/modules/health-check/core-health-check.service';
142
143
 
143
144
  // =====================================================================================================================
144
- // Core - Modules - HealthCheck
145
+ // Core - Modules - Migrate
146
+ // =====================================================================================================================
147
+
148
+ export * from './core/modules/migrate';
149
+
150
+ // =====================================================================================================================
151
+ // Core - Modules - User
145
152
  // =====================================================================================================================
146
153
 
147
- export * from './core/modules/health-check/core-health-check.service';
148
154
  export * from './core/modules/user/core-user.model';
149
155
  export * from './core/modules/user/core-user.service';
150
156
  export * from './core/modules/user/inputs/core-user-create.input';
package/src/main.ts CHANGED
@@ -1,11 +1,19 @@
1
1
  import { NestFactory } from '@nestjs/core';
2
2
  import { NestExpressApplication } from '@nestjs/platform-express';
3
+ import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
3
4
  import { exec } from 'child_process';
4
5
  import compression = require('compression');
5
6
  import cookieParser = require('cookie-parser');
6
7
 
7
8
  import envConfig from './config.env';
9
+ import { FilterArgs } from './core/common/args/filter.args';
8
10
  import { HttpExceptionLogFilter } from './core/common/filters/http-exception-log.filter';
11
+ import { CorePersistenceModel } from './core/common/models/core-persistence.model';
12
+ import { CoreAuthModel } from './core/modules/auth/core-auth.model';
13
+ import { CoreUserModel } from './core/modules/user/core-user.model';
14
+ import { PersistenceModel } from './server/common/models/persistence.model';
15
+ import { Auth } from './server/modules/auth/auth.model';
16
+ import { User } from './server/modules/user/user.model';
9
17
  import { ServerModule } from './server/server.module';
10
18
 
11
19
  /**
@@ -54,6 +62,23 @@ async function bootstrap() {
54
62
  // Enable cors to allow requests from other domains
55
63
  server.enableCors();
56
64
 
65
+ // Swagger documentation
66
+ const config = new DocumentBuilder()
67
+ .setTitle('Nest Server API')
68
+ .setDescription('API lenne.Tech Nest Server')
69
+ .setVersion('1.0.0')
70
+ .addBearerAuth()
71
+ .build();
72
+ const documentFactory = () =>
73
+ SwaggerModule.createDocument(server, config, {
74
+ autoTagControllers: true,
75
+ deepScanRoutes: true,
76
+ extraModels: [CoreUserModel, CoreAuthModel, Auth, User, PersistenceModel, CorePersistenceModel, FilterArgs],
77
+ });
78
+ SwaggerModule.setup('swagger', server, documentFactory, {
79
+ jsonDocumentUrl: '/api-docs-json',
80
+ });
81
+
57
82
  // Start server on configured port
58
83
  await server.listen(envConfig.port, envConfig.hostname);
59
84
  console.debug(`Server startet at ${await server.getUrl()}`);
@@ -1,10 +1,10 @@
1
- import { Field, ObjectType } from '@nestjs/graphql';
2
- import { Prop } from '@nestjs/mongoose';
3
- import { ApiExtraModels, ApiProperty } from '@nestjs/swagger';
1
+ import { ObjectType } from '@nestjs/graphql';
2
+ import { ApiExtraModels } from '@nestjs/swagger';
4
3
  import { Types } from 'mongoose';
5
4
  import mongoose = require('mongoose');
6
5
 
7
6
  import { Restricted } from '../../../core/common/decorators/restricted.decorator';
7
+ import { UnifiedField } from '../../../core/common/decorators/unified-field.decorator';
8
8
  import { RoleEnum } from '../../../core/common/enums/role.enum';
9
9
  import { CorePersistenceModel } from '../../../core/common/models/core-persistence.model';
10
10
  import { User } from '../../modules/user/user.model';
@@ -30,13 +30,14 @@ export abstract class PersistenceModel extends CorePersistenceModel {
30
30
  *
31
31
  * Not set when created by system
32
32
  */
33
- @ApiProperty({ type: String })
34
- @Field(() => User, {
33
+ @UnifiedField({
35
34
  description: 'ID of the user who created the object',
36
- nullable: true,
35
+ isOptional: true,
36
+ mongoose: { ref: 'User', type: mongoose.Schema.Types.ObjectId },
37
+ roles: RoleEnum.ADMIN,
38
+ swaggerApiOptions: { type: String },
39
+ type: () => User,
37
40
  })
38
- @Prop({ ref: 'User', type: mongoose.Schema.Types.ObjectId })
39
- @Restricted(RoleEnum.ADMIN)
40
41
  createdBy?: string | Types.ObjectId = undefined;
41
42
 
42
43
  /**
@@ -44,13 +45,14 @@ export abstract class PersistenceModel extends CorePersistenceModel {
44
45
  *
45
46
  * Not set when updated by system
46
47
  */
47
- @ApiProperty({ type: User })
48
- @Field(() => User, {
48
+ @UnifiedField({
49
49
  description: 'ID of the user who updated the object',
50
- nullable: true,
50
+ isOptional: true,
51
+ mongoose: { ref: 'User', type: mongoose.Schema.Types.ObjectId },
52
+ roles: RoleEnum.ADMIN,
53
+ swaggerApiOptions: { type: User },
54
+ type: () => User,
51
55
  })
52
- @Prop({ ref: 'User', type: mongoose.Schema.Types.ObjectId })
53
- @Restricted(RoleEnum.ADMIN)
54
56
  updatedBy?: string | Types.ObjectId = undefined;
55
57
 
56
58
  // ===================================================================================================================
@@ -1,6 +1,7 @@
1
- import { Field, ObjectType } from '@nestjs/graphql';
1
+ import { ObjectType } from '@nestjs/graphql';
2
2
 
3
3
  import { Restricted } from '../../../core/common/decorators/restricted.decorator';
4
+ import { UnifiedField } from '../../../core/common/decorators/unified-field.decorator';
4
5
  import { RoleEnum } from '../../../core/common/enums/role.enum';
5
6
  import { mapClasses } from '../../../core/common/helpers/model.helper';
6
7
  import { CoreAuthModel } from '../../../core/modules/auth/core-auth.model';
@@ -19,8 +20,11 @@ export class Auth extends CoreAuthModel {
19
20
  /**
20
21
  * Signed-in user
21
22
  */
22
- @Field(() => User, { description: 'User who signed in' })
23
- @Restricted(RoleEnum.S_EVERYONE)
23
+ @UnifiedField({
24
+ description: 'User who signed in',
25
+ roles: RoleEnum.S_EVERYONE,
26
+ type: () => User,
27
+ })
24
28
  override user: User = undefined;
25
29
 
26
30
  // ===================================================================================================================