Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…course-assessment-g11 into settings-page
  • Loading branch information
ckcherry23 committed Oct 12, 2023
2 parents 4099d13 + d0b916b commit e6b5a26
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ env:
FIREBASE_AUTH_EMULATOR_HOST: "127:0:0:1:9099"
FIREBASE_TOKEN: ${{ secrets.FIREBASE_CI_TOKEN }}
FIREBASE_SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
DATABASE_URL: ${{ secrets.TEST_DATABASE_URL }}
DATABASE_PASSWORD: ${{ secrets.TEST_DATABASE_PASSWORD }}
PRISMA_DATABASE_URL: ${{ secrets.SYSTEMTEST_DATABASE_URL }}
PRISMA_DATABASE_PASSWORD: ${{ secrets.SYSTEMTEST_DATABASE_PASSWORD }}

jobs:
mainbuild:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ docker image prune -f
Next steps:
1. Set the DATABASE_URL in the .env file to point to your existing database. If
1. Set the PRISMA_DATABASE_URL in the .env file to point to your existing database. If
your database has no tables yet, read https://pris.ly/d/getting-started
2. Set the provider of the datasource block in schema.prisma to match your
database: postgresql, mysql, sqlite, sqlserver, mongodb or cockroachdb.
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- "5001:5001"
environment:
PORT: 5001
DATABASE_URL: ${DATABASE_URL}
PRISMA_DATABASE_URL: ${DATABASE_URL}

matching-service:
build:
Expand All @@ -21,7 +21,7 @@ services:
- "5002:5002"
environment:
PORT: 5002
DATABASE_URL: ${DATABASE_URL}
PRISMA_DATABASE_URL: ${DATABASE_URL}

collaboration-service:
build:
Expand All @@ -32,7 +32,7 @@ services:
- "5003:5003"
environment:
PORT: 5003
DATABASE_URL: ${DATABASE_URL}
PRISMA_DATABASE_URL: ${DATABASE_URL}

question-service:
build:
Expand Down
38 changes: 38 additions & 0 deletions frontend/src/components/common/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,46 @@ export default function Navbar() {
}
}, [currentPage]);

const { user: currentUser, authIsReady } = useContext(AuthContext);
const [activeTab, setActiveTab] = useState<TabsOptions>(TabsOptions.NULL);

const { login } = useLogin();
const { logout } = useLogout();
const router = useRouter();

const currentPage = router.pathname;

useEffect(() => {
if (currentPage === "/interviews") {
setActiveTab(TabsOptions.INTERVIEWS);
} else if (currentPage === "/questions") {
setActiveTab(TabsOptions.QUESTIONS);
} else {
setActiveTab(TabsOptions.NULL);
}
}, [currentPage]);

return (
<header>
<div className="flex h-20 bg-card justify-between items-center px-12">
<div className="flex gap-20 justify-center items-center">
<Link href="/"><Image src="/CodeParty.svg" alt="CodeParty logo" width={125} height={25} /></Link>
{currentUser && <div className="h-12 flex justify-center items-center">
<Tabs value={activeTab}>
<TabsList>
<Link href="/interviews">
<TabsTrigger value="interviews" className="h-20 w-36 hover:bg-accent duration-100">
Interviews
</TabsTrigger>
</Link>
<Link href="/questions">
<TabsTrigger value="questions" className="h-20 w-36 hover:bg-accent duration-100">
Questions
</TabsTrigger>
</Link>
</TabsList>
</Tabs>
</div>}
<div className="flex h-20 bg-card justify-between items-center px-12">
<div className="flex gap-20 justify-center items-center">
<Link href="/"><Image src="/CodeParty.svg" alt="CodeParty logo" width={125} height={25} /></Link>
Expand Down
2 changes: 1 addition & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ generator client {

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
url = env("PRISMA_DATABASE_URL")
}

// todo rename for colalboration service
Expand Down
6 changes: 3 additions & 3 deletions services/user-service/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# User Service

## Pre-requisites:
You need to set the environment variable `DATABASE_URL` in `prisma/schema.prisma`.
You need to set the environment variable `PRISMA_DATABASE_URL` in `prisma/schema.prisma`.

If you do so with an `.env` file, you need to generate the prisma client/migrate prisma as follows:

Expand Down Expand Up @@ -72,8 +72,8 @@ What this command does:

You need to pass in the following environment variables through the above-mentioned `.env`-type file:
```
DATABASE_URL="postgresql://postgres:${password}@localhost:5430/peerprepdb-user-service-systemtest?schema=public"
DATABASE_PASSWORD="${The password you want to pass in. This must match the password in the above variable}"
PRISMA_DATABASE_URL="postgresql://postgres:${password}@localhost:5430/peerprepdb-user-service-systemtest?schema=public"
PRISMA_DATABASE_PASSWORD="${The password you want to pass in. This must match the password in the above variable}"
```

If you want to run this in a CI workflow, run:
Expand Down
2 changes: 1 addition & 1 deletion services/user-service/src/db/prismaClient.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {PrismaClient} from '@prisma/client';

const prismaClient : PrismaClient = new PrismaClient({
datasourceUrl: process.env.DATABASE_URL
datasourceUrl: process.env.PRISMA_DATABASE_URL
});

export default prismaClient;
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ services:
environment:
POSTGRES_USER: postgres
POSTGRES_DB: peerprepdb-user-service-systemtest
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
POSTGRES_PASSWORD: ${PRISMA_DATABASE_PASSWORD}

0 comments on commit e6b5a26

Please sign in to comment.