Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/backend/controllers/djs.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const addToBin: RequestHandler<object, unknown, binBody> = async (req, re
};
try {
const added_bin_item = await DJService.addToBin(bin_entry);
res.status(200).json(added_bin_item);
res.status(201).json(added_bin_item);
} catch (e) {
console.error('Server error: Failed to insert into bin');
console.error(e);
Expand Down
6 changes: 3 additions & 3 deletions apps/backend/controllers/flowsheet.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export const addEntry: RequestHandler = async (req: Request<object, object, FSEn
}).catch((err) => console.error('[Flowsheet] Metadata fetch failed:', err));
}

res.status(200).json(completedEntry);
res.status(201).json(completedEntry);
} else if (
body.album_title === undefined ||
body.artist_name === undefined ||
Expand Down Expand Up @@ -234,7 +234,7 @@ export const addEntry: RequestHandler = async (req: Request<object, object, FSEn
}).catch((err) => console.error('[Flowsheet] Metadata fetch failed:', err));
}

res.status(200).json(completedEntry);
res.status(201).json(completedEntry);
}
} catch (e) {
console.error('Error: Failed to add track to flowsheet');
Expand All @@ -253,7 +253,7 @@ export const addEntry: RequestHandler = async (req: Request<object, object, FSEn
};
try {
const completedEntry: FSEntry = await flowsheet_service.addTrack(fsEntry);
res.status(200).json(completedEntry);
res.status(201).json(completedEntry);
} catch (e) {
console.error('Error: Failed to add message to flowsheet');
console.error(e);
Expand Down
10 changes: 5 additions & 5 deletions apps/backend/controllers/library.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const addAlbum: RequestHandler = async (req: Request<object, object, NewA
};

const inserted_album: Album = await libraryService.insertAlbum(new_album);
res.status(200).json(inserted_album);
res.status(201).json(inserted_album);
} catch (e) {
console.error('Error: Could not insert new album');
console.error(e);
Expand Down Expand Up @@ -155,7 +155,7 @@ export const addArtist: RequestHandler = async (req: Request<object, object, New

const response: Artist = await libraryService.insertArtist(new_artist);
await libraryService.insertArtistGenreCrossreference(response.id, body.genre_id, body.code_number);
res.status(200);
res.status(201);
res.json({
...response,
code_number: body.code_number,
Expand Down Expand Up @@ -221,7 +221,7 @@ export const addRotation: RequestHandler<object, unknown, NewRotationRelease> =
} else {
try {
const rotationRelease: RotationRelease = await libraryService.addToRotation(req.body);
res.status(200).json(rotationRelease);
res.status(201).json(rotationRelease);
} catch (e) {
console.error(e);
next(e);
Expand Down Expand Up @@ -279,7 +279,7 @@ export const addFormat: RequestHandler = async (req, res, next) => {
};

const insertion = await libraryService.insertFormat(newFormat);
res.status(200).json(insertion);
res.status(201).json(insertion);
} catch (e) {
console.error('Failed to add new format');
console.error(e);
Expand Down Expand Up @@ -309,7 +309,7 @@ export const addGenre: RequestHandler = async (req, res, next) => {

const insertion = await libraryService.insertGenre(newGenre);

res.status(200).json(insertion);
res.status(201).json(insertion);
} catch (e) {
console.error('Failed to add new genre');
console.error(e);
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/controllers/schedule.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const addToSchedule: RequestHandler = async (req: Request<object, object,
const { body } = req;
try {
const response = await ScheduleService.addToSchedule(body);
res.status(200).json(response);
res.status(201).json(response);
} catch (e) {
console.error('Error adding to schedule');
console.error(e);
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/djs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('DJ Bin', () => {
dj_id: global.primary_dj_id,
album_id: 1,
})
.expect(200);
.expect(201);

expectFields(res.body, 'album_id', 'dj_id');
expect(res.body.album_id).toBe(1);
Expand All @@ -67,7 +67,7 @@ describe('DJ Bin', () => {
album_id: 1,
track_title: 'Carry the Zero',
})
.expect(200);
.expect(201);

expectFields(res.body, 'album_id', 'track_title');
expect(res.body.album_id).toBe(1);
Expand Down
30 changes: 15 additions & 15 deletions tests/integration/flowsheet.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ describe('Add to Flowsheet', () => {
track_title: 'Carry the Zero',
// record_label: 'Warner Bros',
})
.expect(200);
.expect(201);

expect(res.body).toBeDefined();
expect(res.body.album_title).toEqual('Keep it Like a Secret');
Expand All @@ -182,7 +182,7 @@ describe('Add to Flowsheet', () => {
track_title: 'Carry the Zero',
rotation_id: 1,
})
.expect(200);
.expect(201);

expect(res.body).toBeDefined();
expect(res.body.album_title).toEqual('Keep it Like a Secret');
Expand All @@ -197,7 +197,7 @@ describe('Add to Flowsheet', () => {
track_title: 'Carry the Zero',
record_label: 'Warner Bros',
})
.expect(200);
.expect(201);

expect(res.body.album_title).toEqual('Keep it Like a Secret');
expect(res.body.track_title).toEqual('Carry the Zero');
Expand All @@ -213,7 +213,7 @@ describe('Add to Flowsheet', () => {
track_title: 'Carry the Zero',
request_flag: true,
})
.expect(200);
.expect(201);

expect(res.body).toBeDefined();
expect(res.body.album_title).toEqual('Keep it Like a Secret');
Expand All @@ -229,7 +229,7 @@ describe('Add to Flowsheet', () => {
album_title: 'Keep it Like a Secret',
track_title: 'Carry the Zero',
})
.expect(200);
.expect(201);

expect(res.body).toBeDefined();
expect(res.body.album_title).toEqual('Keep it Like a Secret');
Expand All @@ -246,7 +246,7 @@ describe('Add to Flowsheet', () => {
track_title: 'Carry the Zero',
record_label: 'Warner Bros',
})
.expect(200);
.expect(201);

expect(res.body).toBeDefined();
expect(res.body.album_title).toEqual('Keep it Like a Secret');
Expand All @@ -264,7 +264,7 @@ describe('Add to Flowsheet', () => {
track_title: 'Carry the Zero',
request_flag: true,
})
.expect(200);
.expect(201);

expect(res.body).toBeDefined();
expect(res.body.album_title).toEqual('Keep it Like a Secret');
Expand All @@ -278,7 +278,7 @@ describe('Add to Flowsheet', () => {
.send({
message: 'Test Message',
})
.expect(200);
.expect(201);

expect(res.body).toBeDefined();
expect(res.body.message).toEqual('Test Message');
Expand Down Expand Up @@ -492,7 +492,7 @@ describe('Retrieve Now Playing', () => {
album_id: 1, //Built to Spill - Keep it Like a Secret
track_title: 'Carry the Zero',
})
.expect(200);
.expect(201);
});

afterEach(async () => {
Expand All @@ -515,7 +515,7 @@ describe('Retrieve Now Playing', () => {
album_id: 2, //Ravyn Lenae - Crush
track_title: 'Venom',
})
.expect(200);
.expect(201);

res = await request.get('/flowsheet/latest').expect(200);
expect(res.body).toBeDefined();
Expand All @@ -537,7 +537,7 @@ describe('Shift Flowsheet Entries', () => {
album_id: 1, //Built to Spill - Keep it Like a Secret
track_title: 'Carry the Zero',
})
.expect(200);
.expect(201);

await request
.post('/flowsheet')
Expand All @@ -546,7 +546,7 @@ describe('Shift Flowsheet Entries', () => {
album_id: 2, //Ravyn Lenae - Crush
track_title: 'Venom',
})
.expect(200);
.expect(201);

await request
.post('/flowsheet')
Expand All @@ -555,7 +555,7 @@ describe('Shift Flowsheet Entries', () => {
album_id: 3, //Jockstrap - I Love You Jennifer B
track_title: 'Debra',
})
.expect(200);
.expect(201);
});

afterEach(async () => {
Expand Down Expand Up @@ -700,7 +700,7 @@ describe('Retrieve Playlist Object', () => {
album_id: 3, //Jockstrap - I Love You Jennifer B
track_title: 'Debra',
})
.expect(200);
.expect(201);

await fls_util.leave_show(global.primary_dj_id, global.access_token);
});
Expand Down Expand Up @@ -771,7 +771,7 @@ describe('V1 API - entry_type field', () => {
album_id: 1,
track_title: 'Carry the Zero',
})
.expect(200);
.expect(201);

// POST response includes entry_type
expect(addRes.body.entry_type).toBe('track');
Expand Down
12 changes: 6 additions & 6 deletions tests/integration/library.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('Library Catalog', () => {
genre_id: 1,
format_id: 1,
})
.expect(200);
.expect(201);

expectFields(res.body, 'id', 'album_title');
expect(res.body.album_title).toContain('Test Album');
Expand Down Expand Up @@ -204,7 +204,7 @@ describe('Library Rotation', () => {
album_id: 2,
rotation_bin: 'M',
})
.expect(200);
.expect(201);

expectFields(res.body, 'id', 'album_id', 'rotation_bin');
expect(res.body.album_id).toBe(2);
Expand Down Expand Up @@ -323,7 +323,7 @@ describe('Library Artists', () => {
genre_id: 1,
code_number: 1,
})
.expect(200);
.expect(201);

expectFields(res.body, 'id', 'artist_name', 'alphabetical_name', 'code_letters', 'code_number');
expect(res.body.artist_name).toContain('Test Artist');
Expand Down Expand Up @@ -394,7 +394,7 @@ describe('Library Artists', () => {
genre_id: 1,
code_number: 1,
})
.expect(200);
.expect(201);

expect(res.body.alphabetical_name).toBe(`Band ${uniqueSuffix}, The`);
});
Expand Down Expand Up @@ -448,7 +448,7 @@ describe('Library Formats', () => {
.send({
name: `Test Format ${uniqueSuffix}`,
})
.expect(200);
.expect(201);

expectFields(res.body, 'id', 'format_name');
expect(res.body.format_name).toContain('Test Format');
Expand Down Expand Up @@ -495,7 +495,7 @@ describe('Library Genres', () => {
name: `Test Genre ${uniqueSuffix}`,
description: 'A test genre for integration testing',
})
.expect(200);
.expect(201);

expectFields(res.body, 'id', 'genre_name');
expect(res.body.genre_name).toContain('Test Genre');
Expand Down
Loading
Loading