Skip to content

Commit

Permalink
✨ 민원 시에 인증 필수 제거 (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
mangchhe committed Apr 16, 2024
1 parent 17ea8cc commit c41b1ce
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ComplaintController(
return CommonResponse.success(complaintUseCase.searchComplaintMessages(pageable))
}

@Authentication
@Authentication(required = false)
@PostMapping("/v1/complaints/messages")
fun sendComplaintMessage(@RequestBody request: SendComplaintMessageDto.Request): CommonResponse<Unit> {
complaintUseCase.sendComplaintMessage(request.toCommand())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SendComplaintMessageCommand(
val subwayLineId: Long,
) {

fun toEntity(member: MemberEntity, subwayLine: SubwayLineEntity): ComplaintMessageHistoryEntity {
fun toEntity(member: MemberEntity?, subwayLine: SubwayLineEntity): ComplaintMessageHistoryEntity {
return ComplaintMessageHistoryEntity(
sentContent = content,
complaintType = complainType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ComplaintService(
subwayLineId = it.subwayLine.id,
createdAt = it.createdAt,
createdBy = it.createdBy,
writer = it.member.nickname!!
writer = it.member!!.nickname!!
) }

return SearchComplaintMessagesDto.Response.of(
Expand All @@ -46,10 +46,12 @@ class ComplaintService(

@Transactional
override fun sendComplaintMessage(command: SendComplaintMessageCommand) {
val memberId = RequestUtils.getAttribute("memberId")!!
val memberId = RequestUtils.getAttribute("memberId")
val member = memberId?.let { memberReader.getMember(it.toLong()) }

complaintWriter.save(
command.toEntity(
memberReader.getMember(memberId.toLong()),
member,
subwayLineReader.getById(command.subwayLineId))
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ComplaintMessageHistoryEntity(

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "sent_member_id")
val member: MemberEntity,
val member: MemberEntity? = null,

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "sent_subway_line_id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import io.jsonwebtoken.UnsupportedJwtException
import io.jsonwebtoken.security.SignatureException
import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse
import org.apache.http.protocol.ResponseServer
import org.springframework.stereotype.Component
import org.springframework.web.method.HandlerMethod
import org.springframework.web.servlet.HandlerInterceptor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ ALTER TABLE tb_complaint_message_history
ADD COLUMN complaint_message_status_type VARCHAR(20) NOT NULL;

ALTER TABLE tb_complaint_message_history
ADD COLUMN location INT NOT NULL;
ADD COLUMN location INT NOT NULL;

ALTER TABLE tb_complaint_message_history
MODIFY sent_member_id BIGINT NULL;

0 comments on commit c41b1ce

Please sign in to comment.