-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose note publicId as id property (#129)
* - added notePublic and noteListPublic - added logic to wrap Note and NoteList to expose public id before sending to frontend * - Created noteSettingsPublic - Changed tests to accept note only with public id * Now note is returned "id" which is public id * Reset config file to default * Added requested changes * canEdit fix * noteSettings fix * Fix tests * changed tests * Quick fix note.noteSettings whether note had settings attached, if not then it should be null * noteSettings is not part of note now, changed logic and tests accordingly * Resolving conflicts * Prevented the redecleration of properties of NotePublicSettings that didnt chage * - moved changeNoteToPublic to domain/entities/notePublic.ts - Got rid of public noteSetting * Used utility function in noteList and removed unneccesary checks * - Created ResponseSchema to serialize the response and updated the comments * Defined Fastify schema to speed up the json serialization * Deleted ResponseSchema.ts and updated ref in response schema * Fix some build errors * Fix delete note tests * Fix post note tests * Fix get note by hostname tests * Fix get note by id tests --------- Co-authored-by: Shakhzod Sharifov <[email protected]> Co-authored-by: Tanya Fomina <[email protected]>
- Loading branch information
1 parent
fbbd62d
commit 1d4d4d2
Showing
10 changed files
with
235 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,4 +32,3 @@ database: | |
|
||
openai: | ||
token: 'token' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type { Note } from '@domain/entities/note'; | ||
|
||
type NotePublicProperties = 'content' | 'createdAt' | 'updatedAt'| 'creatorId'; | ||
|
||
export interface NotePublic extends Pick<Note, NotePublicProperties> { | ||
/** | ||
* Expose public id as the "id" property | ||
*/ | ||
id: string; | ||
} | ||
|
||
/** | ||
*Change Note to NotePublic | ||
* | ||
* @param note - Note data to compose a public note | ||
*/ | ||
export function definePublicNote(note: Note): NotePublic { | ||
const notePublic: NotePublic = { | ||
id: note.publicId, | ||
content: note.content, | ||
createdAt: note.createdAt, | ||
updatedAt: note.updatedAt, | ||
creatorId: note.creatorId, | ||
}; | ||
|
||
return notePublic; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.