deepkit-framework icon indicating copy to clipboard operation
deepkit-framework copied to clipboard

custom identifier in crud routes not working (example-app, Bookstore)

Open colorcube opened this issue 3 years ago • 0 comments

Using debug console or browser I can query some test users:

http://0.0.0.0:9999/entity/user

[
    {
        "id": 1,
        "created": "2022-12-23T18:20:53.988Z",
        "username": "test"
    },
    {
        "id": 2,
        "created": "2022-12-23T18:30:53.874Z",
        "username": "test2"
    }
]

A query by username doesn't work:

http://0.0.0.0:9999/entity/user/test2

[ERROR] Controller parameter resolving error: Error: Invalid get<T> argument given undefined
    at Injector.get (/var/www/deepkit-test/node_modules/@deepkit/injector/src/injector.ts:248:15)
    at InjectorContext.get (/var/www/deepkit-test/node_modules/@deepkit/injector/src/injector.ts:866:25)
    at HttpResolveParametersEvent.parameters [as parameterResolver] (eval at build (/var/www/deepkit-test/node_modules/@deepkit/core/src/compiler.ts:95:20), <anonymous>:206:58)
    at HttpListener.onResolveParameters (/var/www/deepkit-test/node_modules/@deepkit/http/src/http.ts:619:44)
    at self (eval at buildAsync (/var/www/deepkit-test/node_modules/@deepkit/core/src/compiler.ts:111:20), <anonymous>:165:52)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async HttpKernel.handleRequest (/var/www/deepkit-test/node_modules/@deepkit/http/src/kernel.ts:40:17)
[LOG] 127.0.0.1 - GET "/entity/user/test2" 500 ""

And the debug API browser doesn't show the id input field for username.

related code

createCrudRoutes([User], { identifier: 'username', identifierChangeable: true }

I see the same behaviour in my custom test app.

BTW I can see that most packages are at version alpha 85, some are at 77.

├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── @deepkit/[email protected]
├── [email protected]

colorcube avatar Dec 26 '22 22:12 colorcube