-
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 #16 from hyundai-fruitfruit/HEENDY-43-user-visit-QR
[HEENDY-43-user-visit-QR] 유저용 이벤트 참여 API 구현
- Loading branch information
Showing
16 changed files
with
276 additions
and
4 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/main/java/com/hyundai/app/coupon/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,34 @@ | ||
package com.hyundai.app.coupon.controller; | ||
|
||
import com.hyundai.app.common.AdventureOfHeendyResponse; | ||
import com.hyundai.app.coupon.domain.Coupon; | ||
import com.hyundai.app.coupon.service.CouponService; | ||
import com.hyundai.app.security.methodparam.MemberId; | ||
import io.swagger.annotations.Api; | ||
import io.swagger.annotations.ApiOperation; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import springfox.documentation.annotations.ApiIgnore; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author 엄상은 | ||
* @since 2024/02/23 | ||
* 사용자용 쿠폰 컨트롤러 | ||
*/ | ||
@Api("사용자용 쿠폰 관련 API") | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/coupons") | ||
@RestController | ||
public class CouponController { | ||
private final CouponService couponService; | ||
|
||
@ApiOperation("사용자용 쿠폰 전체 조회 API") | ||
@GetMapping | ||
public AdventureOfHeendyResponse<List<Coupon>> findCouponList(@ApiIgnore @MemberId Integer memberId) { | ||
return AdventureOfHeendyResponse.success("사용자의 쿠폰 목록을 가져왔습니다.", couponService.findMemberCouponList(memberId)); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/com/hyundai/app/coupon/domain/MemberCoupon.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,29 @@ | ||
package com.hyundai.app.coupon.domain; | ||
|
||
import com.hyundai.app.common.entity.BaseEntity; | ||
|
||
import java.time.LocalDate; | ||
|
||
/** | ||
* @author 엄상은 | ||
* @since 2024/02/22 | ||
* 유저가 가지고 있는 쿠폰 엔티티 | ||
*/ | ||
public class MemberCoupon extends BaseEntity { | ||
private int id; | ||
private int memberId; | ||
private int couponId; | ||
private int isUsed; | ||
private String channelType; | ||
private LocalDate expiredAt; | ||
|
||
public MemberCoupon(int memberId, int couponId, String channelType) { | ||
this.memberId = memberId; | ||
this.couponId = couponId; | ||
this.channelType = channelType; | ||
} | ||
|
||
public static MemberCoupon of(int memberId, int couponId, String channelType) { | ||
return new MemberCoupon(memberId, couponId, channelType); | ||
} | ||
} |
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
12 changes: 12 additions & 0 deletions
12
src/main/java/com/hyundai/app/coupon/mapper/MemberCouponMapper.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,12 @@ | ||
package com.hyundai.app.coupon.mapper; | ||
|
||
import com.hyundai.app.coupon.domain.MemberCoupon; | ||
|
||
/** | ||
* @author 엄상은 | ||
* @since 2024/02/22 | ||
* 쿠폰을 가진 사용자 매퍼 | ||
*/ | ||
public interface MemberCouponMapper { | ||
void saveMemberCoupon(MemberCoupon memberCoupon); | ||
} |
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
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
32 changes: 32 additions & 0 deletions
32
src/main/java/com/hyundai/app/event/dto/EventParticipateResDto.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,32 @@ | ||
package com.hyundai.app.event.dto; | ||
|
||
import com.hyundai.app.coupon.domain.Coupon; | ||
import lombok.Getter; | ||
|
||
/** | ||
* @author 엄상은 | ||
* @since 2024/02/22 | ||
* 이벤트 참여 응답 DTO | ||
*/ | ||
@Getter | ||
public class EventParticipateResDto { | ||
EventDetailResDto eventDetailResDto; | ||
Coupon coupon; | ||
|
||
public EventParticipateResDto(EventDetailResDto eventDetailResDto, Coupon coupon) { | ||
this.eventDetailResDto = eventDetailResDto; | ||
this.coupon = coupon; | ||
} | ||
|
||
public static EventParticipateResDto from(EventDetailResDto eventDetailResDto, Coupon coupon) { | ||
return new EventParticipateResDto(eventDetailResDto, coupon); | ||
} | ||
|
||
public static EventParticipateResDto of(EventDetailResDto eventDetailResDto) { | ||
return new EventParticipateResDto(eventDetailResDto, null); | ||
} | ||
|
||
public void updateCoupon(Coupon coupon) { | ||
this.coupon = coupon; | ||
} | ||
} |
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
14 changes: 14 additions & 0 deletions
14
src/main/java/com/hyundai/app/event/mapper/MemberEventMapper.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,14 @@ | ||
package com.hyundai.app.event.mapper; | ||
|
||
import com.hyundai.app.event.domain.MemberEvent; | ||
import org.apache.ibatis.annotations.Mapper; | ||
|
||
/** | ||
* @author 엄상은 | ||
* @since 2024/02/21 | ||
* 이벤트에 참여한 회원 Mapper | ||
*/ | ||
@Mapper | ||
public interface MemberEventMapper { | ||
void saveMemberEvent(MemberEvent memberEvent); | ||
} |
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
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,17 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!DOCTYPE mapper | ||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
<mapper namespace="com.hyundai.app.coupon.mapper.MemberCouponMapper"> | ||
<!-- @author 엄상은 --> | ||
<!-- @since 2024/02/22 --> | ||
<!-- 쿠폰을 가진 멤버 mapper --> | ||
<insert id="saveMemberCoupon" parameterType="membercoupon"> | ||
INSERT INTO member_coupon (member_id | ||
, coupon_id | ||
, channel_type) | ||
VALUES (#{memberId} | ||
, #{couponId} | ||
, #{channelType}) | ||
</insert> | ||
</mapper> |
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,15 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!DOCTYPE mapper | ||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
<mapper namespace="com.hyundai.app.event.mapper.MemberEventMapper"> | ||
<!-- @author 엄상은 --> | ||
<!-- @since 2024/02/22 --> | ||
<!-- 이벤트에 참여한 멤버 mapper --> | ||
<insert id="saveMemberEvent" parameterType="memberevent"> | ||
INSERT INTO member_event (member_id | ||
, event_id) | ||
VALUES (#{memberId} | ||
, #{eventId}) | ||
</insert> | ||
</mapper> |