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

@@ -66,8 +66,16 @@ async function buildConfirmedFinalist() {
},
})
// Hotel for the program (1:1)
await prisma.hotel.create({
const attendee = await prisma.attendingMember.create({
data: {
confirmationId: confirmation.id,
userId: user.id,
needsVisa: true,
},
})
// Hotel for the program + HotelStay assigning the attendee to it
const hotel = await prisma.hotel.create({
data: {
programId: program.id,
name: 'Hotel Hermitage',
@@ -77,11 +85,13 @@ async function buildConfirmedFinalist() {
},
})
const attendee = await prisma.attendingMember.create({
await prisma.hotelStay.create({
data: {
confirmationId: confirmation.id,
userId: user.id,
needsVisa: true,
attendingMemberId: attendee.id,
hotelId: hotel.id,
roomNumber: '204',
checkInAt: new Date('2026-06-20T14:00:00Z'),
checkOutAt: new Date('2026-06-23T11:00:00Z'),
},
})
@@ -125,6 +135,9 @@ describe('applicant.getMyLogistics', () => {
await prisma.flightDetail.deleteMany({
where: { attendingMember: { confirmation: { project: { programId } } } },
})
await prisma.hotelStay.deleteMany({
where: { attendingMember: { confirmation: { project: { programId } } } },
})
await prisma.hotel.deleteMany({ where: { programId } })
await prisma.attendingMember.deleteMany({
where: { confirmation: { project: { programId } } },
@@ -154,6 +167,8 @@ describe('applicant.getMyLogistics', () => {
expect(result!.confirmationStatus).toBe('CONFIRMED')
expect(result!.hotel).not.toBeNull()
expect(result!.hotel!.name).toBe('Hotel Hermitage')
expect(result!.room).not.toBeNull()
expect(result!.room!.roomNumber).toBe('204')
expect(result!.myFlight).not.toBeNull()
expect(result!.myFlight!.arrivalFlightNumber).toBe('AF1234')
expect(result!.myFlight!.arrivalAirport).toBe('NCE')
@@ -227,6 +242,9 @@ describe('applicant.updateMyVisaNationality', () => {
await prisma.flightDetail.deleteMany({
where: { attendingMember: { confirmation: { project: { programId } } } },
})
await prisma.hotelStay.deleteMany({
where: { attendingMember: { confirmation: { project: { programId } } } },
})
await prisma.hotel.deleteMany({ where: { programId } })
await prisma.attendingMember.deleteMany({
where: { confirmation: { project: { programId } } },