Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build on PR

on:
pull_request:
branches:
- master
- migration


jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '20'


- name: Install Dependencies
run: npm install

- name: generate prisma client
run: npm run db:generate

- name: Run Build
run: npm run build
8 changes: 4 additions & 4 deletions apps/merchant-app/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import NextAuth from "next-auth"
import { authOptions } from "../../../../lib/auth"
// import NextAuth from "next-auth"
// import { authOptions } from "../../../../lib/auth"

const handler = NextAuth(authOptions)
// const handler = NextAuth(authOptions)

export { handler as GET, handler as POST }
// export { handler as GET, handler as POST }
10 changes: 2 additions & 8 deletions apps/merchant-app/app/api/user/route.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import { NextResponse } from "next/server"
import { PrismaClient } from "@repo/db/client";

const client = new PrismaClient();


export const GET = async () => {
await client.user.create({
data: {
email: "asd",
name: "adsads"
}
})

return NextResponse.json({
message: "hi there"
})
Expand Down
6 changes: 2 additions & 4 deletions apps/merchant-app/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
"use client";

import { useBalance } from "@repo/store/balance";

export default function() {
const balance = useBalance();

return <div>
hi there {balance}
hi there
</div>
}
48 changes: 0 additions & 48 deletions apps/merchant-app/lib/auth.ts
Original file line number Diff line number Diff line change
@@ -1,48 +0,0 @@
import GoogleProvider from "next-auth/providers/google";
import db from "@repo/db/client";

export const authOptions = {
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID || "",
clientSecret: process.env.GOOGLE_CLIENT_SECRET || ""
})
],
callbacks: {
async signIn({ user, account }: {
user: {
email: string;
name: string
},
account: {
provider: "google" | "github"
}
}) {
console.log("hi signin")
if (!user || !user.email) {
return false;
}

await db.merchant.upsert({
select: {
id: true
},
where: {
email: user.email
},
create: {
email: user.email,
name: user.name,
auth_type: account.provider === "google" ? "Google" : "Github" // Use a prisma type here
},
update: {
name: user.name,
auth_type: account.provider === "google" ? "Google" : "Github" // Use a prisma type here
}
});

return true;
}
},
secret: process.env.NEXTAUTH_SECRET || "secret"
}
2 changes: 0 additions & 2 deletions apps/user-app/.env.example

This file was deleted.

2 changes: 1 addition & 1 deletion apps/user-app/app/(dashboard)/transfer/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async function getOnRampTransactions() {
userId: Number(session?.user?.id)
}
});
return txns.map(t => ({
return txns.map((t: any) => ({
time: t.startTime,
amount: t.amount,
status: t.status,
Expand Down
12 changes: 6 additions & 6 deletions apps/user-app/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { redirect } from 'next/navigation'
import { authOptions } from "./lib/auth";

export default async function Page() {
const session = await getServerSession(authOptions);
if (session?.user) {
redirect('/dashboard')
} else {
redirect('/api/auth/signin')
}
const session = await getServerSession(authOptions);
if (session?.user) {
redirect('/dashboard')
} else {
redirect('/api/auth/signin')
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"build": "turbo build",
"dev": "turbo dev",
"lint": "turbo lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\""
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"db:generate": "cd packages/db && npx prisma migrate && cd ../../"
},
"devDependencies": {
"@repo/eslint-config": "*",
Expand Down
2 changes: 0 additions & 2 deletions packages/db/.env.example

This file was deleted.