Skip to content
This repository was archived by the owner on Feb 10, 2026. It is now read-only.
Merged
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
53 changes: 4 additions & 49 deletions .github/actions/run-cypress-tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,58 +13,13 @@ runs:
with:
node-version: 22

- name: Install frontend dependencies
shell: bash
run: cd frontend && npm install

- name: Build the frontend
shell: bash
run: cd frontend && npm run build

- name: Setup PDM
uses: pdm-project/setup-pdm@v4

- name: Install backend dependencies
- name: Build the app
run: make build up
shell: bash
run: pdm install

- name: Setup local database
shell: bash
run: mkdir -p data && touch data/database.db

- name: Load database
shell: bash
run: pdm run alembic upgrade head

- name: Start backend
shell: bash
run: pdm run python -m uvicorn src.saas_backend.app:app --host 0.0.0.0 --port 8000 &

- name: Start frontend
shell: bash
run: cd frontend && npm run start &

- name: Wait for backend to be ready
shell: bash
run: |
for i in {1..10}; do
curl -s http://127.0.0.1:8000/health && echo "Backend is ready" && exit 0
echo "Waiting for backend to be ready... attempt $i"
sleep 1
done
echo "Backend failed to be ready after 10 retries"
exit 1

- name: Wait for frontend to be ready
- name: Install frontend dependencies
shell: bash
run: |
for i in {1..10}; do
curl -s http://127.0.0.1:3000 && echo "Frontend is ready" && exit 0
echo "Waiting for frontend to be ready... attempt $i"
sleep 1
done
echo "Frontend failed to be ready after 10 retries"
exit 1
run: cd frontend && npm install

- name: Run Cypress tests
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
command: bash /start.sh
env_file: .env
environment:
- APP_MODE=DEV
- APP_LEVEL=DEV
volumes:
- ./frontend/public:/app/public
- ./frontend/src:/app/src
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
services:
anirra:
container_name: anirra
image: jpyles0524/anirra:latest
build:
context: .
dockerfile: Dockerfile
Expand Down
12 changes: 9 additions & 3 deletions frontend/cypress/e2e/basic.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,31 @@ describe("Site Actions", () => {
});

it("should let the user have a watchlist", () => {
cy.reload();
cy.visit("/watchlist");

cy.get("button")
.contains(/watched/i)
.click();

cy.get("a").should("contain", "Naruto");
});

it("should recommend anime to the user", () => {
cy.visit("/");
cy.reload();

cy.get("[data-testid='recommendations']", { timeout: 10000 })
cy.get("[data-testid='recommendations']", { timeout: 30000 })
.should("exist")
.find("[data-testid='mini-card']");
});

it.only("should let the user add an anime to their watchlist", () => {
it("should let the user add an anime to their watchlist", () => {
cy.visit("/");

cy.reload();

cy.get("[data-testid='recommendations']", { timeout: 10000 })
cy.get("[data-testid='recommendations']", { timeout: 30000 })
.should("exist")
.find("[data-testid='mini-card']");

Expand Down
20 changes: 18 additions & 2 deletions frontend/src/components/pages/anime/get-server-side-props.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
import { GetServerSidePropsContext } from "next";
import { getJwt } from "@/lib/utils";
import { GetServerSidePropsContext, NextApiRequest } from "next";

export default async function GetServerSideProps(
context: GetServerSidePropsContext
) {
const jwt = await getJwt(context.req as NextApiRequest);

if (!jwt) {
return {
props: {
anime: {},
description: "",
watchlistStatus: "",
},
};
}

const anime = await fetch(
`${process.env.API_URL || "http://127.0.0.1:8000"}/anime/${
context.params?.id
Expand All @@ -12,7 +25,10 @@ export default async function GetServerSideProps(
const recommendations = await fetch(
`${
process.env.API_URL || "http://127.0.0.1:8000"
}/anime/recommendations?ids=${context.params?.id}&limit=20`
}/anime/recommendations?ids=${context.params?.id}&limit=20`,
{
headers: { Authorization: `Bearer ${jwt.access_token}` },
}
);

const recommendationsData = await recommendations.json();
Expand Down
24 changes: 1 addition & 23 deletions frontend/src/components/pages/landing/get-server-side-props.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { getJwt } from "@/lib/utils";
import { Anime } from "@/types/anime.types";

import { GetServerSidePropsContext, NextApiRequest } from "next";

Expand Down Expand Up @@ -28,31 +27,10 @@ export default async function GetServerSideProps(

const statsData = await stats.json();

const animeWatched = await fetch(
`${process.env.API_URL || "http://127.0.0.1:8000"}/anime/watchlists`,
{
headers: {
Authorization: `Bearer ${jwt.access_token}`,
},
}
);

const animeWatchedData = await animeWatched.json();
if (animeWatched.status === 401) {
return {
props: {
stats: statsData,
recommendedAnime: [],
},
};
}

const animeRecommendations = await fetch(
`${
process.env.API_URL || "http://127.0.0.1:8000"
}/anime/recommendations?${animeWatchedData.anime
.map((anime: Anime) => `ids=${anime.id}`)
.join("&")}&limit=20`,
}/anime/recommendations?limit=20&from_watchlist=true`,
{
headers: {
Authorization: `Bearer ${jwt.access_token}`,
Expand Down
14 changes: 12 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ include = ["src/**/*.py"]
exclude = [".venv"]

# Type checking strictness
typeCheckingMode = "strict" # Enables strict type checking mode
typeCheckingMode = "strict" # Enables strict type checking mode
reportPrivateUsage = "error"
reportMissingTypeStubs = "error"
reportUntypedFunctionDecorator = "error"
Expand Down Expand Up @@ -70,14 +70,24 @@ reportInvalidStubStatement = "error"
reportInconsistentOverload = "error"

# Misc settings
pythonVersion = "3.12" # Matches your Python version from pyproject.toml
pythonVersion = "3.12" # Matches your Python version from pyproject.toml
strictListInference = true
strictDictionaryInference = true
strictSetInference = true
reportUnknownArgumentType = false

[tool.pytest.ini_options]
asyncio_default_fixture_loop_scope = "function"
testpaths = ["src/saas_backend/tests"]

[tool.pytest]
addopts = "-s"

[tool.isort]
length_sort = true
profile = "black"
sections = ["STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
import_heading_stdlib = "STL"
import_heading_thirdparty = "PDM"
import_heading_firstparty = "LOCAL"
import_heading_localfolder = "LOCAL"
Loading