Skip to content

Commit 8a7fd40

Browse files
authored
Merge pull request #309 from DevKor-github/codex/prod-admin-login-only
hotfix: deploy production admin login only
2 parents 784af1a + 13e0f53 commit 8a7fd40

192 files changed

Lines changed: 210 additions & 12167 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/cd-dev.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: CI/CD using github actions & docker
22

33
on:
4-
workflow_dispatch:
54
push:
65
branches:
76
- develop
@@ -54,6 +53,10 @@ jobs:
5453
needs: push_to_registry
5554
runs-on: ubuntu-latest
5655
steps:
56+
- name: Get Github action IP
57+
id: ip
58+
uses: haythem/public-ip@v1.2
59+
5760
- name: Deploy to prod
5861
if: contains(github.ref, 'develop') || contains(github.ref, 'main')
5962
uses: appleboy/ssh-action@master

.github/workflows/cd.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ jobs:
5656
needs: push_to_registry
5757
runs-on: ubuntu-latest
5858
steps:
59+
- name: Get Github action IP
60+
id: ip
61+
uses: haythem/public-ip@v1.2
62+
5963
- name: Deploy to prod
6064
if: contains(github.ref, 'develop') || contains(github.ref, 'main')
6165
uses: appleboy/ssh-action@master

.gitignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,3 @@ out/
4444
###claude###
4545
.claude
4646
.serena
47-
48-
# Local-only config
49-
/src/main/resources/application-local.yml
50-
/.env.local
51-
/docker-compose.local.yml

src/main/java/devkor/com/teamcback/domain/ble/event/PlaceBecameVacantEvent.java

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/main/java/devkor/com/teamcback/domain/ble/repository/BLEDataRepository.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@
1111

1212
public interface BLEDataRepository extends JpaRepository<BLEData, Long> {
1313
Optional<BLEData> findTopByDeviceOrderByLastTimeDesc(BLEDevice device);
14-
Optional<BLEData> findTopByDeviceOrderByLastTimeDescIdDesc(BLEDevice device);
1514
List<BLEData> findAllByDeviceAndLastTimeBetweenOrderByLastTimeAsc(BLEDevice device, LocalDateTime start, LocalDateTime end);
1615
}

src/main/java/devkor/com/teamcback/domain/ble/service/BLEService.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import devkor.com.teamcback.domain.ble.entity.BLEData;
1010
import devkor.com.teamcback.domain.ble.entity.BLEDevice;
1111
import devkor.com.teamcback.domain.ble.entity.BLEstatus;
12-
import devkor.com.teamcback.domain.ble.event.PlaceBecameVacantEvent;
1312
import devkor.com.teamcback.domain.ble.repository.BLEDataRepository;
1413
import devkor.com.teamcback.domain.ble.repository.BLEDeviceRepository;
1514
import devkor.com.teamcback.domain.place.entity.Place;
@@ -18,7 +17,6 @@
1817
import devkor.com.teamcback.global.response.ResultCode;
1918
import lombok.RequiredArgsConstructor;
2019
import lombok.extern.slf4j.Slf4j;
21-
import org.springframework.context.ApplicationEventPublisher;
2220
import org.springframework.stereotype.Service;
2321
import org.springframework.transaction.annotation.Transactional;
2422

@@ -36,7 +34,6 @@ public class BLEService {
3634
private final BLEDeviceRepository bledeviceRepository;
3735
private final BLEDataRepository bleDataRepository;
3836
private final PlaceRepository placeRepository;
39-
private final ApplicationEventPublisher eventPublisher;
4037

4138
// 평균 구해올 시간대 라벨
4239
private static final int[] TIME_SLOTS = {7, 10, 13, 16, 19, 22};
@@ -49,11 +46,6 @@ public class BLEService {
4946
@Transactional
5047
public UpdateBLERes updateBLE(UpdateBLEReq updateBLEReq) {
5148
BLEDevice bleDevice = bledeviceRepository.findByDeviceName(updateBLEReq.getDeviceName());
52-
if (bleDevice == null) {
53-
throw new GlobalException(ResultCode.NOT_FOUND_DEVICE_NAME);
54-
}
55-
BLEData previousData = bleDataRepository.findTopByDeviceOrderByLastTimeDescIdDesc(bleDevice)
56-
.orElse(null);
5749
int capacity = bleDevice.getCapacity();
5850
int people = getBlEPeople(updateBLEReq.getLastCount(), bleDevice);
5951
double final_ratio = (double) people / capacity;
@@ -69,29 +61,9 @@ public UpdateBLERes updateBLE(UpdateBLEReq updateBLEReq) {
6961
bleData.setLastTime(updateBLEReq.getLastTime());
7062
bleDataRepository.save(bleData);
7163

72-
if (becameVacant(previousData, status) && bleDevice.getPlace() != null) {
73-
eventPublisher.publishEvent(new PlaceBecameVacantEvent(
74-
bleDevice.getPlace().getId(),
75-
bleData.getId(),
76-
bleData.getLastTime()
77-
));
78-
}
79-
8064
return new UpdateBLERes(bleData);
8165
}
8266

83-
private boolean becameVacant(
84-
BLEData previousData,
85-
BLEstatus newStatus
86-
) {
87-
if (!BLEstatus.VACANT.equals(newStatus) || previousData == null) {
88-
return false;
89-
}
90-
91-
return BLEstatus.AVAILABLE.equals(previousData.getLastStatus())
92-
|| BLEstatus.CROWDED.equals(previousData.getLastStatus());
93-
}
94-
9567
private int getBlEPeople(int lastCount, BLEDevice bleDevice) {
9668
if (bleDevice == null) throw new GlobalException(ResultCode.NOT_FOUND_DEVICE_NAME);
9769
double ratio = bleDevice.getRatio();

src/main/java/devkor/com/teamcback/domain/bookmark/repository/CategoryRepository.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,4 @@ List<Category> findCategoriesByUserAndLocationTypeAndLocationId(
2727

2828
@Query("SELECT c FROM Category c LEFT JOIN FETCH c.categoryBookmarkList WHERE c.user = :user")
2929
List<Category> findByUser(@Param("user") User user);
30-
31-
@Query("""
32-
SELECT DISTINCT c.user.userId FROM CategoryBookmark cb
33-
JOIN cb.category c
34-
JOIN cb.bookmark b
35-
WHERE c.user IS NOT NULL AND b.locationType = :locationType AND b.locationId = :locationId
36-
""")
37-
List<Long> findDistinctUserIdsByLocationTypeAndLocationId(
38-
@Param("locationType") LocationType locationType,
39-
@Param("locationId") Long locationId
40-
);
4130
}

src/main/java/devkor/com/teamcback/domain/character/controller/AdminStoreController.java

Lines changed: 0 additions & 124 deletions
This file was deleted.

src/main/java/devkor/com/teamcback/domain/character/controller/StoreController.java

Lines changed: 0 additions & 129 deletions
This file was deleted.

0 commit comments

Comments
 (0)