@@ -21,14 +21,15 @@ export class AutocompleteResolver {
2121 @Arg ( 'types' , ( ) => AutocompleteFilterTypeInput ) types : AutocompleteFilterTypeInput ,
2222 @Arg ( 'status' , ( ) => [ StudentStatus ] , { defaultValue : [ StudentStatus . ACCEPTED ] } ) status : StudentStatus [ ] ,
2323 @Arg ( 'q' , ( ) => String ) q : string ,
24+ @Arg ( 'universal' , ( ) => Boolean , { nullable : true , defaultValue : false } ) universal ?: boolean ,
2425 ) : Promise < AutocompleteResult [ ] > {
2526 const lookups : ( ( ) => Promise < AutocompleteResult [ ] > ) [ ] = [ ] ;
2627
2728 if ( types . students ) {
2829 lookups . push ( async ( ) =>
2930 ( await this . prisma . student . findMany ( {
3031 where : {
31- eventId : auth . eventId ,
32+ eventId : ( universal === true ) ? undefined : auth . eventId ,
3233 AND : [
3334 {
3435 OR : status . map ( s => ( {
@@ -48,6 +49,7 @@ export class AutocompleteResolver {
4849 . map ( s => ( {
4950 name : `${ s . givenName } ${ s . surname } (${ s . email } )` ,
5051 id : s . id ,
52+ eventId : s . eventId ,
5153 type : AutocompleteType . STUDENT ,
5254 } ) as AutocompleteResult )
5355 ) ;
@@ -57,7 +59,7 @@ export class AutocompleteResolver {
5759 lookups . push ( async ( ) =>
5860 ( await this . prisma . mentor . findMany ( {
5961 where : {
60- eventId : auth . eventId ,
62+ eventId : ( universal === true ) ? undefined : auth . eventId ,
6163 status : 'ACCEPTED' ,
6264 OR : [
6365 { givenName : { contains : q , mode : 'insensitive' } } ,
@@ -69,6 +71,7 @@ export class AutocompleteResolver {
6971 . map ( m => ( {
7072 name : `${ m . givenName } ${ m . surname } (${ m . email } )` ,
7173 id : m . id ,
74+ eventId : m . eventId ,
7275 type : AutocompleteType . MENTOR ,
7376 } ) as AutocompleteResult )
7477 ) ;
@@ -78,14 +81,18 @@ export class AutocompleteResolver {
7881 lookups . push ( async ( ) =>
7982 ( await this . prisma . project . findMany ( {
8083 where : {
81- eventId : auth . eventId ,
84+ eventId : ( universal === true ) ? undefined : auth . eventId ,
8285 status : { in : [ 'ACCEPTED' , 'MATCHED' ] } ,
83- description : { contains : q , mode : 'insensitive' }
86+ OR : [
87+ { description : { contains : q , mode : 'insensitive' } } ,
88+ { issueUrl : { contains : q , mode : 'insensitive' } } ,
89+ ]
8490 } ,
8591 } ) )
86- . map ( m => ( {
87- name : `${ m . description ?. slice ( 0 , 40 ) } ...` ,
88- id : m . id ,
92+ . map ( p => ( {
93+ name : `${ p . description ?. slice ( 0 , 40 ) } ...` ,
94+ id : p . id ,
95+ eventId : p . eventId ,
8996 type : AutocompleteType . PROJECT ,
9097 } ) as AutocompleteResult )
9198 ) ;
0 commit comments