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

fix challenges #1234

Merged
merged 1 commit into from
Dec 2, 2023
Merged

fix challenges #1234

merged 1 commit into from
Dec 2, 2023

Conversation

bautistaaa
Copy link
Member

Description

  • challenge submission should not taking user id
  • cant query aot challenges if before reveal
  • cant submit answer to aot challenges if before reveal

Copy link

vercel bot commented Dec 2, 2023

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

Name Status Preview Comments Updated (UTC)
typehero ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 2, 2023 2:31am
typehero-admin ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 2, 2023 2:31am
typehero-admin-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 2, 2023 2:31am
typehero-og-image ✅ Ready (Inspect) Visit Preview Dec 2, 2023 2:31am
typehero-web-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 2, 2023 2:31am

code: string;
isSuccessful: boolean;
}
export async function saveSubmission({ challenge, userId, code, isSuccessful }: Args) {
export async function saveSubmission({ challenge, code, isSuccessful }: Args) {
Copy link
Member Author

Choose a reason for hiding this comment

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

this was taking userId and didnt even check if they were auth'd o.O

Copy link
Member Author

Choose a reason for hiding this comment

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

i thought we fixed em all but guess not

Copy link
Member

@Hacksore Hacksore left a comment

Choose a reason for hiding this comment

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

LGTM

const [, day = '1'] = slug.split('-');
const daysPassed = daysAfterDecemberFirst();
if (parseInt(day) > daysPassed + 1) {
throw new Error('Not Available');
Copy link
Collaborator

Choose a reason for hiding this comment

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

lgtm, alternatively could return null and then notFound() in the route

Copy link
Member Author

Choose a reason for hiding this comment

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

for sure, went with throw just because i was using findFirstOrThrow below. so just implicitly trusted we do something good haha

Comment on lines +33 to +35
if (parseInt(day) > daysPassed + 1) {
throw new Error('Not Available');
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

github-actions bot commented Dec 2, 2023

E2E report: https://04b44a3d.typehero-70p.pages.dev

@bautistaaa bautistaaa merged commit 68350ea into main Dec 2, 2023
11 checks passed
@bautistaaa bautistaaa deleted the trash/oops branch December 2, 2023 02:39
@odicho
Copy link
Collaborator

odicho commented Dec 2, 2023

Great work!!!

Perhaps we should setup a task for someone to just do a quick scan of APIs that require authorization and make sure it's directly pulling it from the session!

@bautistaaa
Copy link
Member Author

Great work!!!

Perhaps we should setup a task for someone to just do a quick scan of APIs that require authorization and make sure it's directly pulling it from the session!

lol we did but i guess we somehow missed this 😂😂

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

4 participants