Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Responses Fixes #17

Merged
merged 3 commits into from
Dec 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.graduationproject.studentinformationsystem.common.model.dto.response;

import lombok.Getter;
import lombok.Setter;

import java.util.Date;

@Getter
@Setter
public abstract class SisBaseResponse {

protected Date createdDate;
protected Long createdUserId;
protected Date modifiedDate;
protected Long modifiedUserId;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.graduationproject.studentinformationsystem.common.util.controller.response;

import com.graduationproject.studentinformationsystem.common.model.dto.response.SisBaseResponse;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public abstract class SisBaseAcademicInfoResponse extends SisBaseResponse {

protected String email;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.graduationproject.studentinformationsystem.common.util.controller.response;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Builder;
import lombok.Getter;
import org.springframework.http.HttpStatus;

import java.time.LocalDateTime;

import static com.graduationproject.studentinformationsystem.common.util.constant.SisConstants.DATE_TIME_PATTERN;

@Getter
@Builder
public class SisBaseApiResponse<T> {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DATE_TIME_PATTERN)
private LocalDateTime requestTime;
private HttpStatus httpStatus;
private T result;
private boolean isSuccess;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.graduationproject.studentinformationsystem.common.util.controller.response;

import com.graduationproject.studentinformationsystem.common.model.dto.response.SisBaseResponse;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

@Getter
@Setter
public abstract class SisBasePersonalInfoResponse extends SisBaseResponse {

protected Long tcNo;
protected String name;
protected String surname;
protected String email;
protected Long phoneNumber;
// protected Byte[] profilePhoto; // TODO: Added Profile Photo
// protected String profilePhotoUrl; // TODO: Added Profile Photo URL
protected Date birthday;
protected String address;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.graduationproject.studentinformationsystem.common.util.controller.response;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

import java.time.LocalDateTime;

public class SisResponseUtil {

private SisResponseUtil() {
}

public static <T> ResponseEntity<SisBaseApiResponse<T>> successResponse(T result) {
return new ResponseEntity<>(
SisBaseApiResponse.<T>builder()
.requestTime(LocalDateTime.now())
.httpStatus(HttpStatus.OK)
.isSuccess(true)
.result(result).build(), HttpStatus.OK);
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.graduationproject.studentinformationsystem.student.model.dto.response;

import com.graduationproject.studentinformationsystem.common.model.dto.response.BaseResponse;
import com.graduationproject.studentinformationsystem.common.util.controller.response.SisBaseAcademicInfoResponse;
import com.graduationproject.studentinformationsystem.student.model.enums.StudentClassLevel;
import com.graduationproject.studentinformationsystem.student.model.enums.StudentDegree;
import com.graduationproject.studentinformationsystem.student.model.enums.StudentStatus;
Expand All @@ -11,13 +11,12 @@

@Getter
@Setter
public class StudentAcademicInfoResponse extends BaseResponse {
public class StudentAcademicInfoResponse extends SisBaseAcademicInfoResponse {

private Long studentId;
private Long departmentId;
private StudentDegree degree;
private StudentClassLevel classLevel;
private String email;
private StudentStatus status;
private Date registrationDate;
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
package com.graduationproject.studentinformationsystem.student.model.dto.response;

import com.graduationproject.studentinformationsystem.common.model.dto.response.BaseResponse;
import com.graduationproject.studentinformationsystem.common.util.controller.response.SisBasePersonalInfoResponse;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

@Getter
@Setter
public class StudentPersonalInfoResponse extends BaseResponse {

private Long tcNo;
private String name;
private String surname;
private String email;
private Long phoneNumber;
// private Byte[] profilePhoto; // TODO: Added Profile Photo
// private String profilePhotoUrl; // TODO: Added Profile Photo URL
private Date birthday;
private String address;
public class StudentPersonalInfoResponse extends SisBasePersonalInfoResponse {
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.graduationproject.studentinformationsystem.teacher.model.dto.response;

import com.graduationproject.studentinformationsystem.common.model.dto.response.BaseResponse;
import com.graduationproject.studentinformationsystem.common.util.controller.response.SisBaseAcademicInfoResponse;
import com.graduationproject.studentinformationsystem.teacher.model.enums.TeacherDegree;
import com.graduationproject.studentinformationsystem.teacher.model.enums.TeacherRole;
import com.graduationproject.studentinformationsystem.teacher.model.enums.TeacherStatus;
Expand All @@ -11,15 +11,14 @@

@Getter
@Setter
public class TeacherAcademicInfoResponse extends BaseResponse {
public class TeacherAcademicInfoResponse extends SisBaseAcademicInfoResponse {

private Long teacherId;
private Long departmentId;
private TeacherDegree degree;
private TeacherRole role;
private String fieldOfStudy;
private String phoneNumber;
private String email;
private TeacherStatus status;
private Date registrationDate;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.graduationproject.studentinformationsystem.teacher.model.dto.response;

import com.graduationproject.studentinformationsystem.common.model.dto.response.BaseResponse;
import com.graduationproject.studentinformationsystem.common.model.dto.response.SisBaseResponse;
import com.graduationproject.studentinformationsystem.teacher.model.enums.TeacherStatus;
import lombok.Getter;
import lombok.Setter;
Expand All @@ -9,7 +9,7 @@

@Getter
@Setter
public class TeacherPersonalInfoResponse extends BaseResponse {
public class TeacherPersonalInfoResponse extends SisBaseResponse {

private Long teacherId;
private Long tcNo;
Expand Down