Open
Description
I follow this instruction: https://elysiajs.com/patterns/reference-models.html
With this code:
// auth.model.ts
import { Elysia, t } from 'elysia'
export const authModel = new Elysia()
.model({
sign: t.Object({
username: t.String(),
password: t.String()
})
})
// index.ts
import { Elysia } from 'elysia'
import { authModel } from './auth.model.ts'
const app = new Elysia()
.use(authModel)
.post('/sign-in', ({ body }) => body, {
// with auto-completion for existing model name
body: 'sign',
response: 'sign'
})
How can I use it inside t.Object() like below:
const app = new Elysia()
.use(authModel)
.post('/sign-in', ({ body }) => body, {
// with auto-completion for existing model name
body: t.Object({ sign: 'sign' }),
response: 'sign'
})
The reason is I have a 'pagination' model which look like this:
body: t.Object({
results: modelName,
page: t.Number(),
...
})
With reference model I have to create each pagination for models, how can I achieve it?