-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: get delete api and cleanup #18
Conversation
742fd1d
to
bfadf05
Compare
Problem found with returning objects from api. Investigating and fixing before re requesting review. |
bfadf05
to
299f830
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions and suggestions to check
src/api_productions.ts
Outdated
@@ -284,7 +333,7 @@ const apiProductions: FastifyPluginCallback<ApiProductionsOptions> = ( | |||
schema: { | |||
// description: 'Retrieves lines for a Production.', | |||
response: { | |||
200: Type.Object({ Line }) | |||
200: Type.Array(Type.Any()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why Any()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An overarching problem is the fastify typecheck which does not seem to correctly identify returning types. Using Type.Object({ Line }) here will cause an internal error 500 when making this request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should work, been using types all the time :)
src/api_productions.ts
Outdated
@@ -302,22 +351,22 @@ const apiProductions: FastifyPluginCallback<ApiProductionsOptions> = ( | |||
|
|||
fastify.get<{ | |||
Params: { name: string; lineName: string }; | |||
Reply: Line | string; | |||
Reply: { line: Line } | string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason why it cannot return the Line
object directly? Why the { line: Line }
wrapping ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason it does not work when unwrapped. Removing the schema all together from the fastify request definition also fixes the problem. The overarching issue for the fastify requests are all related to the response schema object type. It does not seem to work seemlessly for some reason.
f4227e5
to
3a1f613
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now :)
3a1f613
to
1912987
Compare
1912987
to
aae5027
Compare
No description provided.