@lenne.tech/nest-server 10.2.16 → 10.3.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.
Files changed (101) hide show
  1. package/dist/core/common/helpers/context.helper.d.ts +1 -0
  2. package/dist/core/common/inputs/combined-filter.input.js +0 -5
  3. package/dist/core/common/inputs/combined-filter.input.js.map +1 -1
  4. package/dist/core/common/inputs/filter.input.js +0 -5
  5. package/dist/core/common/inputs/filter.input.js.map +1 -1
  6. package/dist/core/common/inputs/single-filter.input.js +0 -10
  7. package/dist/core/common/inputs/single-filter.input.js.map +1 -1
  8. package/dist/core/common/inputs/sort.input.js +0 -5
  9. package/dist/core/common/inputs/sort.input.js.map +1 -1
  10. package/dist/core/common/models/core-persistence.model.js +0 -1
  11. package/dist/core/common/models/core-persistence.model.js.map +1 -1
  12. package/dist/core/modules/auth/core-auth.controller.js +0 -7
  13. package/dist/core/modules/auth/core-auth.controller.js.map +1 -1
  14. package/dist/core/modules/auth/core-auth.model.js +0 -6
  15. package/dist/core/modules/auth/core-auth.model.js.map +1 -1
  16. package/dist/core/modules/auth/core-auth.resolver.js +0 -7
  17. package/dist/core/modules/auth/core-auth.resolver.js.map +1 -1
  18. package/dist/core/modules/auth/inputs/core-auth-sign-in.input.js +0 -7
  19. package/dist/core/modules/auth/inputs/core-auth-sign-in.input.js.map +1 -1
  20. package/dist/core/modules/auth/inputs/core-auth-sign-up.input.js +0 -3
  21. package/dist/core/modules/auth/inputs/core-auth-sign-up.input.js.map +1 -1
  22. package/dist/core/modules/auth/strategies/jwt-refresh.strategy.d.ts +1 -0
  23. package/dist/core/modules/file/core-file-info.model.js +0 -14
  24. package/dist/core/modules/file/core-file-info.model.js.map +1 -1
  25. package/dist/core/modules/file/core-file.controller.js +0 -4
  26. package/dist/core/modules/file/core-file.controller.js.map +1 -1
  27. package/dist/core/modules/file/core-file.resolver.js +0 -7
  28. package/dist/core/modules/file/core-file.resolver.js.map +1 -1
  29. package/dist/core/modules/health-check/core-health-check-result.model.js +0 -7
  30. package/dist/core/modules/health-check/core-health-check-result.model.js.map +1 -1
  31. package/dist/core/modules/health-check/core-health-check.controller.js +0 -4
  32. package/dist/core/modules/health-check/core-health-check.controller.js.map +1 -1
  33. package/dist/core/modules/user/core-user.model.js +0 -15
  34. package/dist/core/modules/user/core-user.model.js.map +1 -1
  35. package/dist/core/modules/user/inputs/core-user-create.input.js +0 -4
  36. package/dist/core/modules/user/inputs/core-user-create.input.js.map +1 -1
  37. package/dist/core/modules/user/inputs/core-user.input.js +0 -6
  38. package/dist/core/modules/user/inputs/core-user.input.js.map +1 -1
  39. package/dist/server/common/models/persistence.model.js +0 -5
  40. package/dist/server/common/models/persistence.model.js.map +1 -1
  41. package/dist/server/modules/auth/auth.controller.js +0 -3
  42. package/dist/server/modules/auth/auth.controller.js.map +1 -1
  43. package/dist/server/modules/auth/auth.model.js +0 -4
  44. package/dist/server/modules/auth/auth.model.js.map +1 -1
  45. package/dist/server/modules/auth/auth.resolver.js +0 -5
  46. package/dist/server/modules/auth/auth.resolver.js.map +1 -1
  47. package/dist/server/modules/auth/inputs/auth-sign-in.input.js +0 -3
  48. package/dist/server/modules/auth/inputs/auth-sign-in.input.js.map +1 -1
  49. package/dist/server/modules/auth/inputs/auth-sign-up.input.js +0 -5
  50. package/dist/server/modules/auth/inputs/auth-sign-up.input.js.map +1 -1
  51. package/dist/server/modules/file/file-info.model.js +0 -3
  52. package/dist/server/modules/file/file-info.model.js.map +1 -1
  53. package/dist/server/modules/file/file.controller.js +0 -4
  54. package/dist/server/modules/file/file.controller.js.map +1 -1
  55. package/dist/server/modules/user/avatar.controller.js +0 -1
  56. package/dist/server/modules/user/avatar.controller.js.map +1 -1
  57. package/dist/server/modules/user/inputs/user-create.input.js +0 -3
  58. package/dist/server/modules/user/inputs/user-create.input.js.map +1 -1
  59. package/dist/server/modules/user/inputs/user.input.js +0 -3
  60. package/dist/server/modules/user/inputs/user.input.js.map +1 -1
  61. package/dist/server/modules/user/outputs/find-and-count-users-result.output.js +0 -5
  62. package/dist/server/modules/user/outputs/find-and-count-users-result.output.js.map +1 -1
  63. package/dist/server/modules/user/user.model.d.ts +0 -1
  64. package/dist/server/modules/user/user.model.js +0 -14
  65. package/dist/server/modules/user/user.model.js.map +1 -1
  66. package/dist/server/server.controller.js +0 -2
  67. package/dist/server/server.controller.js.map +1 -1
  68. package/dist/tsconfig.build.tsbuildinfo +1 -1
  69. package/package.json +44 -44
  70. package/src/core/common/inputs/combined-filter.input.ts +0 -5
  71. package/src/core/common/inputs/filter.input.ts +0 -5
  72. package/src/core/common/inputs/single-filter.input.ts +0 -10
  73. package/src/core/common/inputs/sort.input.ts +0 -5
  74. package/src/core/common/models/core-persistence.model.ts +0 -1
  75. package/src/core/modules/auth/core-auth.controller.ts +0 -7
  76. package/src/core/modules/auth/core-auth.model.ts +0 -6
  77. package/src/core/modules/auth/core-auth.resolver.ts +0 -7
  78. package/src/core/modules/auth/inputs/core-auth-sign-in.input.ts +0 -7
  79. package/src/core/modules/auth/inputs/core-auth-sign-up.input.ts +0 -3
  80. package/src/core/modules/file/core-file-info.model.ts +0 -10
  81. package/src/core/modules/file/core-file.controller.ts +0 -4
  82. package/src/core/modules/file/core-file.resolver.ts +0 -7
  83. package/src/core/modules/health-check/core-health-check-result.model.ts +0 -7
  84. package/src/core/modules/health-check/core-health-check.controller.ts +0 -4
  85. package/src/core/modules/user/core-user.model.ts +0 -15
  86. package/src/core/modules/user/inputs/core-user-create.input.ts +0 -4
  87. package/src/core/modules/user/inputs/core-user.input.ts +0 -6
  88. package/src/server/common/models/persistence.model.ts +0 -5
  89. package/src/server/modules/auth/auth.controller.ts +0 -3
  90. package/src/server/modules/auth/auth.model.ts +0 -4
  91. package/src/server/modules/auth/auth.resolver.ts +0 -5
  92. package/src/server/modules/auth/inputs/auth-sign-in.input.ts +0 -3
  93. package/src/server/modules/auth/inputs/auth-sign-up.input.ts +0 -5
  94. package/src/server/modules/file/file-info.model.ts +0 -3
  95. package/src/server/modules/file/file.controller.ts +0 -4
  96. package/src/server/modules/user/avatar.controller.ts +0 -1
  97. package/src/server/modules/user/inputs/user-create.input.ts +0 -3
  98. package/src/server/modules/user/inputs/user.input.ts +0 -3
  99. package/src/server/modules/user/outputs/find-and-count-users-result.output.ts +0 -5
  100. package/src/server/modules/user/user.model.ts +0 -15
  101. package/src/server/server.controller.ts +0 -2
@@ -1,14 +1,11 @@
1
1
  import { Controller, Get } from '@nestjs/common';
2
2
 
3
- import { Roles } from '../../common/decorators/roles.decorator';
4
- import { RoleEnum } from '../../common/enums/role.enum';
5
3
  import { CoreHealthCheckService } from './core-health-check.service';
6
4
 
7
5
  /**
8
6
  * The HealthController class checks the health of various components including the database, memory, and disk.
9
7
  * Inspired by https://mobileappcircular.com/marketplace-backend-creating-a-health-check-endpoint-in-nestjs-app-using-terminus-25727e96c7d2
10
8
  */
11
- @Roles(RoleEnum.ADMIN)
12
9
  @Controller()
13
10
  export class CoreHealthCheckController {
14
11
  constructor(protected readonly healthCheckService: CoreHealthCheckService) {}
@@ -21,7 +18,6 @@ export class CoreHealthCheckController {
21
18
  * storage. The `healthCheck()` method will return a Promise that resolves with an array of objects
22
19
  * representing the results of each check
23
20
  */
24
- @Roles(RoleEnum.S_EVERYONE)
25
21
  @Get('health-check')
26
22
  async healthCheck() {
27
23
  return this.healthCheckService.healthCheck();
@@ -3,8 +3,6 @@ import { Schema as MongooseSchema, Prop, raw } from '@nestjs/mongoose';
3
3
  import { IsEmail, IsOptional } from 'class-validator';
4
4
  import { Document } from 'mongoose';
5
5
 
6
- import { Restricted } from '../../common/decorators/restricted.decorator';
7
- import { RoleEnum } from '../../common/enums/role.enum';
8
6
  import { CorePersistenceModel } from '../../common/models/core-persistence.model';
9
7
  import { CoreTokenData } from '../auth/interfaces/core-token-data.interface';
10
8
 
@@ -13,7 +11,6 @@ export type CoreUserModelDocument = CoreUserModel & Document;
13
11
  /**
14
12
  * User model
15
13
  */
16
- @Restricted(RoleEnum.S_EVERYONE)
17
14
  @ObjectType({ description: 'User', isAbstract: true })
18
15
  @MongooseSchema({ timestamps: true })
19
16
  export abstract class CoreUserModel extends CorePersistenceModel {
@@ -24,7 +21,6 @@ export abstract class CoreUserModel extends CorePersistenceModel {
24
21
  /**
25
22
  * E-Mail address of the user
26
23
  */
27
- @Restricted(RoleEnum.S_EVERYONE)
28
24
  @Field({ description: 'Email of the user', nullable: true })
29
25
  @IsEmail()
30
26
  @Prop({ lowercase: true, trim: true, unique: true })
@@ -33,7 +29,6 @@ export abstract class CoreUserModel extends CorePersistenceModel {
33
29
  /**
34
30
  * First name of the user
35
31
  */
36
- @Restricted(RoleEnum.S_EVERYONE)
37
32
  @Field({ description: 'First name of the user', nullable: true })
38
33
  @IsOptional()
39
34
  @Prop()
@@ -42,7 +37,6 @@ export abstract class CoreUserModel extends CorePersistenceModel {
42
37
  /**
43
38
  * Last name of the user
44
39
  */
45
- @Restricted(RoleEnum.S_EVERYONE)
46
40
  @Field({ description: 'Last name of the user', nullable: true })
47
41
  @IsOptional()
48
42
  @Prop()
@@ -51,14 +45,12 @@ export abstract class CoreUserModel extends CorePersistenceModel {
51
45
  /**
52
46
  * Password of the user
53
47
  */
54
- @Restricted(RoleEnum.S_NO_ONE)
55
48
  @Prop()
56
49
  password: string = undefined;
57
50
 
58
51
  /**
59
52
  * Roles of the user
60
53
  */
61
- @Restricted(RoleEnum.S_EVERYONE)
62
54
  @Field(type => [String], { description: 'Roles of the user', nullable: true })
63
55
  @IsOptional()
64
56
  @Prop([String])
@@ -67,7 +59,6 @@ export abstract class CoreUserModel extends CorePersistenceModel {
67
59
  /**
68
60
  * Username of the user
69
61
  */
70
- @Restricted(RoleEnum.S_EVERYONE)
71
62
  @Field({ description: 'Username of the user', nullable: true })
72
63
  @IsOptional()
73
64
  @Prop()
@@ -76,7 +67,6 @@ export abstract class CoreUserModel extends CorePersistenceModel {
76
67
  /**
77
68
  * Password reset token of the user
78
69
  */
79
- @Restricted(RoleEnum.S_NO_ONE)
80
70
  @IsOptional()
81
71
  @Prop()
82
72
  passwordResetToken: string = undefined;
@@ -86,7 +76,6 @@ export abstract class CoreUserModel extends CorePersistenceModel {
86
76
  * key: Token
87
77
  * value: TokenData
88
78
  */
89
- @Restricted(RoleEnum.S_NO_ONE)
90
79
  @IsOptional()
91
80
  @Prop(raw({}))
92
81
  refreshTokens: Record<string, CoreTokenData> = undefined;
@@ -95,7 +84,6 @@ export abstract class CoreUserModel extends CorePersistenceModel {
95
84
  * Temporary token for parallel requests during the token refresh process
96
85
  * See sameTokenIdPeriod in configuration
97
86
  */
98
- @Restricted(RoleEnum.S_NO_ONE)
99
87
  @IsOptional()
100
88
  @Prop(raw({}))
101
89
  tempTokens: Record<string, { createdAt: number; deviceId: string; tokenId: string }> = undefined;
@@ -103,7 +91,6 @@ export abstract class CoreUserModel extends CorePersistenceModel {
103
91
  /**
104
92
  * Verification token of the user
105
93
  */
106
- @Restricted(RoleEnum.S_NO_ONE)
107
94
  @IsOptional()
108
95
  @Prop()
109
96
  verificationToken: string = undefined;
@@ -111,7 +98,6 @@ export abstract class CoreUserModel extends CorePersistenceModel {
111
98
  /**
112
99
  * Verification of the user
113
100
  */
114
- @Restricted(RoleEnum.S_EVERYONE)
115
101
  @Field(type => Boolean, { description: 'Verification state of the user', nullable: true })
116
102
  @Prop({ type: Boolean })
117
103
  verified: boolean = undefined;
@@ -119,7 +105,6 @@ export abstract class CoreUserModel extends CorePersistenceModel {
119
105
  /**
120
106
  * Verification date
121
107
  */
122
- @Restricted(RoleEnum.S_EVERYONE)
123
108
  @Field({ description: 'Verified date', nullable: true })
124
109
  @Prop()
125
110
  verifiedAt: Date = undefined;
@@ -1,8 +1,6 @@
1
1
  import { Field, InputType } from '@nestjs/graphql';
2
2
  import { IsEmail } from 'class-validator';
3
3
 
4
- import { Restricted } from '../../../common/decorators/restricted.decorator';
5
- import { RoleEnum } from '../../../common/enums/role.enum';
6
4
  import { CoreUserInput } from './core-user.input';
7
5
 
8
6
  /**
@@ -12,10 +10,8 @@ import { CoreUserInput } from './core-user.input';
12
10
  * otherwise the property will not be recognized via Object.keys (this is necessary for mapping) or will be initialized
13
11
  * with a default value that may overwrite an existing value in the DB.
14
12
  */
15
- @Restricted(RoleEnum.S_EVERYONE)
16
13
  @InputType({ description: 'User input to create a new user', isAbstract: true })
17
14
  export abstract class CoreUserCreateInput extends CoreUserInput {
18
- @Restricted(RoleEnum.S_EVERYONE)
19
15
  @Field({ description: 'Email of the user', nullable: false })
20
16
  @IsEmail()
21
17
  override email: string = undefined;
@@ -13,13 +13,11 @@ import { CoreInput } from '../../../common/inputs/core-input.input';
13
13
  * otherwise the property will not be recognized via Object.keys (this is necessary for mapping) or will be initialized
14
14
  * with a default value that may overwrite an existing value in the DB.
15
15
  */
16
- @Restricted(RoleEnum.S_EVERYONE)
17
16
  @InputType({ description: 'User input', isAbstract: true })
18
17
  export abstract class CoreUserInput extends CoreInput {
19
18
  /**
20
19
  * Email of the user
21
20
  */
22
- @Restricted(RoleEnum.S_EVERYONE)
23
21
  @Field({ description: 'Email of the user', nullable: true })
24
22
  @IsOptional()
25
23
  @IsEmail()
@@ -28,7 +26,6 @@ export abstract class CoreUserInput extends CoreInput {
28
26
  /**
29
27
  * First name of the user
30
28
  */
31
- @Restricted(RoleEnum.S_EVERYONE)
32
29
  @Field({ description: 'First name of the user', nullable: true })
33
30
  @IsOptional()
34
31
  firstName?: string = undefined;
@@ -36,7 +33,6 @@ export abstract class CoreUserInput extends CoreInput {
36
33
  /**
37
34
  * Last name of the user
38
35
  */
39
- @Restricted(RoleEnum.S_EVERYONE)
40
36
  @Field({ description: 'Last name of the user', nullable: true })
41
37
  @IsOptional()
42
38
  lastName?: string = undefined;
@@ -52,7 +48,6 @@ export abstract class CoreUserInput extends CoreInput {
52
48
  /**
53
49
  * Username / alias of the user
54
50
  */
55
- @Restricted(RoleEnum.S_EVERYONE)
56
51
  @Field({ description: 'Username / alias of the user', nullable: true })
57
52
  @IsOptional()
58
53
  username?: string = undefined;
@@ -60,7 +55,6 @@ export abstract class CoreUserInput extends CoreInput {
60
55
  /**
61
56
  * Password of the user
62
57
  */
63
- @Restricted(RoleEnum.S_EVERYONE)
64
58
  @Field({ description: 'Password of the user', nullable: true })
65
59
  @IsOptional()
66
60
  password?: string = undefined;
@@ -2,8 +2,6 @@ import { Field, ObjectType } from '@nestjs/graphql';
2
2
  import { Prop } from '@nestjs/mongoose';
3
3
  import { Types } from 'mongoose';
4
4
 
5
- import { Restricted } from '../../../core/common/decorators/restricted.decorator';
6
- import { RoleEnum } from '../../../core/common/enums/role.enum';
7
5
  import { CorePersistenceModel } from '../../../core/common/models/core-persistence.model';
8
6
  import { User } from '../../modules/user/user.model';
9
7
 
@@ -14,7 +12,6 @@ import mongoose = require('mongoose');
14
12
  *
15
13
  * The models are a combination of MikroORM Entities and TypeGraphQL Types
16
14
  */
17
- @Restricted(RoleEnum.ADMIN)
18
15
  @ObjectType({
19
16
  description: 'Persistence model which will be saved in DB',
20
17
  isAbstract: true,
@@ -29,7 +26,6 @@ export abstract class PersistenceModel extends CorePersistenceModel {
29
26
  *
30
27
  * Not set when created by system
31
28
  */
32
- @Restricted(RoleEnum.ADMIN)
33
29
  @Field(() => User, {
34
30
  description: 'ID of the user who created the object',
35
31
  nullable: true,
@@ -42,7 +38,6 @@ export abstract class PersistenceModel extends CorePersistenceModel {
42
38
  *
43
39
  * Not set when updated by system
44
40
  */
45
- @Restricted(RoleEnum.ADMIN)
46
41
  @Field(() => User, {
47
42
  description: 'ID of the user who updated the object',
48
43
  nullable: true,
@@ -1,12 +1,9 @@
1
1
  import { Controller } from '@nestjs/common';
2
2
 
3
- import { Roles } from '../../../core/common/decorators/roles.decorator';
4
- import { RoleEnum } from '../../../core/common/enums/role.enum';
5
3
  import { ConfigService } from '../../../core/common/services/config.service';
6
4
  import { CoreAuthController } from '../../../core/modules/auth/core-auth.controller';
7
5
  import { AuthService } from './auth.service';
8
6
 
9
- @Roles(RoleEnum.ADMIN)
10
7
  @Controller('auth')
11
8
  export class AuthController extends CoreAuthController {
12
9
  /**
@@ -1,7 +1,5 @@
1
1
  import { Field, ObjectType } from '@nestjs/graphql';
2
2
 
3
- import { Restricted } from '../../../core/common/decorators/restricted.decorator';
4
- import { RoleEnum } from '../../../core/common/enums/role.enum';
5
3
  import { mapClasses } from '../../../core/common/helpers/model.helper';
6
4
  import { CoreAuthModel } from '../../../core/modules/auth/core-auth.model';
7
5
  import { User } from '../user/user.model';
@@ -9,7 +7,6 @@ import { User } from '../user/user.model';
9
7
  /**
10
8
  * Authentication data
11
9
  */
12
- @Restricted(RoleEnum.ADMIN)
13
10
  @ObjectType({ description: 'Authentication data' })
14
11
  export class Auth extends CoreAuthModel {
15
12
  // ===================================================================================================================
@@ -19,7 +16,6 @@ export class Auth extends CoreAuthModel {
19
16
  /**
20
17
  * Signed-in user
21
18
  */
22
- @Restricted(RoleEnum.S_EVERYONE)
23
19
  @Field(() => User, { description: 'User who signed in' })
24
20
  override user: User = undefined;
25
21
 
@@ -2,8 +2,6 @@ import { Args, Context, Mutation, Resolver } from '@nestjs/graphql';
2
2
  import { Response as ResponseType } from 'express';
3
3
 
4
4
  import { GraphQLServiceOptions } from '../../../core/common/decorators/graphql-service-options.decorator';
5
- import { Roles } from '../../../core/common/decorators/roles.decorator';
6
- import { RoleEnum } from '../../../core/common/enums/role.enum';
7
5
  import { ServiceOptions } from '../../../core/common/interfaces/service-options.interface';
8
6
  import { ConfigService } from '../../../core/common/services/config.service';
9
7
  import { CoreAuthResolver } from '../../../core/modules/auth/core-auth.resolver';
@@ -15,7 +13,6 @@ import { AuthSignUpInput } from './inputs/auth-sign-up.input';
15
13
  /**
16
14
  * Authentication resolver for the sign in
17
15
  */
18
- @Roles(RoleEnum.ADMIN)
19
16
  @Resolver(() => Auth)
20
17
  export class AuthResolver extends CoreAuthResolver {
21
18
  /**
@@ -31,7 +28,6 @@ export class AuthResolver extends CoreAuthResolver {
31
28
  /**
32
29
  * SignIn for User
33
30
  */
34
- @Roles(RoleEnum.S_EVERYONE)
35
31
  @Mutation(() => Auth, { description: 'Sign in and get JWT token' })
36
32
  override async signIn(
37
33
  @GraphQLServiceOptions({ gqlPath: 'signIn.user' }) serviceOptions: ServiceOptions,
@@ -48,7 +44,6 @@ export class AuthResolver extends CoreAuthResolver {
48
44
  /**
49
45
  * Sign up for user
50
46
  */
51
- @Roles(RoleEnum.S_EVERYONE)
52
47
  @Mutation(() => Auth, {
53
48
  description: 'Sign up user and get JWT token',
54
49
  })
@@ -1,13 +1,10 @@
1
1
  import { InputType } from '@nestjs/graphql';
2
2
 
3
- import { Restricted } from '../../../../core/common/decorators/restricted.decorator';
4
- import { RoleEnum } from '../../../../core/common/enums/role.enum';
5
3
  import { CoreAuthSignInInput } from '../../../../core/modules/auth/inputs/core-auth-sign-in.input';
6
4
 
7
5
  /**
8
6
  * SignIn input
9
7
  */
10
- @Restricted(RoleEnum.ADMIN)
11
8
  @InputType({ description: 'Sign-in input' })
12
9
  export class AuthSignInInput extends CoreAuthSignInInput {
13
10
  // Extend UserInput here
@@ -1,24 +1,19 @@
1
1
  import { Field, InputType } from '@nestjs/graphql';
2
2
 
3
- import { Restricted } from '../../../../core/common/decorators/restricted.decorator';
4
- import { RoleEnum } from '../../../../core/common/enums/role.enum';
5
3
  import { CoreAuthSignUpInput } from '../../../../core/modules/auth/inputs/core-auth-sign-up.input';
6
4
 
7
5
  /**
8
6
  * SignUp input
9
7
  */
10
- @Restricted(RoleEnum.ADMIN)
11
8
  @InputType({ description: 'Sign-up input' })
12
9
  export class AuthSignUpInput extends CoreAuthSignUpInput {
13
10
  // ===================================================================================================================
14
11
  // Properties
15
12
  // ===================================================================================================================
16
13
 
17
- @Restricted(RoleEnum.S_EVERYONE)
18
14
  @Field({ description: 'firstName', nullable: true })
19
15
  firstName: string = undefined;
20
16
 
21
- @Restricted(RoleEnum.S_EVERYONE)
22
17
  @Field({ description: 'lastName', nullable: true })
23
18
  lastName: string = undefined;
24
19
  }
@@ -1,14 +1,11 @@
1
1
  import { ObjectType } from '@nestjs/graphql';
2
2
  import { Schema as MongooseSchema, SchemaFactory } from '@nestjs/mongoose';
3
3
 
4
- import { Restricted } from '../../../core/common/decorators/restricted.decorator';
5
- import { RoleEnum } from '../../../core/common/enums/role.enum';
6
4
  import { CoreFileInfo } from '../../../core/modules/file/core-file-info.model';
7
5
 
8
6
  /**
9
7
  * File info model
10
8
  */
11
- @Restricted(RoleEnum.ADMIN)
12
9
  @ObjectType({ description: 'Information about file' })
13
10
  @MongooseSchema({ collection: 'fs.files' })
14
11
  export class FileInfo extends CoreFileInfo {}
@@ -30,7 +30,6 @@ export class FileController {
30
30
  /**
31
31
  * Upload file
32
32
  */
33
- @Roles(RoleEnum.ADMIN)
34
33
  @Post('upload')
35
34
  @UseInterceptors(FileInterceptor('file'))
36
35
  uploadFile(@UploadedFile() file: Express.Multer.File): any {
@@ -40,7 +39,6 @@ export class FileController {
40
39
  /**
41
40
  * Download file
42
41
  */
43
- @Roles(RoleEnum.ADMIN)
44
42
  @Get(':id')
45
43
  async getFile(@Param('id') id: string, @Res() res) {
46
44
  if (!id) {
@@ -67,7 +65,6 @@ export class FileController {
67
65
  /**
68
66
  * Get file information
69
67
  */
70
- @Roles(RoleEnum.ADMIN)
71
68
  @Get('info/:id')
72
69
  async getFileInfo(@Param('id') id: string) {
73
70
  return await this.fileService.getFileInfo(id);
@@ -76,7 +73,6 @@ export class FileController {
76
73
  /**
77
74
  * Delete file
78
75
  */
79
- @Roles(RoleEnum.ADMIN)
80
76
  @Delete(':id')
81
77
  async deleteFile(@Param('id') id: string) {
82
78
  if (!id) {
@@ -13,7 +13,6 @@ import { UserService } from './user.service';
13
13
  /**
14
14
  * Controller for avatar
15
15
  */
16
- @Roles(RoleEnum.ADMIN)
17
16
  @Controller('avatar')
18
17
  export class AvatarController {
19
18
  /**
@@ -1,13 +1,10 @@
1
1
  import { InputType } from '@nestjs/graphql';
2
2
 
3
- import { Restricted } from '../../../../core/common/decorators/restricted.decorator';
4
- import { RoleEnum } from '../../../../core/common/enums/role.enum';
5
3
  import { CoreUserCreateInput } from '../../../../core/modules/user/inputs/core-user-create.input';
6
4
 
7
5
  /**
8
6
  * User input to create a new user
9
7
  */
10
- @Restricted(RoleEnum.ADMIN)
11
8
  @InputType({ description: 'User input to create a new user' })
12
9
  export class UserCreateInput extends CoreUserCreateInput {
13
10
  // Extend UserCreateInput here
@@ -1,13 +1,10 @@
1
1
  import { InputType } from '@nestjs/graphql';
2
2
 
3
- import { Restricted } from '../../../../core/common/decorators/restricted.decorator';
4
- import { RoleEnum } from '../../../../core/common/enums/role.enum';
5
3
  import { CoreUserInput } from '../../../../core/modules/user/inputs/core-user.input';
6
4
 
7
5
  /**
8
6
  * User input to update a user
9
7
  */
10
- @Restricted(RoleEnum.ADMIN)
11
8
  @InputType({ description: 'User input' })
12
9
  export class UserInput extends CoreUserInput {
13
10
  // Extend UserInput here
@@ -1,17 +1,12 @@
1
1
  import { Field, ObjectType } from '@nestjs/graphql';
2
2
 
3
- import { Restricted } from '../../../../core/common/decorators/restricted.decorator';
4
- import { RoleEnum } from '../../../../core/common/enums/role.enum';
5
3
  import { User } from '../user.model';
6
4
 
7
- @Restricted(RoleEnum.ADMIN)
8
5
  @ObjectType({ description: 'Result of find and count' })
9
6
  export class FindAndCountUsersResult {
10
- @Restricted(RoleEnum.S_EVERYONE)
11
7
  @Field(() => [User], { description: 'Found users' })
12
8
  items: User[];
13
9
 
14
- @Restricted(RoleEnum.S_EVERYONE)
15
10
  @Field({ description: 'Total count (skip/offset and limit/take are ignored in the count)' })
16
11
  totalCount: number;
17
12
  }
@@ -1,9 +1,7 @@
1
1
  import { Field, ObjectType } from '@nestjs/graphql';
2
2
  import { Schema as MongooseSchema, Prop, SchemaFactory } from '@nestjs/mongoose';
3
- import { IsOptional } from 'class-validator';
4
3
  import { Document, Schema } from 'mongoose';
5
4
 
6
- import { Restricted } from '../../../core/common/decorators/restricted.decorator';
7
5
  import { RoleEnum } from '../../../core/common/enums/role.enum';
8
6
  import { CoreUserModel } from '../../../core/modules/user/core-user.model';
9
7
  import { PersistenceModel } from '../../common/models/persistence.model';
@@ -13,7 +11,6 @@ export type UserDocument = Document & User;
13
11
  /**
14
12
  * User model
15
13
  */
16
- @Restricted(RoleEnum.ADMIN)
17
14
  @ObjectType({ description: 'User' })
18
15
  @MongooseSchema({ timestamps: true })
19
16
  export class User extends CoreUserModel implements PersistenceModel {
@@ -24,7 +21,6 @@ export class User extends CoreUserModel implements PersistenceModel {
24
21
  /**
25
22
  * URL to avatar file of the user
26
23
  */
27
- @Restricted(RoleEnum.S_EVERYONE)
28
24
  @Field({ description: 'URL to avatar file of the user', nullable: true })
29
25
  @Prop()
30
26
  avatar: string = undefined;
@@ -34,7 +30,6 @@ export class User extends CoreUserModel implements PersistenceModel {
34
30
  *
35
31
  * Not set when created by system
36
32
  */
37
- @Restricted(RoleEnum.S_EVERYONE)
38
33
  @Field(() => String, {
39
34
  description: 'ID of the user who created the object',
40
35
  nullable: true,
@@ -42,21 +37,11 @@ export class User extends CoreUserModel implements PersistenceModel {
42
37
  @Prop({ ref: 'User', type: Schema.Types.ObjectId })
43
38
  createdBy: string = undefined;
44
39
 
45
- /**
46
- * Roles of the user
47
- */
48
- @Restricted(RoleEnum.S_EVERYONE)
49
- @Field(type => [String], { description: 'Roles of the user', nullable: true })
50
- @IsOptional()
51
- @Prop([String])
52
- override roles: string[] = undefined;
53
-
54
40
  /**
55
41
  * ID of the user who updated the object
56
42
  *
57
43
  * Not set when updated by system
58
44
  */
59
- @Restricted(RoleEnum.S_USER)
60
45
  @Field(() => String, {
61
46
  description: 'ID of the user who last updated the object',
62
47
  nullable: true,
@@ -2,12 +2,10 @@ import { Controller, Get, Render } from '@nestjs/common';
2
2
 
3
3
  import { ConfigService, RoleEnum, Roles } from '..';
4
4
 
5
- @Roles(RoleEnum.ADMIN)
6
5
  @Controller()
7
6
  export class ServerController {
8
7
  constructor(protected configService: ConfigService) {}
9
8
 
10
- @Roles(RoleEnum.S_EVERYONE)
11
9
  @Get()
12
10
  @Render('index')
13
11
  root() {