Problems with returning Wix Data by function

Ok, thanks so far! I changed for it to use the .hasSome() function and not run 21 times. Now the problem that I am having is returning a value that doesn’t work. I think I am just using async and await wrongly.

import { lookUp } from ‘backend/aModule.jsw’ ;

export async function button5_click ( event ) {
let myShowID = “Lib_2021_AliceIW_TheMonkeys”
let value = await lookUp ( myShowID , $w ( ‘#inputCode’ ). value )
await console . log ( await value )
}

aModule.jsw:

export async function lookUp ( showID , inputKey ) {
await wixData . query ( “Codes” )
. hasSome ( “value” , inputKey )
. find ()
. then ( ( results ) => {
if ( results . items . length > 0 ) {
let curItem = results . items [ 0 ]; //see item below
console . log ( curItem . value )

    **if**  ( curItem . value  ==  inputKey  && 
    curItem . showid  ==  showID  
    

    ) { 

        
        console . log ( "Found" ) 

        
        **if**  ( curItem . media  ==  "Video" ) { 
            
            curItem . value  =  "Empty" 
        wixData . update ( "Codes" ,  curItem ) 
            **return**  1 
            
        } 
        **if**  ( curItem . media  ==  "All" ) { 
            
            curItem . value  =  "Empty" 
        wixData . update ( "Codes" ,  curItem ) 
            **return**  2 
            
        } 
        **if**  ( curItem . media  ==  "Pictures" ) { 
            
            curItem . value  =  "Empty" 
        wixData . update ( "Codes" ,  curItem ) 
            **return**  3     
            
            } 
        
    } 
    
    
    } 
    **else** 
    { 
        console . log ( "Not Found!" ) 
        **return**  0 
    } 
    }) 
    . **catch** ( ( err ) => { 
**let**  errorMsg  =  err ; 
console . log ( errorMsg ) 

} );

}