Thanks for the video, Ben! Really enjoying the series! I was testing the project until this video and seems like that Min validator is specific for numbers so I had to replace Min by Length. Thanks again!
@bawad5 жыл бұрын
thanks
@ryosupercell41375 жыл бұрын
change Min(5) to MinLength(5)
@bawad5 жыл бұрын
@Min is only for numbers, use @MinLength instead github.com/benawad/type-graphql-series/blob/9d6c1deb0ed484e544e4d64cb0467530aa50fb7e/src/modules/shared/PasswordInput.ts#L7
@prerakhere5 жыл бұрын
Every video of yours starts with "we're be going over" ;)
@bawad5 жыл бұрын
sounds accurate 😄
@sinamaleki39084 жыл бұрын
for PasswordInput validation is good to use @MinLength() method instead of Min() @InputType() export class PasswordInput { @Field() @MinLength(8) password: string; }
@peter_babic5 жыл бұрын
I believe @Min() is used for comparing numbers, not string length
@sinamaleki39084 жыл бұрын
use @MinLength(8)
@peterm.souzajr.21125 жыл бұрын
prefix also needed on line 18 at time 13:01 . i look forward to all the rest of your videos!
@richarddoust67104 жыл бұрын
In the 9th video in the series I had trouble because I added the Min validator to password as seen at 16:15 into this video. I think it should actually be MinLength. The test in video 9 fails if you do Min.
@jeromesnail4 жыл бұрын
I'm late to the party but I'm well decided to make a real backend with postgres/graphql/typescript. A question regarding constants: couldn't they be typescript enums?
@bengr5 жыл бұрын
What if you wanted to extract multiple fields into their own input classes? You can't extend multiple classes (in TS).
@bawad5 жыл бұрын
you can get around that with mixins: const MyMixin = (BaseClass: T) => { @InputType() class SomeInput extends BaseClass { @Field() idk: string; } return SomeInput; }; @InputType() export class RegisterInput extends MyMixin(PasswordInput) { }
@keepforever7265 жыл бұрын
When you set up the glob statment with __dirname, wouldn't that also hit files that are not resolvers, for example, redisPrefixes would also fit that glob, no? Does it know that it's not a reslover somehow?
@bawad5 жыл бұрын
yeah it would, I think type-graphql just takes the classes with @Resolver decorator on it
@acehzo5 жыл бұрын
Hi Ben .... fantastic as always! I ran into an issue using the resolvers import using the modules folder.... looks like the "ChangePasswordInput" input type gets imported more than once in the schema. Anyone else face this issue?
@bawad5 жыл бұрын
does it cause some kind of error?
@acehzo5 жыл бұрын
@@bawad Yes, the following error: UnhandledPromiseRejectionWarning: Error: Schema must contain unique named types but contains multiple types named "ChangePasswordInput". I am graphql -> 14.1.1, apollo-server-express 2.4.8. I have also noticed in the latest version, the formatArgumentValidationError has been removed... No big issue with the above, i simply sticked to the initial method.... Wanted to say again, thank you very much for your videos! I really enjoy your approach and detailed topics!
@acehzo5 жыл бұрын
@@Narlynarz Hi, yes, everything worked up to this point... Queries, Mutations, etc.... it only caused an issue when loading the resolvers from the folders. Not to worry though, i see later in the testing section Ben moves back to defining the specific resolvers....
@jeromesnail4 жыл бұрын
Can we extends typeorm entities too? If all or at least some my entities have shared fields.
@yoyo26-345 жыл бұрын
very good as usual
@sushilbansalk5 жыл бұрын
Hi Ben, is there a better way to handle errors and display those to users?
@bawad5 жыл бұрын
sometimes I just return the error through graphql
@tabziz5 жыл бұрын
great video
@justind69834 жыл бұрын
I dont understand the need for a prefix. Could someone link an article or give a simple explanation why this matters? The tokens are not identical so reuse won't happen, unless I am misunderstanding something(probable)
@bawad4 жыл бұрын
If I want to lookup all keys for a specific thing I can look for the prefix
@justind69834 жыл бұрын
@@bawad thanks!
@sungwoncho39945 жыл бұрын
Great video, Ben! I see that now we have two places (register and changePassword) where we encrypt the password from user input using bcrypt. The other day I was reading the typeorm documentation and found entity listeners(typeorm.io/#/listeners-and-subscribers). They are like Sequelize hooks and I thought these may help you refactor the encryption code. Let me know what you think of them.
@bawad5 жыл бұрын
Yeah I think that would make for a nice refactoring