Forgot Password TypeGraphQL

Поделиться
HTML-код
  • Опубликовано: 25 ноя 2024

Комментарии • 30

  • @bawad
    @bawad  5 лет назад +2

    @Min is only for numbers, use @MinLength instead github.com/benawad/type-graphql-series/blob/9d6c1deb0ed484e544e4d64cb0467530aa50fb7e/src/modules/shared/PasswordInput.ts#L7

  • @MaRcOWinchester
    @MaRcOWinchester 5 лет назад +7

    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!

    • @bawad
      @bawad  5 лет назад +1

      thanks

  • @prerakhere
    @prerakhere 5 лет назад +4

    Every video of yours starts with "we're be going over" ;)

    • @bawad
      @bawad  5 лет назад +2

      sounds accurate 😄

  • @ryosupercell4137
    @ryosupercell4137 5 лет назад +7

    change Min(5) to MinLength(5)

  • @peterm.souzajr.2112
    @peterm.souzajr.2112 5 лет назад

    prefix also needed on line 18 at time 13:01 . i look forward to all the rest of your videos!

  • @sinamaleki3908
    @sinamaleki3908 4 года назад +2

    for PasswordInput validation is good to use @MinLength() method instead of Min()
    @InputType()
    export class PasswordInput {
    @Field()
    @MinLength(8)
    password: string;
    }

  • @peter_babic
    @peter_babic 5 лет назад +6

    I believe @Min() is used for comparing numbers, not string length

  • @richarddoust6710
    @richarddoust6710 4 года назад +2

    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.

  • @yoyo26-34
    @yoyo26-34 5 лет назад

    very good as usual

  • @jeromesnail
    @jeromesnail 4 года назад

    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?

  • @bengr
    @bengr 5 лет назад +2

    What if you wanted to extract multiple fields into their own input classes? You can't extend multiple classes (in TS).

    • @bawad
      @bawad  5 лет назад +1

      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) {
      }

  • @keepforever726
    @keepforever726 5 лет назад +1

    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?

    • @bawad
      @bawad  5 лет назад +5

      yeah it would, I think type-graphql just takes the classes with @Resolver decorator on it

  • @tabziz
    @tabziz 5 лет назад

    great video

  • @acehzo
    @acehzo 5 лет назад +1

    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?

    • @bawad
      @bawad  5 лет назад

      does it cause some kind of error?

    • @acehzo
      @acehzo 5 лет назад

      @@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!

    • @acehzo
      @acehzo 5 лет назад

      @@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....

  • @jeromesnail
    @jeromesnail 4 года назад

    Can we extends typeorm entities too?
    If all or at least some my entities have shared fields.

  • @sushilbansalk
    @sushilbansalk 5 лет назад

    Hi Ben, is there a better way to handle errors and display those to users?

    • @bawad
      @bawad  5 лет назад

      sometimes I just return the error through graphql

  • @sungwoncho3994
    @sungwoncho3994 5 лет назад

    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.

    • @bawad
      @bawad  5 лет назад

      Yeah I think that would make for a nice refactoring

  • @justind6983
    @justind6983 4 года назад

    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)

    • @bawad
      @bawad  4 года назад +1

      If I want to lookup all keys for a specific thing I can look for the prefix

    • @justind6983
      @justind6983 4 года назад

      @@bawad thanks!