From 9802d0bfad2336fa45808f72e5cfdaa64db806d5 Mon Sep 17 00:00:00 2001 From: e11sy Date: Wed, 31 Jul 2024 21:30:10 +0300 Subject: [PATCH 1/3] added user to schema of the noteHistoryRecord --- src/presentation/http/schema/History.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/presentation/http/schema/History.ts b/src/presentation/http/schema/History.ts index f9e18cb2..06a3378b 100644 --- a/src/presentation/http/schema/History.ts +++ b/src/presentation/http/schema/History.ts @@ -10,6 +10,7 @@ export const HistotyRecordShema = { 'userId', 'createdAt', 'tools', + 'user', ], properties: { id: { @@ -29,6 +30,19 @@ export const HistotyRecordShema = { type: 'string', format: 'date-time', }, + user: { + type: 'object', + properties: { + name: { + description: 'name of the user', + type: 'string', + }, + photo: { + description: 'photo of the user', + type: 'string', + }, + }, + }, content: { description: 'content of certain version of the note', type: 'object', @@ -69,6 +83,7 @@ export const HistoryMetaSchema = { 'id', 'userId', 'createdAt', + 'user', ], properties: { id: { From 84ab46a6720389646f7af16ffc62ba906c2ad7db Mon Sep 17 00:00:00 2001 From: e11sy Date: Wed, 31 Jul 2024 22:01:54 +0300 Subject: [PATCH 2/3] test fix --- src/presentation/http/router/note.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/presentation/http/router/note.test.ts b/src/presentation/http/router/note.test.ts index 606d38d7..b0733562 100644 --- a/src/presentation/http/router/note.test.ts +++ b/src/presentation/http/router/note.test.ts @@ -2074,6 +2074,10 @@ describe('Note API', () => { createdAt: history.createdAt, content: history.content, tools: history.tools, + user: { + name: user.name, + photo: user.photo, + }, }, }); } From 54eb101b8bef09d3a23e1d24ae0e3c561fe45695 Mon Sep 17 00:00:00 2001 From: e11sy Date: Wed, 31 Jul 2024 22:08:09 +0300 Subject: [PATCH 3/3] fix test --- src/presentation/http/router/note.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/presentation/http/router/note.test.ts b/src/presentation/http/router/note.test.ts index b0733562..2187fb53 100644 --- a/src/presentation/http/router/note.test.ts +++ b/src/presentation/http/router/note.test.ts @@ -2075,8 +2075,8 @@ describe('Note API', () => { content: history.content, tools: history.tools, user: { - name: user.name, - photo: user.photo, + name: creator.name, + photo: creator.photo, }, }, });