generated from pricelees/issue-pr-template
refactor: Reservation의 회원 ID 컬럼명 수정 (member_id -> user_id)
This commit is contained in:
parent
741888f156
commit
e0972550d4
@ -44,7 +44,7 @@ class PaymentService(
|
||||
}
|
||||
}
|
||||
|
||||
fun cancel(memberId: Long, request: PaymentCancelRequest) {
|
||||
fun cancel(userId: Long, request: PaymentCancelRequest) {
|
||||
val payment: PaymentEntity = findByReservationIdOrThrow(request.reservationId)
|
||||
|
||||
val clientCancelResponse: PaymentClientCancelResponse = paymentClient.cancel(
|
||||
@ -55,7 +55,7 @@ class PaymentService(
|
||||
|
||||
transactionExecutionUtil.withNewTransaction(isReadOnly = false) {
|
||||
paymentWriter.cancel(
|
||||
memberId = memberId,
|
||||
userId = userId,
|
||||
payment = payment,
|
||||
requestedAt = request.requestedAt,
|
||||
cancelResponse = clientCancelResponse
|
||||
|
||||
@ -59,7 +59,7 @@ class PaymentWriter(
|
||||
}
|
||||
|
||||
fun cancel(
|
||||
memberId: Long,
|
||||
userId: Long,
|
||||
payment: PaymentEntity,
|
||||
requestedAt: LocalDateTime,
|
||||
cancelResponse: PaymentClientCancelResponse
|
||||
@ -72,7 +72,7 @@ class PaymentWriter(
|
||||
id = tsidFactory.next(),
|
||||
paymentId = payment.id,
|
||||
cancelRequestedAt = requestedAt,
|
||||
canceledBy = memberId
|
||||
canceledBy = userId
|
||||
).also {
|
||||
canceledPaymentRepository.save(it)
|
||||
log.debug { "[PaymentWriterV2.cancelPayment] 결제 취소 정보 저장 완료: payment.id=${payment.id}" }
|
||||
|
||||
@ -11,7 +11,7 @@ import roomescape.common.entity.AuditingBaseEntity
|
||||
class ReservationEntity(
|
||||
id: Long,
|
||||
|
||||
val memberId: Long,
|
||||
val userId: Long,
|
||||
val scheduleId: Long,
|
||||
val reserverName: String,
|
||||
val reserverContact: String,
|
||||
|
||||
@ -4,5 +4,5 @@ import org.springframework.data.jpa.repository.JpaRepository
|
||||
|
||||
interface ReservationRepository : JpaRepository<ReservationEntity, Long> {
|
||||
|
||||
fun findAllByMemberId(memberId: Long): List<ReservationEntity>
|
||||
fun findAllByUserId(userId: Long): List<ReservationEntity>
|
||||
}
|
||||
|
||||
@ -19,9 +19,9 @@ data class PendingReservationCreateRequest(
|
||||
val requirement: String
|
||||
)
|
||||
|
||||
fun PendingReservationCreateRequest.toEntity(id: Long, memberId: Long) = ReservationEntity(
|
||||
fun PendingReservationCreateRequest.toEntity(id: Long, userId: Long) = ReservationEntity(
|
||||
id = id,
|
||||
memberId = memberId,
|
||||
userId = userId,
|
||||
scheduleId = this.scheduleId,
|
||||
reserverName = this.reserverName,
|
||||
reserverContact = this.reserverContact,
|
||||
|
||||
@ -108,7 +108,7 @@ create table if not exists schedule (
|
||||
|
||||
create table if not exists reservation (
|
||||
id bigint primary key,
|
||||
member_id bigint not null,
|
||||
user_id bigint not null,
|
||||
schedule_id bigint not null,
|
||||
reserver_name varchar(30) not null,
|
||||
reserver_contact varchar(30) not null,
|
||||
@ -120,7 +120,7 @@ create table if not exists reservation (
|
||||
updated_at timestamp not null,
|
||||
updated_by bigint not null,
|
||||
|
||||
constraint fk_reservation__member_id foreign key (member_id) references members (member_id),
|
||||
constraint fk_reservation__user_id foreign key (user_id) references users (id),
|
||||
constraint fk_reservation__schedule_id foreign key (schedule_id) references schedule (id)
|
||||
);
|
||||
|
||||
@ -133,8 +133,7 @@ create table if not exists canceled_reservation (
|
||||
status varchar(30) not null,
|
||||
|
||||
constraint uk_canceled_reservations__reservation_id unique (reservation_id),
|
||||
constraint fk_canceled_reservations__reservation_id foreign key (reservation_id) references reservation (id),
|
||||
constraint fk_canceled_reservations__canceled_by foreign key (canceled_by) references members (member_id)
|
||||
constraint fk_canceled_reservations__reservation_id foreign key (reservation_id) references reservation (id)
|
||||
);
|
||||
|
||||
create table if not exists payment (
|
||||
@ -208,6 +207,5 @@ create table if not exists canceled_payment(
|
||||
easypay_discount_amount integer not null,
|
||||
|
||||
constraint uk_canceled_payment__paymentId unique (payment_id),
|
||||
constraint fk_canceled_payment__paymentId foreign key (payment_id) references payment(id),
|
||||
constraint fk_canceled_payment__canceledBy foreign key (canceled_by) references members(member_id)
|
||||
constraint fk_canceled_payment__paymentId foreign key (payment_id) references payment(id)
|
||||
);
|
||||
|
||||
@ -184,7 +184,7 @@ class DummyInitializer(
|
||||
}
|
||||
|
||||
fun cancelPayment(
|
||||
memberId: Long,
|
||||
userId: Long,
|
||||
reservationId: Long,
|
||||
cancelReason: String,
|
||||
): CanceledPaymentEntity {
|
||||
@ -197,7 +197,7 @@ class DummyInitializer(
|
||||
)
|
||||
|
||||
return paymentWriter.cancel(
|
||||
memberId,
|
||||
userId,
|
||||
payment,
|
||||
requestedAt = LocalDateTime.now(),
|
||||
clientCancelResponse
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user