Commit bd9c36d
authored
Chore/file manager and esigner bug fixes (#729)
* fix(file-manager-api): prevent file deletion when file has signature containers
- FileService.deleteFile: check signature_containers count before delete; throw
if file is part of any signing container
- FileController.deleteFile: return 409 with code FILE_HAS_SIGNATURES when
deletion is blocked so clients can show a clear message
* fix(file-manager): show clear message when file cannot be deleted (used in signing)
- On delete error, check for 409 and FILE_HAS_SIGNATURES or 'signing container'
- Show specific toast: file cannot be deleted because it has been used in a
signing container
* fix(esigner-api): sync file name and displayName from webhook so renames in File Manager appear in eSigner
- Update existing file from repo so entity is mutable
- Apply name, displayName, description, mimeType, size, md5Hash only when
present in payload so renames and partial syncs propagate correctly
* fix(file-manager): persist folder and view in URL so refresh keeps current location
- Add updateUrlFromState() and call it from navigateToFolder and switchView
- Use goto(..., { replaceState: true }) with view and folderId query params
- Existing onMount already reads view and folderId from URL so refresh restores state
* fix(file-manager-api): preserve file folder when webhook payload has no folderId
- When updating existing file, set file.folderId only if local.data.folderId
is present in the payload
- Prevents eSigner webhooks (no folder concept) from overwriting folderId
and moving deeply nested files to root when signed
* fix(esigner-api,esigner): show only explicit signing containers in eSigner list, not all files from File Manager
- esigner-api: getDocumentsWithStatus(userId, listMode). list=containers (default):
only files with at least one signee; list=all: all owner/invited files
- FileController.getFiles: read query param list=all and pass listMode
- esigner new container page: load selectable files via GET /api/files?list=all
into local state so picker shows any file; main list unchanged (containers only)
* fix(file-manager,esigner): display user-friendly file type labels (DOCX, XLSX, PDF) instead of raw MIME
- Add getMimeTypeDisplayLabel() in both apps: map long MIME types to short
labels (XLSX, DOCX, PPTX, PDF) with fallback for unknown types
- File Manager files/[id]: use for Type in subtitle and Details
- eSigner files/[id]: use for Type in preview area and File Information
* fix: rename and delete sync
* fix(file-manager-api): resolve one-request delay in update sync
The afterUpdate subscriber was experiencing stale reads because findOne
ran inside the transaction before commit. This caused webhooks to send
the previous state instead of the current state, resulting in eSigner
always being one update behind File Manager.
Changes:
- Refactored afterUpdate to pass metadata (entityId, relations) instead
of immediately loading the entity
- Created handleChangeWithReload that does the findOne INSIDE setTimeout
after the transaction has committed
- Set 50ms delay for files (ensures commit) vs 3s for other tables
- This ensures the DB read happens post-commit with fresh data
Root cause: TypeORM afterUpdate fires before transaction commit. When
findOne uses a different connection from the pool, it sees the last
committed state, not the pending uncommitted changes.
* fix(dreamsync-api): resolve one-request delay in wishlist sync
Same root cause as file-manager-api: afterUpdate called findOne inside
the transaction before commit, causing stale reads. eReputation received
the previous wishlist state instead of the current one.
Changes:
- Refactored afterUpdate to pass metadata (entityId, relations) instead
of immediately loading the entity
- Created handleChangeWithReload and executeReloadAndSend methods that
do the findOne INSIDE setTimeout after transaction commit
- Added Wishlist to getRelationsForEntity with ["user"] relation
- Wishlists sync with 50ms delay (ensures commit), groups keep 3s debounce
This ensures wishlist updates sync to eReputation immediately with
fresh, post-commit data.
* fix: prevent users from calling there files by the soft delete term
* fix: add id to afterUpdate1 parent 2ca826c commit bd9c36d
15 files changed
Lines changed: 498 additions & 138 deletions
File tree
- platforms
- dreamsync-api/src/web3adapter/watchers
- esigner-api/src
- controllers
- services
- esigner/src
- lib/utils
- routes/(protected)/files
- [id]
- new
- file-manager-api/src
- controllers
- services
- web3adapter/watchers
- file-manager/src
- lib/utils
- routes/(protected)/files
- [id]
Lines changed: 156 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
180 | 182 | | |
181 | 183 | | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | 184 | | |
186 | 185 | | |
187 | 186 | | |
188 | 187 | | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | 188 | | |
193 | 189 | | |
194 | 190 | | |
| |||
215 | 211 | | |
216 | 212 | | |
217 | 213 | | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
242 | 217 | | |
243 | 218 | | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
251 | 235 | | |
252 | 236 | | |
253 | 237 | | |
| |||
270 | 254 | | |
271 | 255 | | |
272 | 256 | | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
273 | 390 | | |
274 | 391 | | |
275 | 392 | | |
| |||
490 | 607 | | |
491 | 608 | | |
492 | 609 | | |
| 610 | + | |
| 611 | + | |
493 | 612 | | |
494 | 613 | | |
495 | 614 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
52 | 55 | | |
53 | 56 | | |
54 | 57 | | |
| |||
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
64 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
65 | 70 | | |
66 | 71 | | |
67 | 72 | | |
| |||
Lines changed: 17 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | | - | |
280 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
281 | 283 | | |
282 | 284 | | |
283 | 285 | | |
284 | 286 | | |
285 | 287 | | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
292 | 300 | | |
293 | | - | |
| 301 | + | |
294 | 302 | | |
295 | 303 | | |
296 | 304 | | |
| |||
0 commit comments