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

Department API Res Fix | SIS-110 #57

Merged
merged 2 commits into from
Feb 18, 2022
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.graduationproject.studentinformationsystem.common.util;

import org.apache.commons.lang3.BooleanUtils;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
Expand Down Expand Up @@ -96,10 +98,10 @@ public static boolean isNotExistIdInIdList(final Long id, final List<Long> ids)
}

public static boolean integerToBoolean(final Integer integer) {
return switch (integer) {
case 1 -> true;
case 0 -> false;
default -> throw new IndexOutOfBoundsException();
};
return BooleanUtils.toBooleanObject(integer);
}

public static Integer booleanToInteger(final Boolean bool) {
return BooleanUtils.toIntegerObject(bool);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public DepartmentResponse entityToResponse(final DepartmentEntity departmentEnti
.name(departmentEntity.getName())
.status(departmentEntity.getStatus())
.totalClassLevel(departmentEntity.getTotalClassLevel())
.isTherePreparatoryClass(departmentEntity.getIsTherePreparatoryClass())
.isTherePreparatoryClass(SisUtil.booleanToInteger(departmentEntity.getIsTherePreparatoryClass()))
.createdUserId(departmentEntity.getCreatedUserId())
.createdDate(SisUtil.getFormattedDateTime(departmentEntity.getCreatedDate()))
.modifiedUserId(departmentEntity.getModifiedUserId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class DepartmentResponse extends SisBaseResponse {
private String name;
private DepartmentStatus status;
private Integer totalClassLevel;
private Boolean isTherePreparatoryClass;
private Integer isTherePreparatoryClass;

private FacultyResponse facultyResponse;
}