Open princevora opened 4 months ago
The query will reset every excuting ,
maybe you can like it const user = await new User().where("email", "=", email).first() if (user == null ) { reject(ObjectResponse("No user found with this provided email", 401, true)); }
// cosnole.log(user)
Thank you
Thanks about your reply, i just raised the issue because if we do it like this then exists() method that is available in your package will not represent its usage thats the main point. Some of the users may make a very strict validations so in that cases i think its useful so it should be changed i think if possible
Thanks for your time..
Thank you for your feedback. it’s important to me. I will fix it soon.
Thanks a lot.
Hope it was helpful Thanks
Thanks, I hope your can re try again.
example https://www.npmjs.com/package/tspace-mysql/v/1.6.6-dev.1#unset-statements
Thank you.
hey thanks for new version but i am still having trouble fetching specific users
see below query.. `// check if the user already exists. let user = new Users().where("email", "=", email);
const exists = await user.exists();
console.log("Users: ", user.toSQL());`
my email input is something like meetvora..@gmaial.com
i think all the things are okey as compare to new version when i creaeted a user instace i think its query should look like this
SELECT
users.
id,
users.
username,
users.
email,
users.
password,
users.
created_at,
users.
updated_atFROM
users WHERE
users.
email= 'meetvora..@gmail.com'
but after the instance used the exists method it returned me the query something like Users: SELECT
users.
id,
users.
username,
users.
email,
users.
password,
users.
created_at,
users.
updated_atFROM
users
if there are any issues in my code please correct me
const exists = await user.exists(); // after that the instane will reset the "select statements"
// if you want to view the SQL for debug you can
const exists = await user.debug().exists();
// Now the query has changed because the "select statements" have been reset console.log("Users: ", user.toSQL());`
Thank you. Please provide any feedback if you encounter any problems
Hey, i recently found a bug or idk why is that happened to me for few times see the below is my code ` let user = await new Users().where("email", "=", email);
`
while my email is something like princevora...@gmail.com so up there, is a where query that checks for email, i have already made a instance of Users model on const user so the first intial query is like
select * from where email = email.@gma..
., so when i came to try catch and used user.first() to get the searched user why it is returning me like the below image even i haven't searched for itit should return the user that we seached for instead of the all users, i realized whenever you leave a variable an do like const exists = await user.exists() it reset's the query, its not setisfying to create a new instance every time..