-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from Team-MindWay/72-goal-delete-implement
🔀 :: 주기적으로 목표 삭제
- Loading branch information
Showing
4 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
src/main/java/com/mindway/server/v2/MindWayV2Application.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/main/java/com/mindway/server/v2/domain/goal/scheduler/GoalScheduler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.mindway.server.v2.domain.goal.scheduler; | ||
|
||
import com.mindway.server.v2.domain.goal.service.GoalsDeleteService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.scheduling.annotation.Scheduled; | ||
|
||
@RequiredArgsConstructor | ||
public class GoalScheduler { | ||
|
||
private final GoalsDeleteService goalsDeleteService; | ||
|
||
@Scheduled(cron = "0 0 0 * * MON", zone = "Asia/Seoul") | ||
public void deleteGoals() { | ||
goalsDeleteService.execute(); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/com/mindway/server/v2/domain/goal/service/GoalsDeleteService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.mindway.server.v2.domain.goal.service; | ||
|
||
public interface GoalsDeleteService { | ||
void execute(); | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/mindway/server/v2/domain/goal/service/impl/GoalsDeleteServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.mindway.server.v2.domain.goal.service.impl; | ||
|
||
import com.mindway.server.v2.domain.goal.repository.GoalRepository; | ||
import com.mindway.server.v2.domain.goal.service.GoalsDeleteService; | ||
import com.mindway.server.v2.global.annotation.ServiceWithTransaction; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@ServiceWithTransaction | ||
@RequiredArgsConstructor | ||
public class GoalsDeleteServiceImpl implements GoalsDeleteService { | ||
|
||
private final GoalRepository goalRepository; | ||
|
||
public void execute() { | ||
goalRepository.deleteAll(); | ||
} | ||
|
||
} |