Skip to content

feat : itunes api, docs, supabase auth #1

Open
aman-wednesdaysol wants to merge 11 commits into
mainfrom
itunes
Open

feat : itunes api, docs, supabase auth #1
aman-wednesdaysol wants to merge 11 commits into
mainfrom
itunes

Conversation

@aman-wednesdaysol

Copy link
Copy Markdown
Owner

No description provided.

@aman-wednesdaysol aman-wednesdaysol changed the title Itunes feat : itunes api, docs, supabase auth Feb 20, 2026
Comment thread lib/services/itunes.js
Comment thread lib/services/itunes.js
Comment thread lib/services/itunes.js

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to define all hardcoded strings in a constants file.

Comment thread lib/routes/login/tests/routes.test.js Outdated
});

expect(res.statusCode).toEqual(200);
// expect(res.result.accessToken).toEqual('token');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this commented code if not required.

Comment thread lib/routes/login/routes.js Outdated
import { badImplementation } from '@utils/responseInterceptors';
import { supabaseLoginWithPassword } from '@services/supabaseAuth';

const payloadSchema = Joi.object({

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can define all the schemas in the lib/schemas folder so that they can be reused.

Comment thread lib/routes/music/resources/routes.js Outdated
}

const { term, limit, offset, country } = request.query;
console.log(`Searching for songs with term: ${term} and limit: ${limit} offset: ${offset}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not have console logs committed to the code.

Comment thread lib/routes/music/resources/routes.js Outdated
Comment on lines +32 to +46
const { authorization: authHeader } = request.headers;
const match = (authHeader || '').match(/^Bearer\s+(.+)$/i);
const token = match && match[1];

if (!token) {
throw unauthorized('Access denied. Unauthorized user.');
}

try {
const user = await getSupabaseUserFromToken({ accessToken: token });
request.app.user = user;
} catch (error) {
request.log('error', error);
throw unauthorized('Access denied. Unauthorized user.');
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this logic be in a middleware?

Comment thread lib/services/supabaseAuth.js Outdated
{
headers: {
apikey: supabaseConfig.anonKey,
'Content-Type': 'application/json',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The content type header is repeated multiple times in this file. We can define common headers in constants and just spread them here.

Comment thread docker-compose.yml
mysql_data:


# app:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have we commented out this part?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to avoid visiting docker every time i get something to debug while working locally.

Comment thread server.js Outdated
Comment thread lib/daos/likedSongsDao.js Outdated
buildSupabaseInsertHeaders,
} from '@utils/supabaseHeaders';

const TABLE = 'liked_songs';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define this in a constants file

Comment thread lib/daos/likedSongsDao.js Outdated
const assertSupabaseConfigured = () => {
if (!supabaseConfig.url || !supabaseConfig.anonKey) {
throw badImplementation(
'Supabase is not configured. Set SUPABASE_URL and SUPABASE_ANON_KEY.',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get such hardcoded strings from constants file

{
method: 'GET',
path: '/',
options: {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define these options in constants

@vercel

vercel Bot commented Feb 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nodejs-hapi-template Error Error Feb 25, 2026 7:17am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants