feat(swagger): Add Swagger API reference, and fixes #28

Merged
Gandalf merged 28 commits from develop into main 2026-05-21 20:14:36 +01:00
2 changed files with 20 additions and 0 deletions
Showing only changes of commit e8037afbb8 - Show all commits
+2
View File
@@ -397,6 +397,7 @@ router.get('/recent', requireAuth, async (req, res) => {
if (isAdmin) {
item.arrRecordId = record.id;
item.arrType = 'sonarr';
if (outcome === 'failed' && record.data && record.data.message) {
item.failureMessage = record.data.message;
}
@@ -445,6 +446,7 @@ router.get('/recent', requireAuth, async (req, res) => {
if (isAdmin) {
item.arrRecordId = record.id;
item.arrType = 'radarr';
if (outcome === 'failed' && record.data && record.data.message) {
item.failureMessage = record.data.message;
}
+18
View File
@@ -324,6 +324,24 @@ describe('GET /api/history/recent', () => {
expect(failed).toBeDefined();
expect(failed.failureMessage).toBe('Not enough disk space');
});
it('includes arrType for admin on Sonarr and Radarr records', async () => {
const app = createApp({ skipRateLimits: true });
cache.set('poll:sonarr-tags', [{ data: SONARR_TAGS_WITH_ADMIN }], 60000);
cache.set('poll:radarr-tags', [{ id: 1, label: 'alice' }], 60000);
setHistory([SONARR_RECORD_IMPORTED], [RADARR_RECORD_IMPORTED]);
const { cookies } = await loginAs(app, EMBY_ADMIN, EMBY_AUTH_ADMIN);
const res = await request(app)
.get('/api/history/recent?showAll=true')
.set('Cookie', cookies);
expect(res.status).toBe(200);
const sonarrItem = res.body.history.find(h => h.type === 'series');
expect(sonarrItem).toBeDefined();
expect(sonarrItem.arrType).toBe('sonarr');
const radarrItem = res.body.history.find(h => h.type === 'movie');
expect(radarrItem).toBeDefined();
expect(radarrItem.arrType).toBe('radarr');
});
});
describe('deduplication', () => {