|
1 |
| -import { |
2 |
| - Body, |
3 |
| - Controller, |
4 |
| - Delete, |
5 |
| - Get, |
6 |
| - HttpStatus, |
7 |
| - Param, |
8 |
| - Patch, |
9 |
| - Post, |
10 |
| - Query, |
11 |
| - Req, |
12 |
| - UseGuards, |
13 |
| -} from '@nestjs/common'; |
| 1 | +import { Body, Controller, Get, Post, Req, UseGuards } from '@nestjs/common'; |
14 | 2 | import { UserService } from './user.service';
|
15 | 3 | import { AuthenticatedGuard } from 'src/auth/authenticated.guard';
|
16 | 4 | import { Request } from 'express';
|
17 |
| -import { UserSettings, AddCourseDto } from './types'; |
| 5 | +import { UserSettings } from './types'; |
18 | 6 |
|
19 | 7 | interface AuthenticatedRequest extends Request {
|
20 | 8 | user: {
|
@@ -59,179 +47,4 @@ export class UserController {
|
59 | 47 | ) {
|
60 | 48 | await this.userService.setSettings(req.user.id, settings);
|
61 | 49 | }
|
62 |
| - |
63 |
| - // @Get('courses/:timetableId') |
64 |
| - // @UseGuards(AuthenticatedGuard) |
65 |
| - // async getCourseIds( |
66 |
| - // @Req() req: AuthenticatedRequest, |
67 |
| - // @Param('timetableId') timetableId: string, |
68 |
| - // ) { |
69 |
| - // return await this.userService.getCourseIds(req.user.id, timetableId); |
70 |
| - // } |
71 |
| - |
72 |
| - // @Post('course/:timetableId/:courseId') |
73 |
| - // @UseGuards(AuthenticatedGuard) |
74 |
| - // async addCourse( |
75 |
| - // @Req() req: AuthenticatedRequest, |
76 |
| - // @Param('timetableId') timetableId: string, |
77 |
| - // @Param('courseId') courseId: string, |
78 |
| - // @Body() addCourseDto: AddCourseDto, |
79 |
| - // ) { |
80 |
| - // await this.userService.addCourse( |
81 |
| - // req.user.id, |
82 |
| - // timetableId, |
83 |
| - // courseId, |
84 |
| - // addCourseDto, |
85 |
| - // ); |
86 |
| - // return HttpStatus.CREATED; |
87 |
| - // } |
88 |
| - |
89 |
| - // @Delete('course/:timetableId/:courseId') |
90 |
| - // @UseGuards(AuthenticatedGuard) |
91 |
| - // async removeCourse( |
92 |
| - // @Req() req: AuthenticatedRequest, |
93 |
| - // @Param('timetableId') timetableId: string, |
94 |
| - // @Param('courseId') courseId: string, |
95 |
| - // ) { |
96 |
| - // await this.userService.removeCourse(req.user.id, timetableId, courseId); |
97 |
| - // } |
98 |
| - |
99 |
| - // @Patch('course/:timetableId/:courseId/colour') |
100 |
| - // @UseGuards(AuthenticatedGuard) |
101 |
| - // async setCourseColour( |
102 |
| - // @Req() req: AuthenticatedRequest, |
103 |
| - // @Param('timetableId') timetableId: string, |
104 |
| - // @Param('courseId') courseId: string, |
105 |
| - // @Body('colour') colour: string, |
106 |
| - // ) { |
107 |
| - // await this.userService.setCourseColour( |
108 |
| - // req.user.id, |
109 |
| - // timetableId, |
110 |
| - // courseId, |
111 |
| - // colour, |
112 |
| - // ); |
113 |
| - // } |
114 |
| - |
115 |
| - // @Get('classes/:timetableId/:courseId') |
116 |
| - // @UseGuards(AuthenticatedGuard) |
117 |
| - // async getSelectedClassIds( |
118 |
| - // @Req() req: AuthenticatedRequest, |
119 |
| - // @Param('timetableId') timetableId: string, |
120 |
| - // @Param('courseId') courseId: string, |
121 |
| - // ) { |
122 |
| - // return await this.userService.getSelectedClassIds( |
123 |
| - // req.user.id, |
124 |
| - // timetableId, |
125 |
| - // courseId, |
126 |
| - // ); |
127 |
| - // } |
128 |
| - |
129 |
| - // @Patch('class/:timetableId/:courseId') |
130 |
| - // @UseGuards(AuthenticatedGuard) |
131 |
| - // async updateSelectedClass( |
132 |
| - // @Req() req: AuthenticatedRequest, |
133 |
| - // @Param('timetableId') timetableId: string, |
134 |
| - // @Param('courseId') courseId: string, |
135 |
| - // @Body('classId') classId: string, |
136 |
| - // ) { |
137 |
| - // await this.userService.updateSelectedClass( |
138 |
| - // req.user.id, |
139 |
| - // timetableId, |
140 |
| - // courseId, |
141 |
| - // classId, |
142 |
| - // ); |
143 |
| - // } |
144 |
| - |
145 |
| - // @Delete('class/:timetableId/:courseId/:classId') |
146 |
| - // @UseGuards(AuthenticatedGuard) |
147 |
| - // async removeSelectedClass( |
148 |
| - // @Req() req: AuthenticatedRequest, |
149 |
| - // @Param('timetableId') timetableId: string, |
150 |
| - // @Param('courseId') courseId: string, |
151 |
| - // @Param('classId') classId: string, |
152 |
| - // ) { |
153 |
| - // await this.userService.removeSelectedClass( |
154 |
| - // req.user.id, |
155 |
| - // timetableId, |
156 |
| - // courseId, |
157 |
| - // classId, |
158 |
| - // ); |
159 |
| - // } |
160 |
| - |
161 |
| - // @Get('timetables/:id') |
162 |
| - // @UseGuards(AuthenticatedGuard) |
163 |
| - // async getTimetable( |
164 |
| - // @Req() req: AuthenticatedRequest, |
165 |
| - // @Param('id') timetableId: string, |
166 |
| - // ) { |
167 |
| - // const timetable = await this.userService.getTimetable( |
168 |
| - // req.user.id, |
169 |
| - // timetableId, |
170 |
| - // ); |
171 |
| - // return timetable; |
172 |
| - // } |
173 |
| - |
174 |
| - // @Get('timetables') |
175 |
| - // @UseGuards(AuthenticatedGuard) |
176 |
| - // async getUserTimetables( |
177 |
| - // @Req() req: AuthenticatedRequest, |
178 |
| - // @Query('year') year: string, |
179 |
| - // @Query('term') term: string, |
180 |
| - // ) { |
181 |
| - // const timetables = await this.userService.getUserTimetables( |
182 |
| - // req.user.id, |
183 |
| - // Number(year), |
184 |
| - // term, |
185 |
| - // ); |
186 |
| - // return timetables; |
187 |
| - // } |
188 |
| - |
189 |
| - // @Post('timetables') |
190 |
| - // @UseGuards(AuthenticatedGuard) |
191 |
| - // async createTimetable( |
192 |
| - // @Req() req: AuthenticatedRequest, |
193 |
| - // @Body() data: { name: string; year: number; term: string }, |
194 |
| - // ) { |
195 |
| - // const timetable = await this.userService.createTimetable( |
196 |
| - // req.user!.id, |
197 |
| - // data, |
198 |
| - // ); |
199 |
| - // return timetable; |
200 |
| - // } |
201 |
| - |
202 |
| - // @Delete('timetables/:id') |
203 |
| - // @UseGuards(AuthenticatedGuard) |
204 |
| - // async deleteTimetable( |
205 |
| - // @Req() req: AuthenticatedRequest, |
206 |
| - // @Param('id') timetableId: string, |
207 |
| - // @Query('year') year: string, |
208 |
| - // @Query('term') term: string, |
209 |
| - // ) { |
210 |
| - // await this.userService.deleteTimetable( |
211 |
| - // req.user!.id, |
212 |
| - // timetableId, |
213 |
| - // Number(year), |
214 |
| - // term, |
215 |
| - // ); |
216 |
| - // } |
217 |
| - |
218 |
| - // @Patch('timetables/:id/rename') |
219 |
| - // @UseGuards(AuthenticatedGuard) |
220 |
| - // async renameTimetable( |
221 |
| - // @Req() req: AuthenticatedRequest, |
222 |
| - // @Param('id') timetableId: string, |
223 |
| - // @Body('name') newName: string, |
224 |
| - // ) { |
225 |
| - // await this.userService.renameTimetable(req.user!.id, timetableId, newName); |
226 |
| - // } |
227 |
| - |
228 |
| - // @Patch('timetables/:id/change-primary') |
229 |
| - // @UseGuards(AuthenticatedGuard) |
230 |
| - // async makePrimary( |
231 |
| - // @Req() req: AuthenticatedRequest, |
232 |
| - // @Param('id') timetableId: string, |
233 |
| - // @Body() data: { year: number; term: string }, |
234 |
| - // ) { |
235 |
| - // await this.userService.makePrimary(req.user!.id, timetableId, data); |
236 |
| - // } |
237 | 50 | }
|
0 commit comments