feat(swagger): Add Swagger API reference, and fixes #28
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user