Merge pull request #286 from Nico-J/bugfix/cancellation-eventtype-null
This commit is contained in:
		
						commit
						11fc0f0d2a
					
				
					 1 changed files with 11 additions and 35 deletions
				
			
		|  | @ -134,38 +134,6 @@ export default function Type(props) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export async function getServerSideProps(context) { | export async function getServerSideProps(context) { | ||||||
|     const user = await prisma.user.findFirst({ |  | ||||||
|         where: { |  | ||||||
|             username: context.query.user, |  | ||||||
|         }, |  | ||||||
|         select: { |  | ||||||
|             id: true, |  | ||||||
|             username: true, |  | ||||||
|             name: true, |  | ||||||
|         } |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     if (!user) { |  | ||||||
|         return { |  | ||||||
|             notFound: true, |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     const eventType = await prisma.eventType.findFirst({ |  | ||||||
|         where: { |  | ||||||
|             userId: user.id, |  | ||||||
|             slug: { |  | ||||||
|                 equals: context.query.type, |  | ||||||
|             }, |  | ||||||
|         }, |  | ||||||
|         select: { |  | ||||||
|             id: true, |  | ||||||
|             title: true, |  | ||||||
|             description: true, |  | ||||||
|             length: true |  | ||||||
|         } |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     const booking = await prisma.booking.findFirst({ |     const booking = await prisma.booking.findFirst({ | ||||||
|         where: { |         where: { | ||||||
|             uid: context.query.uid, |             uid: context.query.uid, | ||||||
|  | @ -176,7 +144,15 @@ export async function getServerSideProps(context) { | ||||||
|             description: true, |             description: true, | ||||||
|             startTime: true, |             startTime: true, | ||||||
|             endTime: true, |             endTime: true, | ||||||
|             attendees: true |             attendees: true, | ||||||
|  |             eventType: true, | ||||||
|  |             user: { | ||||||
|  |                 select: { | ||||||
|  |                     id: true, | ||||||
|  |                     username: true, | ||||||
|  |                     name: true, | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  | @ -188,8 +164,8 @@ export async function getServerSideProps(context) { | ||||||
| 
 | 
 | ||||||
|     return { |     return { | ||||||
|         props: { |         props: { | ||||||
|             user, |             user: booking.user, | ||||||
|             eventType, |             eventType: booking.eventType, | ||||||
|             booking: bookingObj |             booking: bookingObj | ||||||
|         }, |         }, | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Bailey Pumfleet
						Bailey Pumfleet