We need to create a function to retrieve user data by user ID in the user service file.
This function will be similar to the existing get_user_by_name function, but it will use the user ID as the query parameter.
We'll define a new function, get_user, which can accept a string parameter commendation.
This function will return another function that can take a prime parameter, being either a string or number, and an options parameter.
We'll cut the main part of get_user_by_name and paste it into the new get_user function, updating the query to join other data tables and adding the user table name before the columns user ID and user name.
An if statement will check if the user has uploaded an image by counting the ID of the 'eva' database and setting a condition for the join with the 'eva' table.
The where clause of the query will be modified to use the provided commendation parameter so that the function can search by user name or user ID based on the condition given when executing get_user.
The search will return the first item in the data if its ID value is truthful; otherwise, it returns 'no'.
Finally, we'll use the get_user function to create functions to get users by name or by ID by setting the appropriate condition and parameter.