-
-
Notifications
You must be signed in to change notification settings - Fork 792
Open
Description
// Main data model schema
export const companySchema = Type.Object(
{
id: Type.Number()
},
{ $id: 'Company', additionalProperties: false }
)
// Schema for creating new entries
export const companyDataSchema = Type.Object(
{
id: Type.Number()
},
{
$id: 'CompanyData',
additionalProperties: false
}
)create: [
async (context, next) => {
const beforeResult = context.result
await next()
const afterResult = context.result
}
]The type for beforeResult and afterResult both come out
{
id: number
} | Paginated<{
id: number
}> | {
id: number
}[] | undefined{ id: number } :☑️
Paginated<{ id: number }>: Can context.result even be paginated in a create hook? Type doesn't go away even if I try to disable pagination ❌
{ id: number }[]: This seems to happen even if multi: false, but that may still be correct; since the input of a single object can maybe produce an array output.
undefined: in an around hook, this should be the only type before await next() and then it should go away after. AFAIK Feathers doesn't allow empty creates, so there will always be a result.
Metadata
Metadata
Assignees
Labels
No labels