Skip to content

Commit

Permalink
Merge pull request #279 from softeerbootcamp/dev
Browse files Browse the repository at this point in the history
주유 기록 입력 validation check 반영
  • Loading branch information
jaewonjjang authored Feb 22, 2023
2 parents b2c0e1b + 6a1e4db commit 878cab0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static UserGasRecordResDto toUserGasRecordResDto(UserGasRecord userGasRec
return UserGasRecordResDto.builder()
.chargeDate((userGasRecord.getChargeDate()))
.gasStationName(gasStation.getName())
.gasType(userGasRecord.getRecordGasType().getOpinetGasType())
.gasType(userGasRecord.getRecordGasType().getDtoName())
.recordGasAmount(userGasRecord.getRecordGasAmount() + "L")
.refuelingPrice(userGasRecord.getRefuelingPrice() + "원")
.savingPrice(userGasRecord.getSavingPrice() + "원")
Expand Down
12 changes: 7 additions & 5 deletions backend/src/main/java/com/kaspi/backend/enums/GasType.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@

@Getter
public enum GasType {
PREMIUM_GASOLINE("고급휘발유"),
GASOLINE("휘발유"),
DIESEL("자동차용경유"),
LPG("자동차용부탄");
PREMIUM_GASOLINE("고급휘발유","고급휘발유"),
GASOLINE("휘발유","휘발유"),
DIESEL("자동차용경유","경유"),
LPG("자동차용부탄","LPG");

private String opinetGasType;
private String dtoName;

GasType(String opinetGasType) {
GasType(String opinetGasType,String dtoName) {
this.opinetGasType = opinetGasType;
this.dtoName = dtoName;
}

public static Optional<GasType> getTypeFromOpinetData(String opinetdata) {
Expand Down
6 changes: 6 additions & 0 deletions frontEnd/public/js/myPage/inputOilInfo/helperFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ const OIL_PRICE_UPPER_BOUND = 150_000;

const parseOilPriceIntoKorean = ($input, $effectImage) => {
let inputValue = $input.value;

if(inputValue[0] === "-") {
$input.value = "";
return "음수는 불가능합니다.";
}

let inputToNumber = parseInt(inputValue);
if(isNaN(inputToNumber)) return "숫자를 입력해주세요.";

Expand Down

0 comments on commit 878cab0

Please sign in to comment.