File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -7,19 +7,24 @@ import { connect } from '../config/config';
77import { Coasters } from '../entity/Coasters' ;
88import { MusicProviders } from '../entity/MusicProviders' ;
99import { Session } from '../entity/Session' ;
10+ import { Users } from '../entity/Users' ;
1011
1112exports . getCoasterSessionForGuest = ( coasterId ) => {
1213 return new Promise ( async ( resolve , reject ) => {
1314 try {
1415 const connection = await connect ( ) ;
1516 const coasterRepo = connection . getRepository ( Coasters ) ;
1617 const sessionRepo = connection . getRepository ( Session ) ;
18+ const usersRepo = connection . getRepository ( Users ) ;
1719
1820 const coaster = await coasterRepo . findOne ( { where : { coasterId } } ) ;
1921 if ( coaster ?. userId == undefined || null ) reject ( { message : "There coaster does not have a host." , status : 403 , code : "COASTER_NO_HOST" } ) ;
2022 const session = await sessionRepo . findOne ( { where : { userId : coaster . userId } } ) || reject ( { message : "No active session" , status : 403 } ) ;
23+ const host = await usersRepo . findOne ( { where : { userId : coaster . userId } } ) ;
2124
22- resolve ( { coaster, session } ) ;
25+ const hostName = host . displayName ;
26+
27+ resolve ( { coaster, session, hostName } ) ;
2328
2429 } catch ( error ) {
2530 console . error ( error )
You can’t perform that action at this time.
0 commit comments