Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation on aid package title #300

Open
1 task done
nshamit opened this issue Jul 29, 2022 · 9 comments · Fixed by #372
Open
1 task done

Validation on aid package title #300

nshamit opened this issue Jul 29, 2022 · 9 comments · Fixed by #372
Assignees
Labels
Admin API high high priority issues
Milestone

Comments

@nshamit
Copy link
Contributor

nshamit commented Jul 29, 2022

  • Validation on aid package title to stop the creation of two packages with the same name
@manuranga
Copy link
Collaborator

We can simply add UNIQUE(NAME), to AID_PACKAGE table.

@jayasanka-sack
Copy link
Collaborator

Need a human readable error message for the FE/

@manuranga
Copy link
Collaborator

DB is altered, users will not be able to create duplicate names.
We will get an error like:

Error while executing SQL query: INSERT INTO AID_PACKAGE(NAME, DESCRIPTION, STATUS)
                                        VALUES ( ? ,  ? ,  ? );. Duplicate entry 'newpkg' for key 'aid_package.NAME_UNIQUE'.

@manuranga
Copy link
Collaborator

Frontend error is not informative for now.

@manuranga
Copy link
Collaborator

@jayasanka-sack I can send a better error form backend later, for now can we use above error and show a meaningful error to the user

@manuranga
Copy link
Collaborator

manuranga commented Aug 5, 2022

Isn't this not the expectation? Otherwise name will be duplicate.

@jayasanka-sack
Copy link
Collaborator

Quick fix:

Catch this from the frontend.

@jayasanka-sack
Copy link
Collaborator

Temporally fixed with #372 . Need a proper solution from the backend.

@jayasanka-sack
Copy link
Collaborator

I think what we need to do here is,

  1. fetch the aidpackage from the DB
  2. Validate the payload and throw relevant error messages
  3. Execute the update query if the payload is valid

@manuranga Could you please assign someone from the BE team?

Later on, we need to send a proper error resource. So that we can catch it from the front end and display validation errors in necessary places.

ex:

{
  "error": {
    "type": "/aidpackage/duplicate_title",
    "message": "Invalid OAuth access token.",
  }
}

@nshamit nshamit added high high priority issues and removed low labels Oct 12, 2022
@nshamit nshamit modified the milestones: MVP, Phase 2 Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin API high high priority issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants