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

dynamic path intercepts static #168

Open
SalischevArtem opened this issue Jun 24, 2022 · 4 comments
Open

dynamic path intercepts static #168

SalischevArtem opened this issue Jun 24, 2022 · 4 comments

Comments

@SalischevArtem
Copy link

Hello!

I have the issue which was discussed but can't apply the suggested resolving.

I have two DELETE like bellow :

@delete('/agent/:id')
async deleteInactiveAgentFromProfiles(
@param('id') id: string,
): Promise {
return this.profilesService.deleteInactiveAgentFromProfilesById(id);
}

@delete(':id')
async deleteProfile(@param('id') id: string): Promise {
return this.profilesService.deleteProfileById(id);
}

My ids smt like this /^UPC-[0-9A-F]{19}-[0-9A-F]{1}$/

So regarding this issue in second DELETE I have to do smth like this
@Delete('/:id(^UPC-[0-9A-F]{19}-[0-9A-F]{1}$)/')
But it doesn’t work.

What I'm doing wrong?

Thank for helping.

@shekohex
Copy link
Member

Could you try @Delete(/(^UPC-[0-9A-F]{19}-[0-9A-F]{1}$)/)?

@SalischevArtem
Copy link
Author

Unfortunately, it doesn’t work.
Argument of type 'RegExp' is not assignable to parameter of type 'string | string[]'.

@meehol
Copy link

meehol commented Jun 27, 2022

Having same issue

@shekohex
Copy link
Member

Interesting, one question is does you have the same issue with the built-in RounterModule in nestjs?

Also, maybe it should work like so @Delete('/:id(^UPC-[0-9A-F]{19}-[0-9A-F]{1}$)/')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants