// 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.
The type for
beforeResultandafterResultboth come out{ id: number }:☑️Paginated<{ id: number }>: Cancontext.resulteven 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 ifmulti: false, but that may still be correct; since the input of a single object can maybe produce an array output.undefined: in anaroundhook, this should be the only type beforeawait next()and then it should go away after. AFAIK Feathers doesn't allow empty creates, so there will always be a result.