diff --git a/.github/workflows/lint_backend.yml b/.github/workflows/lint_backend.yml new file mode 100644 index 0000000..0d88401 --- /dev/null +++ b/.github/workflows/lint_backend.yml @@ -0,0 +1,31 @@ +name: Lint Backend + +on: + push: + branches: + - "main" + pull_request: + branches: + - "main" + +jobs: + lint-backend: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v5 + with: + version: "latest" + enable-cache: true + - name: Run Ruff Format With Diff + run: uv run ruff format src --check --diff + working-directory: backend + - name: Run Ruff Lint + run: uv run ruff check src + working-directory: backend diff --git a/.github/workflows/lint_frontend.yml b/.github/workflows/lint_frontend.yml new file mode 100644 index 0000000..a7a086f --- /dev/null +++ b/.github/workflows/lint_frontend.yml @@ -0,0 +1,28 @@ +name: Lint Frontend + +on: + push: + branches: + - "main" + pull_request: + branches: + - "main" + +jobs: + lint-frontend: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "20" + - name: Install pnpm + run: npm install -g pnpm + - name: Install dependencies + run: pnpm install + working-directory: frontend + - name: Run lint + run: pnpm run lint + working-directory: frontend diff --git a/.github/workflows/test_backend.yml b/.github/workflows/test_backend.yml new file mode 100644 index 0000000..8755dec --- /dev/null +++ b/.github/workflows/test_backend.yml @@ -0,0 +1,28 @@ +name: Test Backend + +on: + push: + branches: + - "*" + pull_request: + branches: + - main + +jobs: + test-backend: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v5 + with: + version: "latest" + enable-cache: true + - name: Run tests + run: uv run pytest + working-directory: backend diff --git a/backend/.env.example b/backend/.env.example deleted file mode 100644 index acbfb43..0000000 --- a/backend/.env.example +++ /dev/null @@ -1,25 +0,0 @@ -# Environment: local, staging, production -ENVIRONMENT=local - -PROJECT_NAME="FlashNotes" - -# Backend -BACKEND_CORS_ORIGINS="http://127.0.0.1:5173,http://localhost,http://localhost:5173,https://localhost,https://localhost:5173" -SECRET_KEY=fake-key -FIRST_SUPERUSER=admin@example.com -FIRST_SUPERUSER_PASSWORD=changethis -USERS_OPEN_REGISTRATION=True - - -# Postgres -POSTGRES_SERVER=localhost -POSTGRES_PORT=5432 -POSTGRES_DB=app -POSTGRES_USER=postgres -POSTGRES_PASSWORD=changethis - -# AI -AI_MODEL= -AI_API_KEY= - -COLLECTION_GENERATION_PROMPT="I want to generate flashcards on a specific topic for efficient studying. Please create a set of flashcards covering key concepts, definitions, important details, and examples, with a focus on progressively building understanding of the topic. The flashcards should aim to provide a helpful learning experience by using structured explanations, real-world examples and formatting. Each flashcard should follow this format: Front (Question/Prompt): A clear and concise question or term to test recall, starting with introductory concepts and moving toward more complex details. Back (Answer): If the front is a concept or topic, provide a detailed explanation, broken down into clear paragraphs with easy-to-understand language. If possible, include a real-world example, analogy or illustrative diagrams to make the concept more memorable and relatable. If the front is a vocabulary word (for language learning), provide a direct translation in the target language. Optional Hint: A short clue to aid recall, especially for more complex concepts. Important: Use valid Markdown format for the back of the flashcard." diff --git a/backend/src/main.py b/backend/src/main.py index 91ba021..8d4f6a7 100644 --- a/backend/src/main.py +++ b/backend/src/main.py @@ -22,7 +22,8 @@ def custom_generate_unique_id(route: APIRoute) -> str: app.add_middleware( CORSMiddleware, allow_origins=[ - str(origin).strip("/") for origin in settings.BACKEND_CORS_ORIGINS + # str(origin).strip("/") for origin in settings.BACKEND_CORS_ORIGINS + "*" ], allow_credentials=True, allow_methods=["*"], @@ -31,3 +32,4 @@ def custom_generate_unique_id(route: APIRoute) -> str: app.include_router(api_router, prefix=settings.API_V1_STR) add_pagination(app) + diff --git a/frontend/.env.example b/frontend/.env.example deleted file mode 100644 index f11436c..0000000 --- a/frontend/.env.example +++ /dev/null @@ -1,3 +0,0 @@ -VITE_API_URL=http://localhost:8000 -VITE_POSTHOG_API_KEY= -VITE_POSTHOG_HOST= diff --git a/frontend/biome.json b/frontend/biome.json index d0021e8..8ca830e 100644 --- a/frontend/biome.json +++ b/frontend/biome.json @@ -4,11 +4,11 @@ "enabled": true }, "files": { - "ignore": ["node_modules", "src/routeTree.gen.ts", "src/components/ui"] + "ignore": ["node_modules", "src/routeTree.gen.ts", "src/components/ui", "src/client/*"] }, "linter": { "enabled": true, - "ignore": ["src/components/ui"], + "ignore": ["src/components/ui", "src/client/*"], "rules": { "recommended": true, "suspicious": { @@ -25,7 +25,7 @@ "indentStyle": "space", "indentWidth": 2, "lineWidth": 100, - "ignore": ["src/components/ui", "src/assets/*"] + "ignore": ["src/components/ui", "src/client/*", "src/assets/*"] }, "javascript": { "formatter": {