BuildForSDG / voxnostra

Making the fight against corruption which slows down the development of Cameroon a shared responsibility between a government and its citizens
MIT License
0 stars 3 forks source link

#7-User Authentication #16

Open mernxl opened 4 years ago

mernxl commented 4 years ago

Description

Implementation of authentication, accessible through /auth/{action} where action stands for the action to be carried out. These actions include;

Other Notes

You can check up my comment on issue for more

Fixes #7

How Has This Been Tested?

I did minor testing with PostMan to see that the features. Still to in app tests

Checklist:

tanerochris commented 4 years ago

@mernxl fix the codacy errors

mernxl commented 4 years ago

image

The review from codacity is somewhat incorrect, well will raise an issue later. Clearly i destructured that object which is valid in JS. Well i will fix it now, raise a flag in codacity.com so we move on.

mernxl commented 4 years ago

Well fixed it. 😅In case future such mistakes.

mernxl commented 4 years ago

@KaiserPhemi Thank you for your reviews. I guess the whole structure will need to be changes in another pull request then i rebase and add this changes to follow up a better structure. That was actually the structure i found so i had to flow with it.

@tanerochris maybe we will have to look into the file structure, given you setup the initial one.

mernxl commented 4 years ago

I noticed @tanerochris already took in the changes of this pull request in #20 pull. I guess this pull request will see a closure then, So @tanerochris will have to do the updates on this pull if thats ok.

tanerochris commented 4 years ago

I think having an error response structure is appropriate, especially for writing tests, also it prevents a scenario where other persons create different error responses. In #20 I added some sort of adapter to the ErrorResponse classes.

On Mon, May 18, 2020 at 1:00 PM Rodrick Nfinyoh M notifications@github.com wrote:

@mernxl commented on this pull request.

In libs/api-errors.js https://github.com/BuildForSDG/voxnostra/pull/16#discussion_r426862527:

@@ -0,0 +1,42 @@ +/ eslint-disable max-classes-per-file / + +/**

    • General Error Object, gets other props from Error which include
  • *
    • name, message, stack
  • */ +export class ErrorResponse extends Error {

Ok i see. Maybe i state the reasons for my doing that, you see if they are legit.

Although i know theres a down side of having to deal with the error generation and handling but the reasons for doing that are as follows.

  • I wanted to reuse the error messages, status codes, so i don't have to always create new ones which may mismatch.
  • Gives a general and continuous structure for all backend errors. Especially when it comes to validation errors.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/BuildForSDG/voxnostra/pull/16#discussion_r426862527, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACC3JXPMVM6GB6PJLUQZWQDRSGHWBANCNFSM4M47L5YA .

-- My twitter @tanerochris What I've built https://tchizer.com Developer Circle Buea Lead facebook.com/groups/DevCBuea/ Whatsapp +237 678431904