fix(podcasts): serialize explicit as a real boolean in API responses
SQLite has no boolean type, so raw rows return explicit as 0/1. The podcast edit form round-trips whatever GET /api/podcasts/:id sends it, and the update schema requires z.boolean() — so saving any change without also touching the explicit checkbox failed validation with "Expected boolean, received number". Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -171,6 +171,23 @@ describe('podcasts, episodes, feed', () => {
|
||||
expect(res.statusCode).toBe(201);
|
||||
podcastId = res.json().id;
|
||||
expect(res.json().podcast_guid).toMatch(/^[0-9a-f-]{36}$/);
|
||||
expect(res.json().explicit).toBe(false); // not the raw SQLite 0/1
|
||||
});
|
||||
|
||||
it('lets the edit form round-trip a fetched podcast unmodified (regression: explicit came back as 0/1, not a bool)', async () => {
|
||||
const fetched = await app.inject({ method: 'GET', url: `/api/podcasts/${podcastId}`, headers: { cookie } });
|
||||
expect(fetched.json().explicit).toBe(false);
|
||||
|
||||
const { episodes: _episodes, feed_url: _feedUrl, ...editForm } = fetched.json();
|
||||
const res = await app.inject({
|
||||
method: 'PUT',
|
||||
url: `/api/podcasts/${podcastId}`,
|
||||
headers: { cookie },
|
||||
payload: editForm,
|
||||
});
|
||||
expect(res.statusCode).toBe(200);
|
||||
expect(res.json().lightning_address).toBe('tester@getalby.com');
|
||||
expect(res.json().explicit).toBe(false);
|
||||
});
|
||||
|
||||
it('registers an episode after verifying the blob on blossom', async () => {
|
||||
|
||||
Reference in New Issue
Block a user