Closed doichev-kostia closed 1 year ago
In the following snippet, the author uses the updatedAt property as one of the CSV headers. However, we actually use the modifiedAt field:
updatedAt
modifiedAt
fastify.route({ method: 'GET', url: '/export', schema: { querystring: fastify.getSchema('schema:todo:list:export') }, handler: async function listTodo (request, reply) { const { title } = request.query // We manage the cursor as the data could be huge const cursor = await request.todosDataSource.listTodos({ filter: { title }, skip: 0, limit: undefined, asStream: true }) reply.header('Content-Disposition', 'attachment; filename="todo-list.csv"') reply.type('text/csv') return cursor.pipe(csvStringify({ quoted_string: true, header: true, columns: ['title', 'done', 'createdAt', 'updatedAt', 'id'], cast: { boolean: (value) => value ? 'true' : 'false', date: (value) => value.toISOString() } })) } })
Path: Chapter 8/routes/todos/files/routes.js Chapter: 8 Section: Managing uploads and downloads
Chapter 8/routes/todos/files/routes.js
Thanks for reporting and providing the PR!
I will look into it
In the following snippet, the author uses the
updatedAt
property as one of the CSV headers. However, we actually use themodifiedAt
field:Path:
Chapter 8/routes/todos/files/routes.js
Chapter: 8 Section: Managing uploads and downloads