Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thomas/event service #525

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open

Thomas/event service #525

wants to merge 27 commits into from

Conversation

Tom-Caz
Copy link

@Tom-Caz Tom-Caz commented Mar 6, 2024

Description

  • Converted event service API from python to NextJS API routes
  • I kept the naming conventions the same from the previous API. API uses camelCase (i.e eventTags), while DB uses snake_case (i.e event_tags).

Before pushing to Prod

  • Make sure to add a on cascade to the prod DB for event_tags, industry_tags, and pinned_events. The SQL commands to do this are on the test DB
  • Add in EVENT_AUTH_SERVICE_URL and EVENT_MASTER_TOKEN env variables

Battlepass

  • For some reason, the battlepass-service is unformatted and prettier really wants to format it, so thats why it's there. I tried to remove it but our tests auto-format it on commit.

Copy link

vercel bot commented Mar 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
pointr ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 4, 2024 1:42am
7 Ignored Deployments
Name Status Preview Comments Updated (UTC)
dashboard ⬜️ Ignored (Inspect) Visit Preview Apr 4, 2024 1:42am
interim ⬜️ Ignored (Inspect) Visit Preview Apr 4, 2024 1:42am
podium ⬜️ Ignored (Inspect) Visit Preview Apr 4, 2024 1:42am
recruitment ⬜️ Ignored (Inspect) Visit Preview Apr 4, 2024 1:42am
sso ⬜️ Ignored (Inspect) Visit Preview Apr 4, 2024 1:42am
ui-kit-2023-storybook ⬜️ Ignored (Inspect) Visit Preview Apr 4, 2024 1:42am
www-2023 ⬜️ Ignored (Inspect) Visit Preview Apr 4, 2024 1:42am

Copy link
Contributor

@VictiniX888 VictiniX888 left a comment

Choose a reason for hiding this comment

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

Some changes! Also make sure you pull again because I just merged from main

@@ -36,6 +36,10 @@ export const getEnv = () => {
RSVPForm: {
ResumeStorageBucketName: 'rsvp-resume-hacker-2023',
},
EventService: {
authServiceUrl: process.env.EVENT_AUTH_SERVICE_URL,
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be better to put authServiceUrl outside the EventService since it is shared between this and Podium

(path.pathname === '/api/events' && method === 'GET') ||
// has {user_id} in path
(path.pathname.startsWith('/api/events/') &&
path.pathname.split('/').length === 3 &&
Copy link
Contributor

Choose a reason for hiding this comment

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

I think path.pathname.split('/').length should be 4 instead of 3 if you're trying to match for /api/events/[eventId]

request.nextUrl.pathname = '/api/error';
return NextResponse.redirect(request.nextUrl);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should also handle case where regular user is trying to access admin-only endpoints


async function get(req: NextApiRequest, res: NextApiResponse) {
let { event_id } = req.query;
const isAdmin = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's just set isAdmin to false since that's what it was originally

req: NextApiRequest,
res: NextApiResponse
) {
let event_id = req.query.event_id;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should check method == GET

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe remove? Along with styles.css, nx-welcome.tsx and other starter files

@@ -24,7 +24,7 @@ import { getEnv } from '@hibiscus/env';

@injectable()
export class HibiscusSupabaseClient {
private client: SupabaseClient;
private client: SupabaseClient<'events'>;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think should probably revert this change? Since you're calling createClient from supabase-js directly in the repository.ts now.

query = query.gte('end_time', after.toISOString());
}

query.order('start_time', { ascending: false });
Copy link
Contributor

Choose a reason for hiding this comment

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

Start time should be ordered ascending = true

endTime: data.end_time,
location: data.location,
description: data.description,
eventTags: data.event_tags,
Copy link
Contributor

Choose a reason for hiding this comment

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

eventTags and industryTags should be mapped to a list of string of the tag (same for /getEvents), currently returns entire tag object

Copy link

gitguardian bot commented Apr 4, 2024

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
9632465 Triggered Generic Password 6c0d9b4 apps/event-service/configs/env.local.yml View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

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.

None yet

2 participants