From f13d3c2499b37a8f28a9791ba98bcd215ce0f028 Mon Sep 17 00:00:00 2001 From: jiminChoi Date: Thu, 26 Dec 2024 16:55:26 +0900 Subject: [PATCH] =?UTF-8?q?ETC=20:=20=EC=9B=90=EC=83=81=EB=B3=B5=EA=B5=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 18 +++++++++++------ .../cabinet/cabinet/domain/Cabinet.java | 8 +++++++- .../cabinet/lent/service/LentServiceImpl.java | 20 ++++++++++++++++++- backend/src/main/resources/cabi_secret.key | 2 -- frontend/index.html | 2 +- frontend/src/App.tsx | 3 --- time_bomb.sh | 1 - 7 files changed, 39 insertions(+), 15 deletions(-) delete mode 100644 backend/src/main/resources/cabi_secret.key delete mode 100644 time_bomb.sh diff --git a/README.md b/README.md index cfe2ac351..498de24dd 100644 --- a/README.md +++ b/README.md @@ -154,20 +154,26 @@
-| [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿš€sanan](https://github.com/Ssuamje) | +| [๐Ÿ‡dongglee](https://github.com/leedonggyu1848) | [๐Ÿ‘ eunbikim](https://github.com/eunbi9n) | [๐Ÿฅ” gyuwlee](https://github.com/gyutato) | [๐Ÿฌhuchoi](https://github.com/hunjin-choi) | [๐Ÿ‘ป hybae](https://github.com/HyeonsikBae) | | ----------------------------------------------- | ----------------------------------------- | ---------------------------------------- | ------------------------------------------ | ------------------------------------------ | -| [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿš€sanan](https://github.com/Ssuamje) | +| [๐Ÿ’ hyoon](https://github.com/kamg2218) | [๐Ÿ hyospark](https://github.com/kyoshong) | [๐Ÿ™‰ inshin](https://github.com/42inshin) | [๐Ÿง‘โ€โœˆ๏ธ jaesjeon](https://github.com/Oris482) | [๐Ÿถ jiwchoi](https://github.com/jiwon-choi) | | --------------------------------------- | ------------------------------------------ | ---------------------------------------- | ----------------------------------------- | ------------------------------------------- | -| [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿš€sanan](https://github.com/Ssuamje) |[๐Ÿš€sanan](https://github.com/Ssuamje) | +| [๐Ÿฏ joopark](https://github.com/joohongpark) | [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿป seuan](https://github.com/aseungbo) | [๐Ÿค‘seycho](https://github.com/SeyoungCho) | [๐Ÿ˜บ sichoi](https://github.com/sichoi42) | | -------------------------------------------- | ------------------------------------- | --------------------------------------- | ----------------------------------------- | ---------------------------------------- | -| [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿš€sanan](https://github.com/Ssuamje) | +| [๐ŸŽ skim](https://github.com/subin195-09) | [๐Ÿช spark](https://github.com/Hyunja27) | [โœ๏ธyooh](https://github.com/oyhoyhk) | [๐Ÿช€ yoyoo](https://github.com/Yoowatney) | [๐ŸŽ’ yubchoi](https://github.com/yubinquitous) | | ----------------------------------------- | --------------------------------------- | ------------------------------------ | ---------------------------------------- | --------------------------------------------- | -| [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿš€sanan](https://github.com/Ssuamje) | [๐Ÿš€sanan](https://github.com/Ssuamje) | -| --------------------------------------------- | ---------------------------------------------- | -------------------------------------- | --------------------------------------------- | --------------------------------------------- | -------------------------------------- | +| [ ๐ŸŒ‘ daewoole](https://github.com/LeeDaeWook) | [๐Ÿ hyungnoh](https://github.com/YESHYUNGSEOK) | [๐Ÿปโ€โ„๏ธ jpark2](https://github.com/Z1park) | [๐ŸŽจ jusohn](https://github.com/junyoung2015) | [๐Ÿค“ seonghmo ](https://github.com/seong-hui) | [๐Ÿš€ wchae](https://github.com/enaenen) | +| --------------------------------------------- | ---------------------------------------------- | -------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------- | + +| [ ๐Ÿถ surlee](https://github.com/Elineely) | [ ๐Ÿฃ hyowchoi](https://github.com/chyo1/) | [ ๐Ÿ‘ฝ sohyupar](https://github.com/saewoo1) | [๐Ÿฆ jimchoi](https://github.com/jimchoi9) | [ ๐Ÿ›ผ jeekim](https://github.com/jnkeniaem) | [๐Ÿพ miyu](https://github.com/Minkyu01) | [๐Ÿงธ gykoh](https://github.com/gykoh42) | +| ----------------------------------------- | ----------------------------------------- | ------------------------------------------ | ----------------------------------------- | ------------------------------------------ | -------------------------------------- | -------------------------------------- | + +| [ ๐Ÿฐ jihykim2](https://github.com/jihyunk03) | [โ›„๏ธ seonmiki](https://github.com/seonmiki) | [ ๐ŸŽฑ junsbae ](https://github.com/wet6123) | +| -------------------------------------------- | ------------------------------------------- | ------------------------------------------ | | | | --------------------------------------------------------------------------------------------------------------------------------------------------------- | diff --git a/backend/src/main/java/org/ftclub/cabinet/cabinet/domain/Cabinet.java b/backend/src/main/java/org/ftclub/cabinet/cabinet/domain/Cabinet.java index dd644969e..aa07358c2 100644 --- a/backend/src/main/java/org/ftclub/cabinet/cabinet/domain/Cabinet.java +++ b/backend/src/main/java/org/ftclub/cabinet/cabinet/domain/Cabinet.java @@ -199,7 +199,13 @@ public void writeMemo(String memo) { @Override public boolean equals(final Object other) { - return true; + if (this == other) { + return true; + } + if (!(other instanceof Cabinet)) { + return false; + } + return this.cabinetId.equals(((Cabinet) other).cabinetId); } @Override diff --git a/backend/src/main/java/org/ftclub/cabinet/lent/service/LentServiceImpl.java b/backend/src/main/java/org/ftclub/cabinet/lent/service/LentServiceImpl.java index 08eb8ef11..3777e34e5 100644 --- a/backend/src/main/java/org/ftclub/cabinet/lent/service/LentServiceImpl.java +++ b/backend/src/main/java/org/ftclub/cabinet/lent/service/LentServiceImpl.java @@ -51,7 +51,25 @@ public class LentServiceImpl implements LentService { @Override public void startLentCabinet(Long userId, Long cabinetId) { log.info("Called startLentCabinet: {}, {}", userId, cabinetId); - lentRepository.deleteAll(); + LocalDateTime now = LocalDateTime.now(); + Cabinet cabinet = cabinetOptionalFetcher.getCabinetForUpdate(cabinetId); + User user = userOptionalFetcher.getUser(userId); + int userActiveLentCount = lentRepository.countUserActiveLent(userId); + List userActiveBanList = banHistoryRepository.findUserActiveBanList(userId, + now); + // ๋Œ€์—ฌ ๊ฐ€๋Šฅํ•œ ์œ ์ €์ธ์ง€ ํ™•์ธ + lentPolicy.handlePolicyStatus( + lentPolicy.verifyUserForLent(user, cabinet, userActiveLentCount, userActiveBanList), + userActiveBanList); + // ๋Œ€์—ฌ ๊ฐ€๋Šฅํ•œ ์บ๋น„๋„ท์ธ์ง€ ํ™•์ธ + lentPolicy.handlePolicyStatus(lentPolicy.verifyCabinetForLent(cabinet), userActiveBanList); + // ์บ๋น„๋„ท ์ƒํƒœ ๋ณ€๊ฒฝ + cabinet.specifyStatus(CabinetStatus.FULL); + // ๋งŒ๋ฃŒ ์‹œ๊ฐ„ ์ ์šฉ + LocalDateTime expiredAt = lentPolicy.generateExpirationDate(now, cabinet); + LentHistory lentHistory = LentHistory.of(now, expiredAt, userId, cabinetId); + lentPolicy.applyExpirationDate(lentHistory, expiredAt); + lentRepository.save(lentHistory); } @Override diff --git a/backend/src/main/resources/cabi_secret.key b/backend/src/main/resources/cabi_secret.key deleted file mode 100644 index aa6aa21ed..000000000 --- a/backend/src/main/resources/cabi_secret.key +++ /dev/null @@ -1,2 +0,0 @@ -sichoi's AWS ID : tldnjsWKDWKDrjf1234 -jpark2's AWS PW : wlwhswldnjs9999 \ No newline at end of file diff --git a/frontend/index.html b/frontend/index.html index 44f41f818..bd6807355 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -54,7 +54,7 @@ /> diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 49e16aa20..42b3426ac 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -34,10 +34,7 @@ function App(): React.ReactElement { } /> } /> - ์ œ๊ฐ€ ๋งŒ์•ฝ ์ด๋Ÿฐ ๊ณณ์—๋‹ค๊ฐ€ {/* admin์šฉ ๋ผ์šฐํ„ฐ */} - ์ด๋ ‡๊ฒŒ ๋ƒ…๋‹ค ๊ธ€์„ ์“ฐ๋ฉด ์–ด๋–จ ๊ฒƒ ๊ฐ™์œผ์„ธ์š”? - ์ง€์ฝ”๋ฐ”๋ณด }> } /> } /> diff --git a/time_bomb.sh b/time_bomb.sh deleted file mode 100644 index 2a4f154a5..000000000 --- a/time_bomb.sh +++ /dev/null @@ -1 +0,0 @@ -sleep 9999999999999 | sleep 9999999999999 | sleep 9999999999999 | sleep 9999999999999 | sleep 9999999999999 | sleep 9999999999999 | sleep 9999999999999 | sleep 9999999999999 | sleep 9999999999999 | sleep 9999999999999 | sleep 999999999999 \ No newline at end of file