Skip to content

Feat/automatic status#34

Merged
Ale-Coeto merged 12 commits intomainfrom
feat/automaticStatus
Jun 27, 2025
Merged

Feat/automatic status#34
Ale-Coeto merged 12 commits intomainfrom
feat/automaticStatus

Conversation

@aguajardoc
Copy link
Copy Markdown
Member

closes #11

@aguajardoc aguajardoc requested review from GilMM27 and Oscar-gg June 22, 2025 01:35
@aguajardoc aguajardoc force-pushed the feat/automaticStatus branch from 601d2d1 to 3eb162c Compare June 22, 2025 04:10
Copy link
Copy Markdown
Contributor

@GilMM27 GilMM27 left a comment

Choose a reason for hiding this comment

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

check suggestions

const session = await auth();
const userId = session?.user?.id;

await api.leetcode.checkNewCompletions({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

could we avoid making the call to the backend if we know that there is no user session?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

changed, please check. is checking "if (session)" enough?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can check something like

    if (!session?.user) {
        return (
            <div>
                Unauthorized
            </div>
        )
    }

But adding

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Would it be better to throw an error (which I think is what happens in weekly-problems?), or should it stay as a simple message?

I was thinking something like

if (!session?.user) {
    throw new Error("TRPCError: UNAUTHORIZED");
  }

but I'd like some feedback before pushing it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would say the 'Unauthorized' message is a better choice, as this is not an error but adequate behavior. Perhaps we could add standard 404 or 401 pages later

Copy link
Copy Markdown
Contributor

@GilMM27 GilMM27 left a comment

Choose a reason for hiding this comment

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

almost there!

username: input.username,
});
checkNewCompletions: publicProcedure
.input(z.object({ week: z.number(), userId: z.string(), leetcodeUser: z.string() }))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

removed the week argument as it was being unused

@Ale-Coeto Ale-Coeto merged commit 4b8a832 into main Jun 27, 2025
3 checks passed
@Rodrogamby Rodrogamby deleted the feat/automaticStatus branch July 13, 2025 19:51
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.

US2.3 - Automatic status

4 participants