-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from agrattan0820/dev
v0.3.0
- Loading branch information
Showing
123 changed files
with
3,971 additions
and
10,187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Run Development Database Migrations | ||
|
||
on: | ||
push: | ||
branches: ["dev"] | ||
|
||
jobs: | ||
build: | ||
name: Build and Run Migrations | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-latest | ||
env: | ||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | ||
TURBO_TEAM: ${{ vars.TURBO_TEAM }} | ||
DATABASE_URL: ${{ secrets.DEV_DATABASE_URL }} | ||
POSTGRES_URL: ${{ secrets.POSTGRES_URL }} | ||
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }} | ||
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }} | ||
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }} | ||
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }} | ||
NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }} | ||
|
||
steps: | ||
- name: 🏗 Check out code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- uses: pnpm/[email protected] | ||
with: | ||
version: 6.32.2 | ||
|
||
- name: 🏗 Setup Node.js environment | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: "pnpm" | ||
|
||
- name: 👷 Install dependencies | ||
run: pnpm install | ||
|
||
# - name: 📀 Install Playwright Browsers | ||
# run: npx playwright install --with-deps | ||
|
||
- name: 🥾 Run db migrations | ||
working-directory: "./packages/database" | ||
run: pnpm db:migrate:run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Run Production Database Migrations | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
|
||
jobs: | ||
build: | ||
name: Build and Run Migrations | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-latest | ||
env: | ||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | ||
TURBO_TEAM: ${{ vars.TURBO_TEAM }} | ||
DATABASE_URL: ${{ secrets.DATABASE_URL }} | ||
POSTGRES_URL: ${{ secrets.POSTGRES_URL }} | ||
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }} | ||
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }} | ||
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }} | ||
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }} | ||
NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }} | ||
|
||
steps: | ||
- name: 🏗 Check out code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- uses: pnpm/[email protected] | ||
with: | ||
version: 6.32.2 | ||
|
||
- name: 🏗 Setup Node.js environment | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: "pnpm" | ||
|
||
- name: 👷 Install dependencies | ||
run: pnpm install | ||
|
||
- name: 🥾 Run db migrations | ||
working-directory: "./packages/database" | ||
run: pnpm db:migrate:run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import "next-auth"; | ||
|
||
declare module "next-auth" { | ||
interface User { | ||
id: string; | ||
name: string | null; | ||
nickname: string; | ||
email: string | null; | ||
emailVerified: Date | null; | ||
image: string | null; | ||
createdAt: Date; | ||
} | ||
|
||
/** | ||
* Returned by `useSession`, `getSession` and received as a prop on the `Provider` React Context | ||
*/ | ||
interface Session { | ||
user: User; | ||
expires: string; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { getServerSession } from "next-auth"; | ||
import { cookies } from "next/headers"; | ||
import { redirect } from "next/navigation"; | ||
|
||
import { existingHost } from "@ai/app/server-actions"; | ||
import { authOptions } from "@ai/pages/api/auth/[...nextauth]"; | ||
|
||
export async function GET(req: Request) { | ||
const session = await getServerSession(authOptions(req)); | ||
|
||
const sessionToken = cookies().get("next-auth.session-token"); | ||
|
||
if (!session || !sessionToken) { | ||
redirect("/"); | ||
} | ||
|
||
const searchParams = new URL(req.url).searchParams; | ||
|
||
const nickname = searchParams.get("nickname"); | ||
|
||
if (!nickname) { | ||
redirect("/"); | ||
} | ||
|
||
const roomForExistingUser = await existingHost({ | ||
userId: session.user.id, | ||
nickname, | ||
sessionToken: sessionToken.value, | ||
}); | ||
|
||
redirect(`/room/${roomForExistingUser.room.code}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { redirect } from "next/navigation"; | ||
import { getServerSession } from "next-auth"; | ||
import { cookies } from "next/headers"; | ||
|
||
import { joinRoom } from "@ai/app/server-actions"; | ||
import { authOptions } from "@ai/pages/api/auth/[...nextauth]"; | ||
|
||
export async function GET(req: Request) { | ||
const session = await getServerSession(authOptions(req)); | ||
|
||
const sessionToken = cookies().get("next-auth.session-token"); | ||
|
||
if (!session || !sessionToken) { | ||
redirect("/"); | ||
} | ||
|
||
const searchParams = new URL(req.url).searchParams; | ||
|
||
const nickname = searchParams.get("nickname"); | ||
const roomCode = searchParams.get("code"); | ||
|
||
if (!roomCode || !nickname) { | ||
redirect("/"); | ||
} | ||
|
||
await joinRoom({ | ||
userId: session.user.id, | ||
nickname, | ||
code: roomCode, | ||
sessionToken: sessionToken.value, | ||
}); | ||
|
||
redirect(`/room/${roomCode}`); | ||
} |
Oops, something went wrong.
dabafc9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
artificial-unintelligence – ./
artificial-unintelligence-git-main-agrattan.vercel.app
un-ai.vercel.app
artificial-unintelligence-agrattan.vercel.app