@@ -33,27 +33,31 @@ export class DashboardResolver {
33
33
private readonly authService : AuthService ,
34
34
) { }
35
35
36
+ @RequireRoles ( 'Admin' )
36
37
@Query ( ( ) => [ User ] )
37
38
async dashboardUsers (
38
39
@Args ( 'filter' , { nullable : true } ) filter ?: UserFilterInput ,
39
40
) : Promise < User [ ] > {
40
41
return await this . dashboardService . findUsers ( filter ) ;
41
42
}
42
43
44
+ @RequireRoles ( 'Admin' )
43
45
@Query ( ( ) => User )
44
46
async dashboardUser (
45
47
@Args ( 'id' , { type : ( ) => ID } ) id : string ,
46
48
) : Promise < User > {
47
49
return this . dashboardService . findUserById ( id ) ;
48
50
}
49
51
52
+ @RequireRoles ( 'Admin' )
50
53
@Mutation ( ( ) => User )
51
54
async createDashboardUser (
52
55
@Args ( 'input' ) input : CreateUserInput ,
53
56
) : Promise < User > {
54
57
return this . dashboardService . createUser ( input ) ;
55
58
}
56
59
60
+ @RequireRoles ( 'Admin' )
57
61
@Mutation ( ( ) => User )
58
62
async updateDashboardUser (
59
63
@Args ( 'id' , { type : ( ) => ID } ) id : string ,
@@ -62,6 +66,7 @@ export class DashboardResolver {
62
66
return this . dashboardService . updateUser ( id , input ) ;
63
67
}
64
68
69
+ @RequireRoles ( 'Admin' )
65
70
@Mutation ( ( ) => Boolean )
66
71
async deleteDashboardUser (
67
72
@Args ( 'id' , { type : ( ) => ID } ) id : string ,
@@ -70,20 +75,23 @@ export class DashboardResolver {
70
75
}
71
76
72
77
// Chat Management
78
+ @RequireRoles ( 'Admin' )
73
79
@Query ( ( ) => [ Chat ] )
74
80
async dashboardChats (
75
81
@Args ( 'filter' , { nullable : true } ) filter ?: ChatFilterInput ,
76
82
) : Promise < Chat [ ] > {
77
83
return this . dashboardService . findChats ( filter ) ;
78
84
}
79
85
86
+ @RequireRoles ( 'Admin' )
80
87
@Query ( ( ) => Chat )
81
88
async dashboardChat (
82
89
@Args ( 'id' , { type : ( ) => ID } ) id : string ,
83
90
) : Promise < Chat > {
84
91
return this . dashboardService . findChatById ( id ) ;
85
92
}
86
93
94
+ @RequireRoles ( 'Admin' )
87
95
@Mutation ( ( ) => Chat )
88
96
async createDashboardChat (
89
97
@GetUserIdFromToken ( ) userId : string ,
@@ -92,6 +100,7 @@ export class DashboardResolver {
92
100
return this . dashboardService . createChat ( input , userId ) ;
93
101
}
94
102
103
+ @RequireRoles ( 'Admin' )
95
104
@Mutation ( ( ) => Chat )
96
105
async updateDashboardChat (
97
106
@Args ( 'id' , { type : ( ) => ID } ) id : string ,
@@ -100,6 +109,7 @@ export class DashboardResolver {
100
109
return this . dashboardService . updateChat ( id , input ) ;
101
110
}
102
111
112
+ @RequireRoles ( 'Admin' )
103
113
@Mutation ( ( ) => Boolean )
104
114
async deleteDashboardChat (
105
115
@Args ( 'id' , { type : ( ) => ID } ) id : string ,
@@ -108,20 +118,23 @@ export class DashboardResolver {
108
118
}
109
119
110
120
// Project Management
121
+ @RequireRoles ( 'Admin' )
111
122
@Query ( ( ) => [ Project ] )
112
123
async dashboardProjects (
113
124
@Args ( 'filter' , { nullable : true } ) filter ?: ProjectFilterInput ,
114
125
) : Promise < Project [ ] > {
115
126
return this . dashboardService . findProjects ( filter ) ;
116
127
}
117
128
129
+ @RequireRoles ( 'Admin' )
118
130
@Query ( ( ) => Project )
119
131
async dashboardProject (
120
132
@Args ( 'id' , { type : ( ) => ID } ) id : string ,
121
133
) : Promise < Project > {
122
134
return this . dashboardService . findProjectById ( id ) ;
123
135
}
124
136
137
+ @RequireRoles ( 'Admin' )
125
138
@Mutation ( ( ) => Chat )
126
139
async createDashboardProject (
127
140
@GetUserIdFromToken ( ) userId : string ,
@@ -130,6 +143,7 @@ export class DashboardResolver {
130
143
return await this . dashboardService . createProject ( input , userId ) ;
131
144
}
132
145
146
+ @RequireRoles ( 'Admin' )
133
147
@Mutation ( ( ) => Project )
134
148
async updateDashboardProject (
135
149
@Args ( 'id' , { type : ( ) => ID } ) id : string ,
@@ -138,32 +152,38 @@ export class DashboardResolver {
138
152
return this . dashboardService . updateProject ( id , input ) ;
139
153
}
140
154
155
+ @RequireRoles ( 'Admin' )
141
156
@Mutation ( ( ) => Boolean )
142
157
async deleteDashboardProject (
143
158
@Args ( 'id' , { type : ( ) => ID } ) id : string ,
144
159
) : Promise < boolean > {
145
160
return this . dashboardService . deleteProject ( id ) ;
146
161
}
147
162
163
+ // Role Management
164
+ @RequireRoles ( 'Admin' )
148
165
@Query ( ( ) => [ Role ] )
149
166
async dashboardRoles ( ) : Promise < Role [ ] > {
150
167
return this . dashboardService . findRoles ( ) ;
151
168
}
152
169
170
+ @RequireRoles ( 'Admin' )
153
171
@Query ( ( ) => Role )
154
172
async dashboardRole (
155
173
@Args ( 'id' , { type : ( ) => ID } ) id : string ,
156
174
) : Promise < Role > {
157
175
return this . dashboardService . findRoleById ( id ) ;
158
176
}
159
177
178
+ @RequireRoles ( 'Admin' )
160
179
@Mutation ( ( ) => Role )
161
180
async createDashboardRole (
162
181
@Args ( 'input' ) input : CreateRoleInput ,
163
182
) : Promise < Role > {
164
183
return this . dashboardService . createRole ( input ) ;
165
184
}
166
185
186
+ @RequireRoles ( 'Admin' )
167
187
@Mutation ( ( ) => Role )
168
188
async updateDashboardRole (
169
189
@Args ( 'id' , { type : ( ) => ID } ) id : string ,
@@ -172,13 +192,16 @@ export class DashboardResolver {
172
192
return this . dashboardService . updateRole ( id , input ) ;
173
193
}
174
194
195
+ @RequireRoles ( 'Admin' )
175
196
@Mutation ( ( ) => Boolean )
176
197
async deleteDashboardRole (
177
198
@Args ( 'id' , { type : ( ) => ID } ) id : string ,
178
199
) : Promise < boolean > {
179
200
return this . dashboardService . deleteRole ( id ) ;
180
201
}
181
202
203
+ // Dashboard Stats
204
+ @RequireRoles ( 'Admin' )
182
205
@Query ( ( ) => DashboardStats )
183
206
async dashboardStats ( ) : Promise < DashboardStats > {
184
207
return this . dashboardService . getDashboardStats ( ) ;
0 commit comments