Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from InnoTutor/develop
Waiting list, Card info, Schedule, Session, Rating
- Loading branch information
Showing
29 changed files
with
661 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/innotutor/innotutor_backend/controller/user/ScheduleController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package innotutor.innotutor_backend.controller.user; | ||
|
||
import innotutor.innotutor_backend.dto.session.ScheduleDTO; | ||
import innotutor.innotutor_backend.security.CustomPrincipal; | ||
import innotutor.innotutor_backend.service.SessionService; | ||
import innotutor.innotutor_backend.service.UserService; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequestMapping(value = "/schedule", produces = MediaType.APPLICATION_JSON_VALUE) | ||
@CrossOrigin(origins = "*", allowedHeaders = "*", methods = {RequestMethod.GET}) | ||
public class ScheduleController { | ||
private final transient SessionService sessionService; | ||
private final transient UserService userService; | ||
|
||
public ScheduleController(final SessionService sessionService, final UserService userService) { | ||
this.sessionService = sessionService; | ||
this.userService = userService; | ||
} | ||
|
||
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) | ||
public ResponseEntity<ScheduleDTO> getSchedule(@AuthenticationPrincipal final CustomPrincipal user) { | ||
final ScheduleDTO schedule = sessionService.getSchedule(userService.getUserId(user)); | ||
return schedule == null | ||
? new ResponseEntity<>(HttpStatus.NOT_FOUND) | ||
: new ResponseEntity<>(schedule, HttpStatus.OK); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/java/innotutor/innotutor_backend/dto/card/SessionRatingDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package innotutor.innotutor_backend.dto.card; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class SessionRatingDTO { | ||
private Long sessionId; | ||
private Integer mark; | ||
private String feedback; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/main/java/innotutor/innotutor_backend/dto/session/ScheduleDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package innotutor.innotutor_backend.dto.session; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class ScheduleDTO { | ||
private List<SessionDTO> studyingSessionsConducted; | ||
private List<SessionDTO> studyingSessionsUpcoming; | ||
private List<SessionDTO> teachingSessionsConducted; | ||
private List<SessionDTO> teachingSessionsUpcoming; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
src/main/java/innotutor/innotutor_backend/dto/session/SessionsListDTO.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.