Custom service method causing typebox issue #3092
Answered
by
daffl
laurensiusadi
asked this question in
Q&A
-
So I made a custom service method called
It's causing this error when the
But it's not causing the error when not using
Also added
What's am I missing here? Thanks. |
Beta Was this translation helpful? Give feedback.
Answered by
daffl
Mar 7, 2023
Replies: 1 comment 1 reply
-
The method should return something. This will probably work: export class ProductService<ServiceParams extends Params = ProductParams> extends KnexService<
Product,
ProductData,
ProductParams,
ProductPatch
> {
async save(data: Product) {
try {
const [record] = await this.find({ query: { id: data.id }, paginate: false })
if (record) {
return this.patch(data.id, data)
} else {
return this.create(data)
}
} catch (error: any) {
console.log('Error saving product: ', error)
}
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
laurensiusadi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The method should return something. This will probably work: