This repository has been archived by the owner on Aug 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
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 #57 from f-lab-edu/푸시_서비스_적용
[#55] 푸시 서비스 적용
- Loading branch information
Showing
55 changed files
with
3,005 additions
and
151 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
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,28 @@ | ||
package com.delfood.aop; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* 로그인의 상태를 확인한다. | ||
* 회원, 사장님, 라이더의 로그인 상태를 확인하여 로그인 되지 않았다면 예외를 발생시킨다. | ||
* @author jun | ||
* | ||
*/ | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.METHOD) | ||
public @interface LoginCheck { | ||
|
||
/** | ||
* 로그인을 체크하고 싶은 유저의 로그인 타입. | ||
* 회원(MEMBER), 사장님(OWNER), 라이더(RIDER)중 선택할 수 있다. | ||
* @return | ||
*/ | ||
UserType type(); | ||
|
||
public static enum UserType { | ||
MEMBER, OWNER, RIDER | ||
} | ||
} |
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,15 +1,22 @@ | ||
package com.delfood.aop; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* <b>매장 id가 첫 번째 파라미터로 와야한다.</b> | ||
* <b>매장 id를 파라미터로 주어야 한다.</b> | ||
* 접속한 사장님이 해당 매장의 주인인지 확인한다. | ||
* @author yyy99 | ||
* | ||
*/ | ||
@Target(ElementType.METHOD) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface OwnerShopCheck { | ||
|
||
/** | ||
* 해당 변수의 이름. | ||
* @return | ||
*/ | ||
String value(); | ||
} |
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,9 @@ | ||
package com.delfood.aop; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Target; | ||
|
||
@Target(ElementType.METHOD) | ||
public @interface RiderLoginCheck { | ||
|
||
} |
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
78 changes: 78 additions & 0 deletions
78
src/main/java/com/delfood/controller/CouponController.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,78 @@ | ||
package com.delfood.controller; | ||
|
||
import com.delfood.dto.CouponDTO; | ||
import com.delfood.service.CouponService; | ||
import lombok.extern.log4j.Log4j2; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PatchMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@Log4j2 | ||
@RestController | ||
@RequestMapping("/coupons/") | ||
public class CouponController { | ||
|
||
@Autowired | ||
CouponService couponService; | ||
|
||
/** | ||
* 쿠폰을 추가한다. | ||
* @param couponInfo 쿠폰 정보 | ||
* @return | ||
* | ||
* @author jinyoung | ||
*/ | ||
@PostMapping | ||
public void addCoupon(@RequestBody CouponDTO couponInfo) { | ||
|
||
if (CouponDTO.hasNullData(couponInfo)) { | ||
log.error("insufficient coupon information! {}", couponInfo.toString()); | ||
throw new NullPointerException("insufficient coupon information! " + couponInfo.toString()); | ||
} | ||
|
||
couponService.addCoupon(couponInfo); | ||
} | ||
|
||
/** | ||
* 쿠폰 이름과 만료일을 수정한다. | ||
* | ||
* @param id 쿠폰 아이디 | ||
* @param name 수정할 쿠폰 이름 | ||
* @param endAt 수정할 만료일 | ||
* | ||
* @author jinyoung | ||
*/ | ||
@PatchMapping | ||
public void updateCouponNameAndEndAt(Long id, String name, LocalDateTime endAt) { | ||
couponService.updateCouponNameAndEndAt(id, name, endAt); | ||
} | ||
|
||
/** | ||
* 쿠폰을 삭제한다. | ||
* | ||
* @param id 쿠폰 아이디 | ||
*/ | ||
public void deleteCoupon(Long id) { | ||
couponService.deleteCoupon(id); | ||
} | ||
|
||
|
||
/** | ||
* 만료일이 지나지 않은 쿠폰들을 조회한다. | ||
* @return 쿠폰리스트 | ||
* | ||
* @author jinyoung | ||
*/ | ||
@GetMapping | ||
public List<CouponDTO> getAvailableCoupons() { | ||
return couponService.getAvaliableCoupons(); | ||
} | ||
|
||
} |
Oops, something went wrong.