Skip to content

Commit

Permalink
START_DATE and END_DATE Fields Changes in FEATURE_TOGGLE Table Has Be…
Browse files Browse the repository at this point in the history
…en Integrated to Feature Toggle API (#74)
  • Loading branch information
agitrubard authored Mar 27, 2022
1 parent 45440ed commit 4ccca17
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public FeatureToggleResponse entityToResponse(final FeatureToggleEntity featureT
.id(featureToggleEntity.getId())
.name(featureToggleEntity.getName())
.isEnabled(featureToggleEntity.getIsEnabled())
.date(SisUtil.getFormattedDateTime(featureToggleEntity.getDate()))
.startDate(SisUtil.getFormattedDateTime(featureToggleEntity.getStartDate()))
.endDate(SisUtil.getFormattedDateTime(featureToggleEntity.getEndDate()))
.createdUserId(featureToggleEntity.getCreatedUserId())
.createdDate(SisUtil.getFormattedDateTime(featureToggleEntity.getCreatedDate()))
.modifiedUserId(featureToggleEntity.getModifiedUserId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ public class FeatureToggleResponse extends SisBaseResponse {
private Long id;
private FeatureToggleName name;
private Boolean isEnabled;
private String date;
private String startDate;
private String endDate;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ public class FeatureToggleEntity extends SisBaseEntity {
private Long id;
private FeatureToggleName name;
private Boolean isEnabled;
private Date date;
private Date startDate;
private Date endDate;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
public enum FeatureToggleName {

LESSON_REGISTRATION_OPERATIONS("Ders Kayıt İşlemleri"),
NOTE_OPERATIONS("Not İşlemleri");
NOTE_OPERATIONS("Not İşlemleri"),
MIDTERM_NOTE_OPERATIONS("Vize Not İşlemleri"),
FINAL_NOTE_OPERATIONS("Final Not İşlemleri"),
RESIT_NOTE_OPERATIONS("Bütünleme Not İşlemleri");

private final String tr;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public enum FeatureToggleMapping {
ID("ID", "id"),
NAME("NAME", "name"),
IS_ENABLED("IS_ENABLED", "isEnabled"),
DATE("DATE", "date"),
START_DATE("START_DATE", "startDate"),
END_DATE("END_DATE", "endDate"),
CREATED_DATE("CREATED_DATE", "createdDate"),
CREATED_USER_ID("CREATED_USER_ID", "createdUserId"),
MODIFIED_DATE("MODIFIED_DATE", "modifiedDate"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ private FeatureToggleSqlScripts() {
}

/**
* SELECT ID, NAME, IS_ENABLED, DATE,
* SELECT ID, NAME, IS_ENABLED, START_DATE, END_DATE,
* CREATED_DATE, CREATED_USER_ID, MODIFIED_DATE, MODIFIED_USER_ID FROM UNIV_FEATURE_TOGGLE;
*/
public static final String GET_ALL_FEATURE_TOGGLES =
sqlBuilder.delete(0, sqlBuilder.length())
.append("SELECT ID, NAME, IS_ENABLED, DATE, " +
.append("SELECT ID, NAME, IS_ENABLED, START_DATE, END_DATE, " +
"CREATED_DATE, CREATED_USER_ID, MODIFIED_DATE, MODIFIED_USER_ID " +
"FROM UNIV_FEATURE_TOGGLE ").toString();

/**
* SELECT ID, NAME, IS_ENABLED, DATE,
* SELECT ID, NAME, IS_ENABLED, START_DATE, END_DATE,
* CREATED_DATE, CREATED_USER_ID, MODIFIED_DATE, MODIFIED_USER_ID FROM UNIV_FEATURE_TOGGLE
* WHERE NAME=:name;
*/
Expand Down Expand Up @@ -64,11 +64,13 @@ private FeatureToggleSqlScripts() {

/**
* SELECT CASE WHEN MAX(NAME) IS NULL THEN 'false' ELSE 'true' END IS_EXIST
* FROM UNIV_FEATURE_TOGGLE WHERE NAME=:name AND IS_ENABLED=1 AND DATE < NOW();
* FROM UNIV_FEATURE_TOGGLE WHERE NAME=:name AND IS_ENABLED=1 AND
* NOW() > START_DATE AND NOW() < END_DATE;
*/
public static final String IS_FEATURE_TOGGLE_ENABLED =
sqlBuilder.delete(0, sqlBuilder.length())
.append("SELECT CASE WHEN MAX(NAME) IS NULL " +
"THEN 'false' ELSE 'true' END IS_EXIST FROM UNIV_FEATURE_TOGGLE " +
"WHERE NAME=:name AND IS_ENABLED='1' AND DATE < NOW()").toString();
"WHERE NAME=:name AND IS_ENABLED='1' AND " +
"NOW() > START_DATE AND NOW() < END_DATE").toString();
}

0 comments on commit 4ccca17

Please sign in to comment.