Skip to content

Commit

Permalink
Update import paths for auth module & t3/env config file
Browse files Browse the repository at this point in the history
  • Loading branch information
pheralb committed Mar 12, 2024
1 parent 5ff6b72 commit b7a2f59
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 19 deletions.
4 changes: 1 addition & 3 deletions src/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import { handlers } from "auth";

export const { GET, POST } = handlers;
export { GET, POST } from "@/auth";
2 changes: 1 addition & 1 deletion src/app/api/url/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const GET = async (req: NextRequest) => {
}

// Get data from query:
const data = (await db.link.findFirst({
const data = (await db.links.findFirst({
where: {
slug: {
equals: params,
Expand Down
2 changes: 1 addition & 1 deletion src/app/dashboard/settings/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { auth, signOut } from "auth";
import { auth, signOut } from "@/auth";

const SettingsPage = async () => {
const session = await auth();
Expand Down
2 changes: 1 addition & 1 deletion src/components/auth/user-button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Link from "next/link";

import { auth } from "auth";
import { auth } from "@/auth";

import {
DropdownMenu,
Expand Down
2 changes: 1 addition & 1 deletion src/components/links/create-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
} from "@/ui/form";
import { Input, Textarea } from "@/ui/input";
import { LoaderIcon, RocketIcon, ShuffleIcon } from "lucide-react";
import { env } from "@/env.js";
import { env } from "@/env.mjs";

interface CreateLinkProps {
children: ReactNode;
Expand Down
2 changes: 1 addition & 1 deletion src/server/actions/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import bcrypt from "bcryptjs";
import { AuthError } from "next-auth";

import { db } from "@/server/db";
import { signIn, signOut } from "auth";
import { signIn, signOut } from "@/auth";
import { getUserByEmail } from "@/server/utils/user";
import {
getPasswordResetTokenByToken,
Expand Down
18 changes: 9 additions & 9 deletions src/server/actions/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import type { z } from "zod";
import type { CreateLinkSchema, LinkSchema } from "@/server/schemas";

import { auth } from "auth";
import { auth } from "@/auth";
import { db } from "@/server/db";
import { revalidatePath } from "next/cache";
import { env } from "@/env.js";
import { env } from "@/env.mjs";

/**
* Get links created by user.
Expand All @@ -20,7 +20,7 @@ export const getLinksByUser = async () => {
return null;
}

const result = await db.link.findMany({
const result = await db.links.findMany({
where: {
creatorId: currentUser.user?.id,
},
Expand All @@ -43,7 +43,7 @@ export const getSingleLink = async (id: number) => {
return null;
}

const result = await db.link.findUnique({
const result = await db.links.findUnique({
where: {
id,
},
Expand All @@ -59,7 +59,7 @@ export const getSingleLink = async (id: number) => {
* @type {string()}
*/
export const checkIfSlugExist = async (slug: string) => {
const result = await db.link.findUnique({
const result = await db.links.findUnique({
where: {
slug: slug,
},
Expand All @@ -85,7 +85,7 @@ export const checkLimit = async () => {
return null;
}

const result = await db.link.count({
const result = await db.links.count({
where: {
creatorId: currentUser.user?.id,
},
Expand All @@ -112,7 +112,7 @@ export const createLink = async (values: z.infer<typeof CreateLinkSchema>) => {
}

// Create new link:
const result = await db.link.create({
const result = await db.links.create({
data: {
...values,
creatorId: currentUser.user?.id,
Expand All @@ -138,7 +138,7 @@ export const updateLink = async (values: z.infer<typeof LinkSchema>) => {
}

// Update link:
const result = await db.link.update({
const result = await db.links.update({
where: { slug: values.slug },
data: {
...values,
Expand All @@ -163,7 +163,7 @@ export const deleteLink = async (id: number) => {
}

// Update link:
const result = await db.link.delete({
const result = await db.links.delete({
where: { id: id, creatorId: currentUser.user?.id },
});

Expand Down
2 changes: 1 addition & 1 deletion src/server/db.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PrismaClient } from "@prisma/client";
import { PrismaLibSQL } from "@prisma/adapter-libsql";
import { createClient } from "@libsql/client";
import { env } from "@/env.js";
import { env } from "@/env.mjs";

const globalForPrisma = globalThis as unknown as {
prisma: PrismaClient | undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/server/mail.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Resend } from "resend";
import { env } from "@/env.js";
import { env } from "@/env.mjs";

const resend = new Resend(env.RESEND_API_KEY);

Expand Down

0 comments on commit b7a2f59

Please sign in to comment.