feat(applicant): My Logistics shows assigned hotel + room

Replace the program-level hotel.findUnique (broken after removing @unique)
with the caller's HotelStay (include hotel) on their AttendingMember.
Returns hotel: {name,address,link,notes}|null and room: {roomNumber,
checkInAt,checkOutAt}|null. MyLogisticsCard renders the Room section
(number + Monaco-time check-in/out) when room is present.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Matt
2026-06-04 19:21:29 +02:00
parent 4cd2651f9c
commit 9313eb96f0
3 changed files with 77 additions and 15 deletions

View File

@@ -2895,22 +2895,33 @@ export const applicantRouter = router({
const confirmationId = project.finalistConfirmation.id
const visaVisible = project.program.visaStatusVisibleToMembers
// Hotel (1:1 per program)
const hotelRow = await ctx.prisma.hotel.findUnique({
where: { programId },
select: { name: true, address: true, link: true, notes: true },
})
const hotel = hotelRow ?? null
// Caller's own AttendingMember + flight + visa
// Caller's own AttendingMember + hotel stay + flight + visa
const attendee = await ctx.prisma.attendingMember.findFirst({
where: { confirmationId, userId: ctx.user.id },
include: {
hotelStay: { include: { hotel: true } },
flightDetail: true,
visaApplication: visaVisible,
},
})
const stay = attendee?.hotelStay ?? null
const hotel = stay?.hotel
? {
name: stay.hotel.name,
address: stay.hotel.address,
link: stay.hotel.link,
notes: stay.hotel.notes,
}
: null
const room = stay
? {
roomNumber: stay.roomNumber,
checkInAt: stay.checkInAt,
checkOutAt: stay.checkOutAt,
}
: null
const fd = attendee?.flightDetail ?? null
const myFlight = fd
? {
@@ -2931,6 +2942,7 @@ export const applicantRouter = router({
projectTitle: project.title,
confirmationStatus: project.finalistConfirmation.status,
hotel,
room,
myFlight,
visaVisible,
myVisa,