Skip to content
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(noteHistory): note history implementation #269

Merged
merged 27 commits into from
Jul 24, 2024
Merged

feat(noteHistory): note history implementation #269

merged 27 commits into from
Jul 24, 2024

Conversation

e11sy
Copy link
Contributor

@e11sy e11sy commented Jul 19, 2024

Problem

For now we can complitely grind all note (on web) just by highliting full note and pressing any character
We need to be able to check note content history and get back to the content that was actual some time ago

Solution

Add note history table

image

Add note history storage

Add note history repository

Add note history methods for note service

  • now service adds new history record on note creation
  • now service checks if content changes are valuable enough compared to latest saved history

Add noteHistoryPublic entity without note internal id's

public noteHistory has notePublic id instead of NoteInternalId

Add note history routes for note route

  • now we can get full note history meta of the note (for displaying in note history as a list of changes)
  • now we can get certain history record with content and display it as a version of the note

Add note history shema

Write tests

tests cover states

  • Unauthorized user
  • User is not in team
  • Changes are not valuable for note history record creation
  • Changes are valuable enough for saving new history record

solves #268

Copy link

github-actions bot commented Jul 19, 2024

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 85.87% (🎯 80%)
⬆️ +0.39%
8381 / 9760
🟢 Statements 85.87% (🎯 80%)
⬆️ +0.39%
8381 / 9760
🔴 Functions 78.78% (🎯 80%)
⬆️ +0.97%
260 / 330
🟢 Branches 85.21% (🎯 80%)
⬇️ -0.12%
415 / 487
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
src/domain/index.ts 100% 100% 100% 100%
src/domain/entities/noteHistory.ts 0% 0% 0% 0% 1-50
src/domain/service/note.ts 95.89% 84.48% 100% 95.89% 99-100, 126-127, 133-134, 162-163, 184-185, 272-273, 361-362, 378-379, 420-421
src/domain/service/noteSettings.ts 97.18% 88% 100% 97.18% 118-119, 125-126, 197-198
src/presentation/http/http-api.ts 96.04% 90.32% 93.75% 96.04% 101-109, 120-121, 322-323, 346-347
src/presentation/http/router/note.ts 98.04% 80.64% 100% 98.04% 145-146, 612-613, 629-635, 696-697, 753-754
src/presentation/http/schema/History.ts 100% 100% 100% 100%
src/repository/index.ts 100% 100% 100% 100%
src/repository/noteHistory.repository.ts 100% 100% 100% 100%
src/repository/team.repository.ts 100% 100% 100% 100%
src/repository/storage/noteHistory.storage.ts 100% 100% 100% 100%
src/repository/storage/postgres/orm/sequelize/note.ts 97.55% 75% 100% 97.55% 192-193, 236-237, 240-241, 296-297
src/repository/storage/postgres/orm/sequelize/noteHistory.ts 100% 100% 100% 100%
src/tests/utils/database-helpers.ts 98.39% 95.45% 92.3% 98.39% 217-222
Generated in workflow #812

@e11sy e11sy marked this pull request as ready for review July 22, 2024 18:49
src/domain/service/note.ts Outdated Show resolved Hide resolved
src/domain/service/note.ts Outdated Show resolved Hide resolved
src/domain/service/note.ts Outdated Show resolved Hide resolved
src/presentation/http/router/note.test.ts Outdated Show resolved Hide resolved
src/presentation/http/router/note.test.ts Outdated Show resolved Hide resolved
src/presentation/http/router/note.test.ts Outdated Show resolved Hide resolved
src/presentation/http/router/note.ts Outdated Show resolved Hide resolved
src/presentation/http/router/note.ts Outdated Show resolved Hide resolved
src/presentation/http/router/note.ts Outdated Show resolved Hide resolved
src/repository/storage/postgres/orm/sequelize/note.ts Outdated Show resolved Hide resolved
src/domain/service/note.ts Outdated Show resolved Hide resolved
src/domain/service/note.ts Show resolved Hide resolved
src/domain/service/note.ts Outdated Show resolved Hide resolved
src/tests/utils/database-helpers.ts Show resolved Hide resolved
src/presentation/http/router/note.test.ts Outdated Show resolved Hide resolved
src/presentation/http/router/note.test.ts Show resolved Hide resolved
src/presentation/http/router/note.test.ts Outdated Show resolved Hide resolved
src/repository/storage/postgres/orm/sequelize/user.ts Outdated Show resolved Hide resolved
@e11sy e11sy merged commit 95a67bd into main Jul 24, 2024
6 checks passed
@e11sy e11sy deleted the note-history branch July 24, 2024 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants