[PR #3993] [MERGED] fix stringifySequelizeQuery and add tests #4141

Closed
opened 2026-04-25 00:18:28 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/3993
Author: @mikiher
Created: 2/15/2025
Status: Merged
Merged: 2/16/2025
Merged by: @advplyr

Base: masterHead: fix-stringify-sequelize-query


📝 Commits (1)

  • 8ee5646 fix stringifySequelizeQuery and add tests

📊 Changes

2 files changed (+68 additions, -25 deletions)

View changed files

📝 server/utils/stringifySequelizeQuery.js (+16 -25)
test/server/utils/stringifySequeslizeQuery.test.js (+52 -0)

📄 Description

Brief summary

I believe the implementation of stringifySequelizeQuery in PR #3980 was buggy (it didn't pass the test I wrote).

Which issue is fixed?

Same as PR #3980

In-depth Description

I wrote a slightly simpler implementation by implementing a replacer function which you can pass to JSON.stringify
The replacer function deals with two values that are ignored by JSON.stringify by default:

  • Symbols
  • Classes (mostly for e.g. model: Database.libraryItemModel)

How have you tested this?

Wrote a unit test, and made sure the correct key is generated for real queries in the code.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/3993 **Author:** [@mikiher](https://github.com/mikiher) **Created:** 2/15/2025 **Status:** ✅ Merged **Merged:** 2/16/2025 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `fix-stringify-sequelize-query` --- ### 📝 Commits (1) - [`8ee5646`](https://github.com/advplyr/audiobookshelf/commit/8ee5646d790d5bf5a1fef42079b686b93f40a9d1) fix stringifySequelizeQuery and add tests ### 📊 Changes **2 files changed** (+68 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `server/utils/stringifySequelizeQuery.js` (+16 -25) ➕ `test/server/utils/stringifySequeslizeQuery.test.js` (+52 -0) </details> ### 📄 Description ## Brief summary I believe the implementation of stringifySequelizeQuery in PR #3980 was buggy (it didn't pass the test I wrote). ## Which issue is fixed? Same as PR #3980 ## In-depth Description I wrote a slightly simpler implementation by implementing a `replacer` function which you can pass to `JSON.stringify` The replacer function deals with two values that are ignored by JSON.stringify by default: - Symbols - Classes (mostly for e.g. `model: Database.libraryItemModel`) ## How have you tested this? Wrote a unit test, and made sure the correct key is generated for real queries in the code. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:18:28 +02:00
adam closed this issue 2026-04-25 00:18:28 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4141