Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0376bec
added starter task template
owenowenisme Oct 28, 2024
166bb70
init husky pre-commit
owenowenisme Oct 28, 2024
3d409aa
feat add file upload dropzone
AndresLie Oct 29, 2024
680588b
update pnpm-lock.yaml and package.json, set size for image in FileIpload
AndresLie Nov 1, 2024
eacce73
File card initial commit
d-ben-b Nov 3, 2024
1aaa490
add navbar
Max042004 Nov 3, 2024
c5493fd
remove wrong file
d-ben-b Nov 3, 2024
b0d7db1
Revert "add navbar"
Max042004 Nov 3, 2024
7d73a46
feat add navbar
Max042004 Nov 3, 2024
f859606
Update ExamCard.tsx
d-ben-b Nov 3, 2024
0ac22e0
refine the exam card file
d-ben-b Nov 5, 2024
a3d1836
Merge pull request #12 from gdsc-ncku/upload_dropzone
AndresLie Nov 12, 2024
341df0c
refactor: simplify import paths
d-ben-b Nov 17, 2024
ef52a28
Refactor: move repetitive code to separate file
Max042004 Nov 17, 2024
ed374c8
Refactor: refactor with coderabbitai review
Max042004 Nov 17, 2024
b0ab8a9
Merge pull request #13 from gdsc-ncku/file-card
d-ben-b Nov 19, 2024
15f3961
Refactor: refactor and remove some unnecessary tailwind css code
Max042004 Nov 20, 2024
63827cc
Refactor: fix using the wrong variable
Max042004 Nov 20, 2024
988f847
Refactor: make css more prettier
Max042004 Nov 20, 2024
a5fb01e
Refactor: remove style.css for following tailwind design pattern: onl…
Max042004 Nov 21, 2024
053ce20
Refactor: change route names to lowercase and use prettier for unifyi…
Max042004 Nov 21, 2024
bdef1b6
Merge pull request #14 from gdsc-ncku/navbar
Max042004 Nov 21, 2024
69e25e3
add demo profile
d-ben-b Dec 6, 2024
3bc537a
Refactor: simplify avatar file validation and update profile edit link
d-ben-b Dec 9, 2024
4477baa
Refactor: enhance profile edit form validation and improve sidebar li…
d-ben-b Dec 9, 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
35 changes: 35 additions & 0 deletions .github/workflows/backend-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Trigger backend cd workflow (for dev)

on:
workflow_dispatch:
workflow_call:
inputs:
runner-tag:
type: string
description: The tag of the runner to use
docker-image-tag:
type: string
description: The tag of the docker image to use

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/pastexam/backend

# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
trigger-backend-cd:
runs-on: |
self-hosted-runner
${{ inputs.runner-tag }}
steps:
- name: Checkout latest code
uses: actions/checkout@v4
- name: Pull the docker image
run: |
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.docker-image-tag }}
- name: stop the original container
run: |
docker stop pastexam-backend
- name: run the new container
run: |
docker run -d --name pastexam-backend --restart always ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.docker-image-tag }}
15 changes: 15 additions & 0 deletions .github/workflows/dev-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Dev backend workflow

on:
workflow_dispatch:


jobs:
trigger-backend-ci:
uses: ./.github/workflows/backend-ci.yml

trigger-backend-cd:
uses: ./.github/workflows/backend-cd.yml
with:
runner-tag: dev
docker-image-tag: ${{ github.head_ref || github.ref_name }}
7 changes: 7 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
declare IS_FRONTEND_FOLDER_CHANGE=$(git show --name-only -r --stat --oneline HEAD~..HEAD | grep 'frontend/')


echo "trigger pre-commit"
cd frontend/ && pnpm lint-staged
94 changes: 94 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# FastAPI Backend Project

## Table of Contents

- [FastAPI Backend Project](#fastapi-backend-project)
- [Table of Contents](#table-of-contents)
- [Prerequisites](#prerequisites)
- [**Setup**](#setup)
- [Running the Application](#running-the-application)
- [API Endpoints](#api-endpoints)
- [Development](#development)
- [Linting and Formatting](#linting-and-formatting)
- [Pre-commit Hooks](#pre-commit-hooks)

## Prerequisites
- Python=3.11.10
- Poetry [Installation Guide](https://python-poetry.org/docs/#installing-with-the-official-installer)
- Docker and Docker Compose

## **Setup**

1. Clone the repository:

2. Install dependencies using Poetry:
```
poetry install
```

3. Copy `template.env` to `.env` and fill in the required environment variables:

4. Edit the `.env` file with your specific configuration:
```
MINIO_ACCESS_KEY=your_minio_access_key
MINIO_SECRET_KEY=your_minio_secret_key
POSTGRES_USER=your_postgres_user
POSTGRES_PASSWORD=your_postgres_password
POSTGRES_DB=your_database_name
POSTGRES_IP=localhost
POSTGRES_PORT=5432
```
also add `.env.dev`
```
MINIO_ACCESS_KEY=your_minio_access_key
MINIO_SECRET_KEY=your_minio_secret_key
POSTGRES_USER=your_postgres_user
POSTGRES_PASSWORD=your_postgres_password
POSTGRES_DB=your_database_name
POSTGRES_IP=localhost
POSTGRES_PORT=5432
MODE= dev
```

## Running the Application

1. Start the PostgreSQL database using Docker Compose: (Assume that docker compose is installed)

```docker compose up postgres -d ```

2. Run the FastAPI application:
```
poetry run python3 main.py --mode dev
```

The application will be available at `http://localhost:8000`.

3. Access the API documentation at `http://localhost:8000/docs`.

## API Endpoints

For detailed API documentation, refer to the Swagger UI at `/docs` when the application is running.

## Development

### Linting and Formatting

This project uses Ruff for linting and formatting. To run the linter:

```
ruff check
```

To format the code:

```
ruff format
```

### Pre-commit Hooks

The project is configured with pre-commit hooks to ensure code quality. Install the hooks:

```
poetry run pre-commit install
```
3 changes: 0 additions & 3 deletions frontend/.eslintrc.json

This file was deleted.

6 changes: 0 additions & 6 deletions frontend/app/api/categories/category.d.ts

This file was deleted.

52 changes: 0 additions & 52 deletions frontend/app/api/categories/getCategories.ts

This file was deleted.

Binary file removed frontend/app/api/og/Inter-SemiBold.ttf
Binary file not shown.
Loading