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

Letsdopull #412

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
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
25 changes: 25 additions & 0 deletions .github/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build on PR

on:
pull_request:
branches:
- master

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: cd packages/db && npx prisma generate && cd ../..

- name: Run Build
run: npm run build
21 changes: 2 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
- Clone the repo
## readme.md

```jsx
git clone https://github.com/100xdevs-cohort-2/week-17-final-code
```

- npm install
- Run postgres either locally or on the cloud (neon.tech)

```jsx
docker run -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 postgres
```

- Copy over all .env.example files to .env
- Update .env files everywhere with the right db url
- Go to `packages/db`
- npx prisma migrate dev
- npx prisma db seed
- Go to `apps/user-app` , run `npm run dev`
- Try logging in using phone - 1111111111 , password - alice (See `seed.ts`)
# Hello world
2 changes: 1 addition & 1 deletion apps/user-app/components/BalanceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const BalanceCard = ({amount, locked}: {
return <Card title={"Balance"}>
<div className="flex justify-between border-b border-slate-300 pb-2">
<div>
Unlocked balance
Unlocked balance lets write code
</div>
<div>
{amount / 100} INR
Expand Down
13 changes: 6 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
"lint": "turbo lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"db:generate": "cd packages/db && npx prisma generate && cd ../..",
"start-user-app": "cd ./apps/user-app && npm run start"

"start-user-app": "cd ./apps/user-app && npm run start",
"start-merchant-app": "cd ./apps/merchant-app && npm run start",
"start-bank-webhook": "cd ./apps/bank-webhook && npm run start"
},
"devDependencies": {
"@repo/eslint-config": "*",
Expand Down
16 changes: 9 additions & 7 deletions packages/db/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { PrismaClient } from '@prisma/client'
import { PrismaClient } from "@prisma/client";

// lets make some comments so that we can see the diff
const prismaClientSingleton = () => {
return new PrismaClient()
}
return new PrismaClient();
};

declare global {
var prismaGlobal: undefined | ReturnType<typeof prismaClientSingleton>
var prismaGlobal: undefined | ReturnType<typeof prismaClientSingleton>;
}

const prisma: ReturnType<typeof prismaClientSingleton> = globalThis.prismaGlobal ?? prismaClientSingleton()
const prisma: ReturnType<typeof prismaClientSingleton> =
globalThis.prismaGlobal ?? prismaClientSingleton();

export default prisma
export default prisma;

if (process.env.NODE_ENV !== 'production') globalThis.prismaGlobal = prisma
if (process.env.NODE_ENV !== "production") globalThis.prismaGlobal = prisma;
2 changes: 1 addition & 1 deletion packages/ui/src/Appbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const Appbar = ({
}: AppbarProps) => {
return <div className="flex justify-between border-b px-4 border-slate-300">
<div className="text-lg flex flex-col justify-center">
PayTM
PayTM Kro
</div>
<div className="flex flex-col justify-center pt-2">
<Button onClick={user ? onSignout : onSignin}>{user ? "Logout" : "Login"}</Button>
Expand Down