Commit 757baa8
committed
fix(api): correctly serialize and deserialize user content preferences
User creation was failing with a type cast error when creating the default UserContentPreferences. This was caused by two issues:
1. Complex list objects were not being JSON-encoded before being sent to the database's JSONB columns.
2. DateTime objects returned from the database were not being converted to strings before being passed to the fromJson factory.
This change introduces custom toJson and fromJson functions for the userContentPreferencesRepository. These functions handle the necessary data transformations, ensuring correct serialization and deserialization and resolving the runtime error.1 parent 43454b4 commit 757baa8
1 file changed
+21
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
157 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
158 | 177 | | |
159 | 178 | | |
160 | 179 | | |
| |||
0 commit comments