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

feat: move to app router and supabase db #80

Draft
wants to merge 27 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
935dc35
chore: remove firebase and functions
DarkPhoenix2704 Mar 2, 2024
755bd5a
chore: remove all
DarkPhoenix2704 Mar 2, 2024
4db055a
rewrite to supabase
DarkPhoenix2704 Mar 2, 2024
3b3269c
some basic stuff
DarkPhoenix2704 Mar 2, 2024
13421a6
feat: complete auth
DarkPhoenix2704 Mar 2, 2024
1a43c16
feat: navbar
DarkPhoenix2704 Mar 2, 2024
6ee267b
ui rewrite
DarkPhoenix2704 Mar 2, 2024
94907e5
fix: some more migration
DarkPhoenix2704 Mar 2, 2024
dc59211
add toasts
DarkPhoenix2704 Mar 3, 2024
96afbc1
fix: changes
DarkPhoenix2704 Mar 3, 2024
7d34783
feat: add modal
DarkPhoenix2704 Mar 22, 2024
37e79e8
fix: create Team modal issues
DarkPhoenix2704 Apr 8, 2024
c7cea62
fix: modal open animation
DarkPhoenix2704 Apr 9, 2024
36aa5f7
somr more ui fixes
DarkPhoenix2704 Apr 9, 2024
19cf521
feat: profile update
DarkPhoenix2704 Apr 10, 2024
6aef9bf
some more changes
DarkPhoenix2704 Apr 10, 2024
1ed315f
idk some more changes
DarkPhoenix2704 Apr 10, 2024
0916ead
chore: prettify
DarkPhoenix2704 Apr 20, 2024
40226d4
lint
DarkPhoenix2704 Apr 20, 2024
47d95eb
add ci lint
DarkPhoenix2704 Apr 20, 2024
862cf1f
fix: unified request validation
DarkPhoenix2704 Apr 20, 2024
5dfef90
feat: support for showing results
DarkPhoenix2704 Apr 20, 2024
367fc20
fix: update some behaviour
DarkPhoenix2704 Apr 20, 2024
51b9029
some fixes
DarkPhoenix2704 Apr 20, 2024
bbed79e
feat: add support for create team
DarkPhoenix2704 Apr 20, 2024
fb5fc66
fix: wip
DarkPhoenix2704 Apr 21, 2024
d855b54
format files
DarkPhoenix2704 Apr 28, 2024
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
5 changes: 0 additions & 5 deletions .firebaserc

This file was deleted.

27 changes: 0 additions & 27 deletions .github/pull_request_template.md

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Code quality

on:
push:
pull_request:

jobs:
quality:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Biome
uses: biomejs/setup-biome@v2
with:
version: latest
- name: Run Biome
run: biome ci .
46 changes: 36 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
node_modules
.turbo
*.log
build
.firebase
.vscode
.idea
out
.next
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz
.env
tmp

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"biome_lsp.trace.server": "verbose",
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnPaste": true,
"editor.formatOnSave": true
}
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

127 changes: 22 additions & 105 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,119 +1,36 @@
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]

<!-- PROJECT LOGO -->
<br />
<div align="center">
<a href="https://tinkerhub.org/">
<img src="https://avatars.githubusercontent.com/u/45253922?s=400&u=bb1a9f5aa6706a6af63b653652a13d0f8a0f36fc&v=4" alt="Logo" width="80" height="80">
</a>

<h3 align="center">Saturday Hacknight</h3>

<p align="center">
Where Hacking Happens
<br />
</p>
</div>

<!-- TABLE OF CONTENTS -->
<details>
<summary>Table of Contents</summary>
<ol>
<li>
<a href="#about-the-project">About The Project</a>
<ul>
<li><a href="#built-with">Built With</a></li>
</ul>
</li>
<li>
<a href="#getting-started">Getting Started</a>
<ul>
<li><a href="#prerequisites">Prerequisites</a></li>
<li><a href="#installation">Installation</a></li>
</ul>
</li>
</ol>
</details>

<!-- ABOUT THE PROJECT -->

## About The Project

Saturday Hacknight is a community built Platform for Tinkers to conduct Hacking activities.

<p align="right">(<a href="#top">back to top</a>)</p>

### Built With

- [NextJs](https://nextjs.org/)
- [NestJs](https://nestjs.com/)
- [Typescript](https://typescript.org/)

<p align="right">(<a href="#top">back to top</a>)</p>

<!-- GETTING STARTED -->
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

### Prerequisites

You need to install

1. [Node v16](https://nodejs.org/en/)
2. [Yarn](https://yarnpkg.com/)

### Installation

1. Clone the repo

```sh
git clone https://github.com/tinkerhub/saturday-hack-night.git
```

2. Install all the NPM packages all the applications.

> We are using Yarn workspace and turborepo to manage the applications in monorepo.
First, run the development server:

```sh
yarn install
```
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

3. Copy the `.env.example` for each applications to `.env` in the same directory and fill the values required
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

4. Start the web application dev server and open `http://localhost:3000`
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

```sh
yarn workspace web dev
```
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

<p align="right">(<a href="#top">back to top</a>)</p>
## Learn More

## Contributing
To learn more about Next.js, take a look at the following resources:

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
## Deploy on Vercel

<p align="right">(<a href="#top">back to top</a>)</p>
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

[contributors-shield]: https://img.shields.io/github/contributors/tinkerhub/saturday-hack-night.svg?style=for-the-badge
[contributors-url]: https://github.com/tinkerhub/saturday-hack-night/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/tinkerhub/saturday-hack-night.svg?style=for-the-badge
[forks-url]: https://github.com/tinkerhub/saturday-hack-night/network/members
[stars-shield]: https://img.shields.io/github/stars/tinkerhub/saturday-hack-night.svg?style=for-the-badge
[stars-url]: https://github.com/tinkerhub/saturday-hack-night/stargazers
[issues-shield]: https://img.shields.io/github/issues/tinkerhub/saturday-hack-night.svg?style=for-the-badge
[issues-url]: https://github.com/tinkerhub/saturday-hack-night/issues
[license-shield]: https://img.shields.io/github/license/tinkerhub/saturday-hack-night.svg?style=for-the-badge
[license-url]: https://github.com/tinkerhub/saturday-hack-night/blob/main/LICENCE
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
35 changes: 35 additions & 0 deletions app/api/colleges/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { db } from "@/utils/db";
import { validateRequest } from "@/utils/lucia";
import type { NextRequest } from "next/server";

export async function GET(request: NextRequest): Promise<Response> {
const { session } = await validateRequest();

if (!session) {
return new Response(null, {
status: 401,
headers: {
Location: "/auth/login",
},
});
}
const params = request.nextUrl.searchParams;

const searchItem = params.get("search");

const colleges = await db.college.findMany({
where: {
name: {
contains: searchItem ?? "",
mode: "insensitive",
},
},
select: {
id: true,
name: true,
},
take: 10,
});

return new Response(JSON.stringify(colleges), {});
}
31 changes: 31 additions & 0 deletions app/api/users/[githubID]/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { db } from "@/utils/db";
import { validateRequest } from "@/utils/lucia";
import type { NextRequest } from "next/server";

export async function GET(
_request: NextRequest,
{ params }: { params: { githubID: string } },
): Promise<Response> {
const { session } = await validateRequest();

if (!session) {
return new Response(null, {
status: 401,
headers: {
Location: "/auth/login",
},
});
}

const user = await db.user.findUnique({
where: {
githubId: params.githubID ?? "",
},
select: {
githubId: true,
},
});
return new Response(JSON.stringify(user), {
status: user ? 200 : 404,
});
}
Loading