Conversation
GeekaN2
commented
Jul 2, 2024
ece521b to
394023c
Compare
| * Editor tool cover location | ||
| */ | ||
| export type EditorToolCoverFileLocation = { | ||
| isEditorToolCover: boolean; |
| // body: { | ||
| // $ref: 'AddEditorToolSchema', | ||
| // }, |
There was a problem hiding this comment.
remove it, maybe add real validation?
| if (editorTool.cover) { | ||
| const coverBuffer = await editorTool.cover.toBuffer(); | ||
|
|
||
| coverKey = await fileUploaderService.uploadFile({ | ||
| data: coverBuffer, | ||
| name: createFileId(), | ||
| mimetype: editorTool.cover.mimetype, | ||
| }, { | ||
| isEditorToolCover: true, | ||
| }, { | ||
| userId, | ||
| }); | ||
| } |
There was a problem hiding this comment.
Lets move this logic into addTool()
| /** | ||
| * Update tool cover | ||
| * @param editorToolId | ||
| * @param cover | ||
| */ | ||
| public async updateToolCover(editorToolId: EditorTool['id'], cover: EditorTool['cover']): Promise<void> { |
a07998d to
60a0c18
Compare
| title: String(editorTool.title?.value), | ||
| name: String(editorTool.name?.value), |
| cover?: MultipartFile; | ||
|
|
||
| /** | ||
| * The user ID associated with the editor tool. |
There was a problem hiding this comment.
is it the user who added a tool or who updated a tool last time?
| title: editorTool.title?.value ?? '', | ||
| name: editorTool.name?.value ?? '', |
There was a problem hiding this comment.
you need to validate all required fields or add a schema
| /** | ||
| * Tool cover | ||
| */ | ||
| EditorToolCover = 2 |
There was a problem hiding this comment.
What does the numbers mean? Add description please
There was a problem hiding this comment.
Remove all commented-out lines if it is not used
| const { editorToolsService } = opts; | ||
| const { editorToolsService, fileUploaderService } = opts; | ||
|
|
||
| await fastify.register(fastifyMultipart, { |
There was a problem hiding this comment.
I think the fastify.registed should be stored here
notes.api/src/presentation/http/http-api.ts
| NoteAttachment = 1, | ||
|
|
||
| /** | ||
| * Tool cover | ||
| */ | ||
| EditorToolCover = 2 |
There was a problem hiding this comment.
lets store this as string enum for better readability
| // eslint-disable-next-line | ||
| const formData = new FormData(); |
There was a problem hiding this comment.
spicify eslint rule that you are disabling