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

feat: set up database and auth #178

Merged
merged 9 commits into from
Dec 19, 2023
Merged

feat: set up database and auth #178

merged 9 commits into from
Dec 19, 2023

Conversation

sofiiadan
Copy link
Contributor

Setup with prisma, basic auth concept with email/password login

Possible future improvements:

  • magic link email login (SMTP server setup)

@sofiiadan sofiiadan added feature New feature or request app changes related to /app breaking labels Nov 20, 2023
@sofiiadan sofiiadan self-assigned this Nov 20, 2023
@sofiiadan sofiiadan requested a review from simon-hng November 20, 2023 17:51
Copy link

vercel bot commented Nov 20, 2023

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

Name Status Preview Comments Updated (UTC)
space ❌ Failed (Inspect) Nov 26, 2023 2:14pm

Copy link
Collaborator

@simon-hng simon-hng left a comment

Choose a reason for hiding this comment

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

Awesome work! Keep going 🚀🔥🐳


export const authOptions: NextAuthOptions = {
adapter: PrismaAdapter(db),
secret: process.env.NEXTAUTH_SECRET,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you add this var in /app/env.mjs, so it is checked at build time?

https://github.com/t3-oss/t3-env

You can then use it with typesafety by using import { env } from "env.mjs";

app/app/api/schema.dot Outdated Show resolved Hide resolved

return NextResponse.json({ user: rest, message: "Great success!"}, { status : 201 });
} catch(error) {
return NextResponse.json({message: "Error!"}, { status : 500});
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think just throwing an error should lead to a response with error code 500. Additionaly you get the error wrapped in the response so you can see the error code in the client - The only thing you have to be careful about is that you don't expose sensitive information

redirect: false
});
if(signInData?.error) {
console.log(signInData.error);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
console.log(signInData.error);
console.error(signInData.error);

updated_at DateTime @updatedAt
}

enum ContactType {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Amazing!

username: string
}
interface Session {
user: User & {
Copy link
Collaborator

Choose a reason for hiding this comment

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

isn't this just the User interface above?

user: User & {
username: string
}
token: {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this as well

Copy link

vercel bot commented Dec 19, 2023

@simon-hng is attempting to deploy a commit to a Personal Account on Vercel that is not owned by them.

In order for the commit to be deployed, @simon-hng must be granted access to the connected Vercel project.

If you're the owner of the Personal Account, transfer the project to a Vercel Team and start collaborating, or learn more.

Co-authored-by: Sofiia Danylchenko <[email protected]>
Co-authored-by: simonhng <[email protected]>
@simon-hng simon-hng changed the title Draft: database and auth concepts with existing project feat: set up database and auth Dec 19, 2023
@simon-hng simon-hng merged commit c7fca61 into dev Dec 19, 2023
1 of 3 checks passed
@simon-hng simon-hng deleted the feat/dabase-and-auth-274 branch December 19, 2023 18:28
simon-hng added a commit that referenced this pull request Mar 17, 2024
Co-authored-by: Cyro292 <[email protected]>
Co-authored-by: simonhng <[email protected]>
Co-authored-by: Behsad Riemer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app changes related to /app breaking enhancement feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants