Skip to content

Commit 34b4813

Browse files
Formatting
1 parent 5aa8521 commit 34b4813

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

src/controller/Spotify.controller.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ exports.searchSong = (term, offset = 0) => {
133133
return new Promise(async (resolve, reject) => {
134134
try {
135135
await initSpotify();
136-
console.log({ spotifyApi })
137136
const songResults = await spotifyApi.searchTracks(term, { market: 'IE', offset });
138137
resolve(songResults);
139138
} catch (error) {
@@ -156,19 +155,12 @@ function initGuestSpotify() {
156155
if (!guestProvider) reject({ status: 404, message: "Guest does not have a Spotify linked" });
157156

158157
const { lastUpdated, accessToken, refreshToken } = guestProvider;
159-
// console.log({ lastUpdated, accessToken, refreshToken })
160158

161159
globalThis.GuestSpotify = { lastUpdated, accessToken, refreshToken };
162-
// globalThis.Guest.lastUpdated = lastUpdated;
163-
// globalThis.Guest.accessToken = accessToken;
164-
// globalThis.Guest.refreshToken = refreshToken;
165-
166160

167161
const expirationDate = new Date(lastUpdated);
168162
expirationDate.setSeconds(expirationDate.getSeconds() + (3600 * 0));
169163

170-
console.log({ accessToken, refreshToken, expirationDate, date: new Date(), userId, guestProvider })
171-
172164
spotifyApi.setAccessToken(accessToken);
173165
spotifyApi.setRefreshToken(refreshToken);
174166

src/routes/Admin.route.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ router.use((req, res, next) => {
99
globalThis.Logger.log('info', `[${NAMESPACE}] Verifying user isAdmin `, { ...globalThis.LoggingParams, })
1010

1111
try {
12-
if(globalThis.isAdmin) {
12+
if (globalThis.isAdmin) {
1313
next();
1414
} else {
1515
globalThis.Logger.log('error', `[${NAMESPACE}] User is not Admin `, { ...globalThis.LoggingParams, })
1616
res.status(404).send({ message: "Not found" });
1717
}
18-
} catch(error) {
18+
} catch (error) {
1919
globalThis.Logger.log('error', `[${NAMESPACE}] Could not check if user is Admin `, { ...globalThis.LoggingParams, error })
2020

2121
res.send(error);
@@ -27,14 +27,19 @@ router.get('/', (req: Request, res: Response) => {
2727
});
2828

2929
router.put('/coasters/:coasterId', async (req: Request, res: Response) => {
30+
const { coasterId } = req.params;
3031
try {
31-
const { coasterId } = req.params;
3232
const { encoded, group } = req.body;
3333
globalThis.Logger.log('info', `[${NAMESPACE}] Update Coaster `, { ...globalThis.LoggingParams, params: { coasterId, group, encoded } })
3434

3535
res.send(await Admin.updateCoaster(coasterId, { encoded, group }));
36-
} catch(error) {
37-
globalThis.Logger.log('error', `[${NAMESPACE}] Could not Update Coaster `, { ...globalThis.LoggingParams, error })
36+
} catch (error) {
37+
globalThis.Logger.log('error', `[${NAMESPACE}] Could not Update Coaster `, { ...globalThis.LoggingParams, coasterId, error })
38+
39+
res.send(error);
40+
}
41+
});
42+
3843
router.post('/coasters/:coasterId', async (req: Request, res: Response) => {
3944
const { coasterId } = req.params;
4045
try {

0 commit comments

Comments
 (0)