-
Notifications
You must be signed in to change notification settings - Fork 1
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 #28 from sikcal/service
Update Calendar Logic && Fix Token Error : Remove setToken
- Loading branch information
Showing
7 changed files
with
36 additions
and
17 deletions.
There are no files selected for viewing
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
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
15 changes: 8 additions & 7 deletions
15
src/main/java/com/prob_jr/sikcal_app/domain/controller/CalendarController.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 |
---|---|---|
@@ -1,26 +1,27 @@ | ||
package com.prob_jr.sikcal_app.domain.controller; | ||
|
||
import com.prob_jr.sikcal_app.domain.CalendarStatus; | ||
import com.prob_jr.sikcal_app.domain.controller.dto.CalendarStateInfo; | ||
import com.prob_jr.sikcal_app.domain.controller.dto.CheckTargetRequest; | ||
import com.prob_jr.sikcal_app.domain.service.CalendarService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.scheduling.annotation.Scheduled; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/user") | ||
public class CalendarController { | ||
|
||
private final CalendarService calendarService; | ||
|
||
@Scheduled(cron = "0 0 0 * * *") | ||
@GetMapping("/calendar-goal") | ||
public ResponseEntity<Void> checkTargetWeight(@RequestBody CheckTargetRequest checkTargetRequest) { | ||
calendarService.checkTargetKcal(checkTargetRequest.toServiceDto()); | ||
@GetMapping("/calendar") | ||
public ResponseEntity<CalendarStateInfo> checkTargetWeight(@ModelAttribute CheckTargetRequest checkTargetRequest) { | ||
CalendarStateInfo calendarStateInfo = calendarService.checkTargetKcal(checkTargetRequest.toServiceDto()); | ||
|
||
return ResponseEntity.ok().build(); | ||
return ResponseEntity.ok(calendarStateInfo); | ||
} | ||
|
||
|
||
|
||
} |
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
18 changes: 18 additions & 0 deletions
18
src/main/java/com/prob_jr/sikcal_app/domain/controller/dto/CalendarStateInfo.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.prob_jr.sikcal_app.domain.controller.dto; | ||
|
||
import com.prob_jr.sikcal_app.domain.CalendarStatus; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import org.springframework.format.annotation.DateTimeFormat; | ||
|
||
import java.time.LocalDate; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class CalendarStateInfo { | ||
|
||
@DateTimeFormat(pattern = "yyyy-MM-dd") | ||
private LocalDate yesterday; | ||
|
||
private CalendarStatus status; | ||
} |
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
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