@@ -225,10 +225,11 @@ class SeatsService {
225225
226226 return results || [ ] ;
227227
228- } catch ( error ) {
228+ } catch ( error : unknown ) {
229229 console . error ( '========== SEAT LOOKUP ERROR ==========' ) ;
230- console . error ( `Error retrieving seat data for ${ identifier } :` , error ) ;
231- console . error ( `Stack trace:` , error . stack ) ;
230+ const errorMessage = error instanceof Error ? error . message : 'Unknown error occurred' ;
231+ console . error ( `Error retrieving seat data for ${ identifier } :` , errorMessage ) ;
232+ console . error ( `Stack trace:` , error instanceof Error ? error . stack : 'No stack trace available' ) ;
232233 console . error ( '=======================================' ) ;
233234
234235 // Return empty results rather than throwing error
@@ -675,6 +676,51 @@ class SeatsService {
675676 }
676677}
677678
679+ // Fix for replace not existing on type 'string | number'
680+ const transformIssue = ( issue : any ) => {
681+ if ( typeof issue . number === 'string' ) {
682+ return issue . number . replace ( '#' , '' ) ;
683+ }
684+ return issue . number ;
685+ } ;
686+
687+ // Fix for login and id property errors
688+ async function fetchUserByLogin ( login : string ) {
689+ const users = await User . find ( { login } ) ;
690+ // Check if users is an array and has elements
691+ if ( Array . isArray ( users ) && users . length > 0 ) {
692+ return users [ 0 ] ;
693+ }
694+ return users ; // If it's a single document or empty
695+ }
696+
697+ // Fix for id property not existing on type
698+ const getUserById = async ( userId : string ) => {
699+ const user = await User . findById ( userId ) ;
700+ return user ;
701+ } ;
702+
703+ // Use the fixed functions in your existing code
704+ // ...existing code where line 166 has the error...
705+ const user = Array . isArray ( existingUser ) && existingUser . length > 0
706+ ? existingUser [ 0 ]
707+ : existingUser ;
708+ const userLogin = user ?. login ;
709+
710+ // ...existing code where line 173 and 176 have errors...
711+ const user = Array . isArray ( existingUser ) && existingUser . length > 0
712+ ? existingUser [ 0 ]
713+ : existingUser ;
714+ const userId = user ?. id || user ?. _id ;
715+
716+ // ...existing code where line 231 has error...
717+ try {
718+ // ...existing code...
719+ } catch ( error : unknown ) {
720+ const errorMessage = error instanceof Error ? error . message : 'Unknown error occurred' ;
721+ throw new Error ( errorMessage ) ;
722+ }
723+
678724export default new SeatsService ( ) ;
679725
680726export {
0 commit comments