Skip to content

Commit

Permalink
Teacher Lesson Res Update | SIS-107 (#58)
Browse files Browse the repository at this point in the history
* TeacherOutService Classes Have Been Updated

* TeacherLessonResponse and TeacherLessonInfoConverter Classes Have Been Refactored
  • Loading branch information
agitrubard authored Feb 18, 2022
1 parent 68fcd58 commit 8c87201
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.graduationproject.studentinformationsystem.university.lesson.teacher.model.entity.TeacherLessonDeleteEntity;
import com.graduationproject.studentinformationsystem.university.lesson.teacher.model.entity.TeacherLessonEntity;
import com.graduationproject.studentinformationsystem.university.lesson.teacher.model.entity.TeacherLessonSaveEntity;
import com.graduationproject.studentinformationsystem.university.teacher.model.dto.response.TeacherAcademicInfoResponse;
import com.graduationproject.studentinformationsystem.university.teacher.model.dto.response.TeacherInfoResponse;
import com.graduationproject.studentinformationsystem.university.teacher.service.TeacherOutService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -50,14 +50,14 @@ public TeacherLessonDeleteEntity generateDeleteEntity(final TeacherLessonDeleteR

public TeacherLessonResponse entityToResponse(final TeacherLessonEntity teacherLessonEntity) {

final TeacherAcademicInfoResponse teacherAcademicInfoResponse = teacherOutService.getTeacherAcademicInfoResponse(teacherLessonEntity.getTeacherId());
final TeacherInfoResponse teacherInfoResponse = teacherOutService.getTeacherInfoResponse(teacherLessonEntity.getTeacherId());
final LessonResponse lessonResponse = lessonOutService.getLessonResponse(teacherLessonEntity.getLessonId());

return TeacherLessonResponse.builder()
.createdUserId(teacherLessonEntity.getCreatedUserId())
.createdDate(SisUtil.getFormattedDateTime(teacherLessonEntity.getCreatedDate()))
.lessonResponse(lessonResponse)
.teacherAcademicInfoResponse(teacherAcademicInfoResponse).build();
.teacherInfoResponse(teacherInfoResponse).build();
}

public List<TeacherLessonResponse> entitiesToResponses(final List<TeacherLessonEntity> lessonEntities) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.graduationproject.studentinformationsystem.university.lesson.teacher.model.dto.response;

import com.graduationproject.studentinformationsystem.university.lesson.common.model.dto.response.LessonResponse;
import com.graduationproject.studentinformationsystem.university.teacher.model.dto.response.TeacherAcademicInfoResponse;
import com.graduationproject.studentinformationsystem.university.teacher.model.dto.response.TeacherInfoResponse;
import lombok.Getter;
import lombok.experimental.SuperBuilder;

Expand All @@ -13,5 +13,5 @@ public class TeacherLessonResponse {
private String createdDate;

private LessonResponse lessonResponse;
private TeacherAcademicInfoResponse teacherAcademicInfoResponse;
private TeacherInfoResponse teacherInfoResponse;
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.graduationproject.studentinformationsystem.university.teacher.service;

import com.graduationproject.studentinformationsystem.university.teacher.model.dto.response.TeacherAcademicInfoResponse;
import com.graduationproject.studentinformationsystem.university.teacher.model.dto.response.TeacherInfoResponse;

public interface TeacherOutService {

TeacherAcademicInfoResponse getTeacherAcademicInfoResponse(Long teacherId);
TeacherInfoResponse getTeacherInfoResponse(Long teacherId);
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
package com.graduationproject.studentinformationsystem.university.teacher.service.impl;

import com.graduationproject.studentinformationsystem.university.teacher.model.dto.converter.TeacherAcademicInfoConverter;
import com.graduationproject.studentinformationsystem.university.teacher.model.dto.converter.TeacherResponseConverter;
import com.graduationproject.studentinformationsystem.university.teacher.model.dto.response.TeacherAcademicInfoResponse;
import com.graduationproject.studentinformationsystem.university.teacher.model.entity.TeacherAcademicInfoEntity;
import com.graduationproject.studentinformationsystem.university.teacher.repository.TeacherAcademicInfoRepository;
import com.graduationproject.studentinformationsystem.university.teacher.model.dto.response.TeacherInfoResponse;
import com.graduationproject.studentinformationsystem.university.teacher.model.dto.response.TeacherPersonalInfoResponse;
import com.graduationproject.studentinformationsystem.university.teacher.service.TeacherAcademicInfoService;
import com.graduationproject.studentinformationsystem.university.teacher.service.TeacherOutService;
import com.graduationproject.studentinformationsystem.university.teacher.service.TeacherPersonalInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class TeacherOutServiceImpl implements TeacherOutService {

private final TeacherAcademicInfoRepository academicInfoRepository;
private final TeacherAcademicInfoConverter academicInfoConverter;
private final TeacherAcademicInfoService academicInfoService;
private final TeacherPersonalInfoService personalInfoService;

@Override
public TeacherAcademicInfoResponse getTeacherAcademicInfoResponse(Long teacherId) {
final TeacherAcademicInfoEntity entity = academicInfoRepository.getTeacherAcademicInfoById(teacherId);
return academicInfoConverter.entityToResponse(entity);
public TeacherInfoResponse getTeacherInfoResponse(Long teacherId) {
final TeacherAcademicInfoResponse academicInfoResponse = academicInfoService.getTeacherAcademicInfoById(teacherId);
final TeacherPersonalInfoResponse personalInfoResponse = personalInfoService.getTeacherPersonalInfoById(teacherId);
return TeacherResponseConverter.infoResponsesToResponse(academicInfoResponse, personalInfoResponse);
}
}

0 comments on commit 8c87201

Please sign in to comment.