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

Route for checking duplicate vocabs #91

Open
noctera opened this issue Sep 24, 2022 · 10 comments
Open

Route for checking duplicate vocabs #91

noctera opened this issue Sep 24, 2022 · 10 comments
Labels
difficulty/medium hacktoberfest kind/docs Improvements or additions to documentation kind/enhancement New feature or request kind/improvement Code improvement priority/medium
Milestone

Comments

@noctera
Copy link
Member

noctera commented Sep 24, 2022

We need a route to checki if vocab already exists in groups/packages when creating them. The check only has do be done client-side, so no additional checking in the vocab creation functions.

Needed Routes:

  1. Route to check if vocab already exists in package
    /api/check-duplicate?languagePackageId={languagePackageId}&vocab={vocab}

Response:

{
    "duplicate": false,
    "group": {
        "id": "fbd8ee4a-8105-4716-zt72-65d6ef411234",
        "languagePackageId": "81ec68fc-843e-4a76-9fzu-5ae0b1gb05c2",
        "name": "Unit 1",
        "description": "This is a test",
        "active": true,
    },
}
  1. Route to check if vocab already exists in group
    /api/check-duplicate?groupId={groupId}&vocab={vocab}

Response:

{
   " duplicate": false,
    "group": {
        "id": "fbd8ee4a-8105-4716-zt72-65d6ef411234",
        "languagePackageId": "81ec68fc-843e-4a76-9fzu-5ae0b1gb05c2",
        "name": "Unit 1",
        "description": "This is a test",
        "active": true,
    },
}

For a better overview I have split up the two needed cases. But overall there is only one endpoint, where you can give your needed query parameters to get the result. This includes adding groupId and packageId in one query too (although this is a bit useless).

@noctera noctera added kind/enhancement New feature or request kind/docs Improvements or additions to documentation kind/improvement Code improvement priority/medium labels Sep 24, 2022
@noctera noctera added this to Todo Sep 24, 2022
@noctera noctera moved this to 🗒️ ToDo in Todo Sep 24, 2022
@noctera noctera added this to the v1.4.0 milestone Sep 25, 2022
@noctera
Copy link
Member Author

noctera commented Sep 25, 2022

@luwol03 I have updated the route response

@luwol03
Copy link
Member

luwol03 commented Sep 28, 2022

what about making groupId and languagePackagId optional and have one controller handler?

@noctera
Copy link
Member Author

noctera commented Sep 28, 2022

what about making groupId and languagePackagId optional and have one controller handler?

Yeah this was my intention I tried to explain here

For a better overview I have split up the two needed cases. But overall there is only one endpoint, where you can give your needed query parameters to get the result. This includes adding groupId and packageId in one query too (although this is a bit useless).

Or did you think of something else

@luwol03
Copy link
Member

luwol03 commented Sep 28, 2022

oh ok. And what is with the third case without any parameters?

@noctera
Copy link
Member Author

noctera commented Sep 28, 2022

I don't know if not parameters make that much sense. No parameters would mean that it checks in every group and package. But I think you only need this function to check a specific package, not all your packages

@luwol03
Copy link
Member

luwol03 commented Sep 28, 2022

I was thinking of showing that this vocab already exists in package XXX group XXX

@noctera
Copy link
Member Author

noctera commented Sep 28, 2022

@luwol03 I have added a vocab parameter to the route, as it is a GET. Would you agree with this?

@luwol03
Copy link
Member

luwol03 commented Sep 28, 2022

What should this be for? And I would also respond with the found vocab so you can show it in the create anyway dialog.

@noctera
Copy link
Member Author

noctera commented Sep 28, 2022

I was thinking of showing that this vocab already exists in package XXX group XXX

Yeah understand what you mean. But when you create a new package you usually don't care if a vocab you want to add is already existing in another package, as it is completely new and created for another learning purpose. I think a global check would be unnecessary and disturbing

@noctera
Copy link
Member Author

noctera commented Sep 28, 2022

What should this be for? And I would also respond with the found vocab so you can show it in the create anyway dialog.

The vocab parameter includes the name (foreign word) that has to be checked. As this is a GET request I wouldn't send it in the body.

Yeah you could add the found vocab I'm the response. But you could just use the foreign word of the input field in the client that is saved there anyways

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/medium hacktoberfest kind/docs Improvements or additions to documentation kind/enhancement New feature or request kind/improvement Code improvement priority/medium
Projects
Status: 🗒️ ToDo
Development

No branches or pull requests

2 participants