From 5e3cb6d7b946aba7990b51b11dc955783401f353 Mon Sep 17 00:00:00 2001 From: Monster0506 Date: Mon, 8 Dec 2025 22:56:19 -0500 Subject: [PATCH 1/6] Stop exposing ports to allow dokploy to handle this --- Dockerfile | 1 - compose.yaml | 4 ---- 2 files changed, 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index b79b047..1e05ba7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,5 +26,4 @@ run mkdir -p static/uploads/leadership run mkdir -p static/uploads/meetings copy package.json . -expose 3000 cmd [ "bun", "prod:start" ] diff --git a/compose.yaml b/compose.yaml index 49ebbe9..9023548 100644 --- a/compose.yaml +++ b/compose.yaml @@ -2,8 +2,6 @@ services: db: image: postgres:18-alpine restart: on-failure:5 - ports: - - 5434:5432 environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres @@ -56,8 +54,6 @@ services: restart: on-failure:5 env_file: - .env - ports: - - 3002:3000 environment: DATABASE_URL: postgresql://postgres:postgres@db:5432/hacksu REDIS_URL: redis://redis:6379 From a44f907161ca3f8d805c050e6de014d74c69c776 Mon Sep 17 00:00:00 2001 From: Monster0506 Date: Mon, 8 Dec 2025 23:13:26 -0500 Subject: [PATCH 2/6] Empty From 4e3fc51134e9d22bf7c28a0f9bbeedc459d3601c Mon Sep 17 00:00:00 2001 From: TJ Raklovits <91501317+Monster0506@users.noreply.github.com> Date: Tue, 9 Dec 2025 00:47:31 -0500 Subject: [PATCH 3/6] Pull up dev (#6) * Lessons page! (#4) * Update icon loading * Lessons page running with redis cache! * Admin side of lesson icons * Improved lessons appearence * Render lessons in markdown * Empty * Fixes/port testing (#5) * Empty * Fix redis port to be internal --- compose.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/compose.yaml b/compose.yaml index 9023548..3dd56a3 100644 --- a/compose.yaml +++ b/compose.yaml @@ -19,8 +19,6 @@ services: redis: image: redis:7-alpine restart: on-failure:5 - ports: - - 6379:6379 volumes: - redisdata:/data command: redis-server --appendonly yes From 341fb01465945f02ea3ce0a4e2e6ec6c3d15fe92 Mon Sep 17 00:00:00 2001 From: TJ Raklovits <91501317+Monster0506@users.noreply.github.com> Date: Tue, 9 Dec 2025 00:40:07 -0500 Subject: [PATCH 4/6] Lessons page! (#4) * Update icon loading * Lessons page running with redis cache! * Admin side of lesson icons * Improved lessons appearence * Render lessons in markdown * Empty --- compose.yaml | 2 ++ src/lib/components/lessons/SearchBar.svelte | 1 + src/routes/admin/lesson-icons/+page.svelte | 1 + 3 files changed, 4 insertions(+) diff --git a/compose.yaml b/compose.yaml index 3dd56a3..18a4453 100644 --- a/compose.yaml +++ b/compose.yaml @@ -29,6 +29,8 @@ services: retries: 5 networks: - app-network + ports: + - 6379:6379 lessons-service: build: diff --git a/src/lib/components/lessons/SearchBar.svelte b/src/lib/components/lessons/SearchBar.svelte index ac02352..c1a9b57 100644 --- a/src/lib/components/lessons/SearchBar.svelte +++ b/src/lib/components/lessons/SearchBar.svelte @@ -37,3 +37,4 @@ $effect(() => { + \ No newline at end of file diff --git a/src/routes/admin/lesson-icons/+page.svelte b/src/routes/admin/lesson-icons/+page.svelte index 3581f99..69edf7a 100644 --- a/src/routes/admin/lesson-icons/+page.svelte +++ b/src/routes/admin/lesson-icons/+page.svelte @@ -233,3 +233,4 @@ + \ No newline at end of file From 5eb5567f4a08d705c6b33638996fce3eadaf952f Mon Sep 17 00:00:00 2001 From: TJ Raklovits <91501317+Monster0506@users.noreply.github.com> Date: Tue, 9 Dec 2025 00:48:01 -0500 Subject: [PATCH 5/6] Pull up dev (#6) (#7) * Lessons page! (#4) * Update icon loading * Lessons page running with redis cache! * Admin side of lesson icons * Improved lessons appearence * Render lessons in markdown * Empty * Fixes/port testing (#5) * Empty * Fix redis port to be internal From a0537ca05b8df92eb45b541264197f501dc0d2f9 Mon Sep 17 00:00:00 2001 From: Monster0506 Date: Sat, 28 Feb 2026 20:51:34 -0500 Subject: [PATCH 6/6] Add course schedule admin panel --- .dockerignore | 1 + .env.example | 2 + compose.yaml | 11 + ...26-02-28-course-schedule-implementation.md | 583 ++++++++++++++++++ drizzle/0015_dizzy_spiral.sql | 11 + drizzle/meta/0015_snapshot.json | 544 ++++++++++++++++ drizzle/meta/_journal.json | 7 + schedule-service/.dockerignore | 3 + schedule-service/.python-version | 1 + schedule-service/Dockerfile | 11 + schedule-service/main.py | 106 ++++ schedule-service/pyproject.toml | 12 + schedule-service/uv.lock | 294 +++++++++ src/lib/server/db/schema.ts | 13 + src/routes/admin/+page.svelte | 5 + src/routes/admin/schedule/+page.server.ts | 71 +++ src/routes/admin/schedule/+page.svelte | 134 ++++ 17 files changed, 1809 insertions(+) create mode 100644 docs/plans/2026-02-28-course-schedule-implementation.md create mode 100644 drizzle/0015_dizzy_spiral.sql create mode 100644 drizzle/meta/0015_snapshot.json create mode 100644 schedule-service/.dockerignore create mode 100644 schedule-service/.python-version create mode 100644 schedule-service/Dockerfile create mode 100644 schedule-service/main.py create mode 100644 schedule-service/pyproject.toml create mode 100644 schedule-service/uv.lock create mode 100644 src/routes/admin/schedule/+page.server.ts create mode 100644 src/routes/admin/schedule/+page.svelte diff --git a/.dockerignore b/.dockerignore index 3f5cd30..29934eb 100644 --- a/.dockerignore +++ b/.dockerignore @@ -14,3 +14,4 @@ README.md node_modules build package +scripts/.venv diff --git a/.env.example b/.env.example index 707d5b8..71e448a 100644 --- a/.env.example +++ b/.env.example @@ -14,3 +14,5 @@ GITHUB_TOKEN=github_pat_X_X PUBLIC_APP_URL=http://localhost:3000 BODY_SIZE_LIMIT=20M + +SCHEDULE_SERVICE_URL=http://localhost:8000 diff --git a/compose.yaml b/compose.yaml index 18a4453..09c41be 100644 --- a/compose.yaml +++ b/compose.yaml @@ -49,6 +49,14 @@ services: networks: - app-network + schedule-service: + build: + context: ./schedule-service + dockerfile: Dockerfile + restart: on-failure:5 + networks: + - app-network + app: build: . restart: on-failure:5 @@ -58,6 +66,7 @@ services: DATABASE_URL: postgresql://postgres:postgres@db:5432/hacksu REDIS_URL: redis://redis:6379 NODE_ENV: production + SCHEDULE_SERVICE_URL: http://schedule-service:8000 volumes: - uploads:/app/static/uploads depends_on: @@ -65,6 +74,8 @@ services: condition: service_healthy redis: condition: service_healthy + schedule-service: + condition: service_started networks: - app-network diff --git a/docs/plans/2026-02-28-course-schedule-implementation.md b/docs/plans/2026-02-28-course-schedule-implementation.md new file mode 100644 index 0000000..bd13e94 --- /dev/null +++ b/docs/plans/2026-02-28-course-schedule-implementation.md @@ -0,0 +1,583 @@ +# Course Schedule Admin Panel — Implementation Plan + +> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. + +**Goal:** Integrate a Kent State CS course schedule scraper as a FastAPI microservice and display the results in a new admin panel page. + +**Architecture:** A `schedule-service/` Python microservice (FastAPI + UV) exposes `GET /scrape`, which scrapes the Kent State course schedule and enriches rows with lecturer emails. SvelteKit calls this from a form action (`/admin/schedule`) when the admin clicks "Refresh", then upserts a `course_schedule` Postgres table. The admin page reads from that table. + +**Tech Stack:** Python 3.14, FastAPI, uvicorn, requests, beautifulsoup4, UV; SvelteKit, Drizzle ORM, PostgreSQL, Tailwind CSS + +--- + +### Task 1: Create the `schedule-service` Python microservice + +**Files:** +- Create: `schedule-service/.python-version` +- Create: `schedule-service/pyproject.toml` +- Create: `schedule-service/Dockerfile` +- Create: `schedule-service/.dockerignore` +- Create: `schedule-service/main.py` + +**Step 1: Create `.python-version`** + +``` +3.14 +``` + +**Step 2: Create `pyproject.toml`** + +```toml +[project] +name = "schedule-service" +version = "0.1.0" +description = "Kent State CS course schedule scraper" +readme = "README.md" +requires-python = ">=3.14" +dependencies = [ + "fastapi>=0.115.0", + "uvicorn>=0.32.0", + "requests>=2.32.5", + "beautifulsoup4>=4.12.3", +] +``` + +**Step 3: Create `Dockerfile`** — mirrors `lessons-service/Dockerfile` exactly, only CMD differs: + +```dockerfile +FROM ghcr.io/astral-sh/uv:alpine +WORKDIR /app + +# Copy requirements first for better caching +COPY pyproject.toml uv.lock ./ +RUN uv sync --no-dev + +# Copy application code +COPY . ./ + +CMD ["uv", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] +``` + +**Step 4: Create `.dockerignore`** + +``` +__pycache__ +*.pyc +.venv +``` + +**Step 5: Create `main.py`** + +```python +from fastapi import FastAPI, HTTPException +from pydantic import BaseModel +import requests +from bs4 import BeautifulSoup + +app = FastAPI() + +SCHEDULE_URL = "https://web.cs.kent.edu/schedule/index.php" +SEARCH_URL = "https://www.kent.edu/cs/faculty-staff?field_profile_type_target_id=All&title=" +SKIPPED_EMAILS = {"office@cs.kent.edu", "info@kent.edu"} + +COLUMN_MAP = [ + (0, "code"), + (4, "name"), + (5, "day"), + (6, "time"), + (7, "lecturer"), + (8, "location"), +] + + +class Course(BaseModel): + code: str + name: str + day: str | None = None + time: str | None = None + lecturer: str | None = None + location: str | None = None + email: str | None = None + + +def get_email(lecturer: str) -> str | None: + try: + last, first = lecturer.lower().strip().split(", ", 1) + url = f"{SEARCH_URL}{first}" + soup = BeautifulSoup(requests.get(url, timeout=10).content, "html.parser") + for anchor in soup.select('a[href^="mailto:"]'): + if anchor.string and anchor.string not in SKIPPED_EMAILS: + return anchor.string + except Exception: + pass + return None + + +def parse_row(tds) -> dict: + course: dict = {} + for idx, key in COLUMN_MAP: + value = tds[idx].string.strip() if tds[idx].string else "" + if value: + course[key] = value + elif key == "lecturer": + course[key] = None + return course + + +@app.get("/scrape", response_model=list[Course]) +def scrape(): + try: + soup = BeautifulSoup( + requests.get(SCHEDULE_URL, timeout=15).content, "html.parser" + ) + table = soup.find("table", id="scheduleTbl") + if not table: + raise HTTPException(status_code=502, detail="Schedule table not found") + rows = table.find("tbody").find_all("tr") + except HTTPException: + raise + except Exception as e: + raise HTTPException(status_code=502, detail=f"Failed to fetch schedule: {e}") + + courses = [] + for row in rows: + tds = row.find_all("td") + course = parse_row(tds) + if course.get("lecturer"): + course["email"] = get_email(course["lecturer"]) + courses.append(Course(**course)) + + return courses +``` + +**Step 6: Generate the uv.lock file** + +Run from inside the `schedule-service/` directory: +```bash +cd schedule-service && uv lock +``` + +Expected: `uv.lock` file is created. + +**Step 7: Commit** + +```bash +git add schedule-service/ +git commit -m "feat: add schedule-service FastAPI microservice" +``` + +--- + +### Task 2: Add `schedule-service` to Docker Compose + +**Files:** +- Modify: `compose.yaml` + +**Step 1: Add the service block** + +In `compose.yaml`, after the `lessons-service` block and before the `app` block, add: + +```yaml + schedule-service: + build: + context: ./schedule-service + dockerfile: Dockerfile + restart: on-failure:5 + networks: + - app-network +``` + +**Step 2: Add `schedule-service` as a dependency of `app`** + +The `app` service's `depends_on` block currently has `db` and `redis`. Add `schedule-service`: + +```yaml + depends_on: + db: + condition: service_healthy + redis: + condition: service_healthy + schedule-service: + condition: service_started +``` + +**Step 3: Add `SCHEDULE_SERVICE_URL` to the `app` environment** + +In the `app` service's `environment` block, add: + +```yaml + SCHEDULE_SERVICE_URL: http://schedule-service:8000 +``` + +**Step 4: Commit** + +```bash +git add compose.yaml +git commit -m "feat: add schedule-service to docker compose" +``` + +--- + +### Task 3: Add `SCHEDULE_SERVICE_URL` to the SvelteKit environment + +**Files:** +- Modify: `.env.example` (add the key so future devs know it's needed) + +**Step 1: Add to `.env.example`** + +Open `.env.example` and append: + +``` +SCHEDULE_SERVICE_URL=http://localhost:8000 +``` + +**Step 2: Add to your local `.env` as well** + +``` +SCHEDULE_SERVICE_URL=http://localhost:8000 +``` + +**Step 3: Commit** + +```bash +git add .env.example +git commit -m "feat: add SCHEDULE_SERVICE_URL env var" +``` + +--- + +### Task 4: Add `courseSchedule` table to the Drizzle schema + +**Files:** +- Modify: `src/lib/server/db/schema.ts` + +**Step 1: Add the table definition** + +At the bottom of `src/lib/server/db/schema.ts`, append: + +```typescript +// Course schedule table — populated by the schedule-service scraper +export const courseSchedule = pgTable('course_schedule', { + id: text('id').primaryKey(), + code: text('code').notNull(), + name: text('name').notNull(), + day: text('day'), + time: text('time'), + lecturer: text('lecturer'), + location: text('location'), + email: text('email'), + scrapedAt: timestamp('scraped_at', { withTimezone: true }).notNull() +}); +``` + +**Step 2: Generate and run the migration** + +```bash +npm run db:generate +npm run db:migrate +``` + +Expected: a new migration file is created in `drizzle/` and applied to the DB. + +**Step 3: Commit** + +```bash +git add src/lib/server/db/schema.ts drizzle/ +git commit -m "feat: add course_schedule table to schema" +``` + +--- + +### Task 5: Create the `/admin/schedule` SvelteKit page + +**Files:** +- Create: `src/routes/admin/schedule/+page.server.ts` +- Create: `src/routes/admin/schedule/+page.svelte` + +**Step 1: Create `+page.server.ts`** + +```typescript +import { db } from '$lib/server/db'; +import { courseSchedule } from '$lib/server/db/schema'; +import { requireAdmin } from '$lib/server/admin'; +import { fail, redirect } from '@sveltejs/kit'; +import type { PageServerLoad, Actions } from './$types'; +import { asc } from 'drizzle-orm'; +import { env } from '$env/dynamic/private'; +import { randomUUID } from 'crypto'; + +export const load: PageServerLoad = async (event) => { + await requireAdmin(event); + + const courses = await db.query.courseSchedule.findMany({ + orderBy: [asc(courseSchedule.code)] + }); + + return { courses }; +}; + +export const actions: Actions = { + refresh: async (event) => { + await requireAdmin(event); + + const serviceUrl = env.SCHEDULE_SERVICE_URL ?? 'http://localhost:8000'; + + let scraped: Array<{ + code: string; + name: string; + day?: string; + time?: string; + lecturer?: string; + location?: string; + email?: string; + }>; + + try { + const response = await fetch(`${serviceUrl}/scrape`); + if (!response.ok) { + return fail(502, { error: `Schedule service returned ${response.status}` }); + } + scraped = await response.json(); + } catch { + return fail(502, { error: 'Could not reach the schedule service. Is it running?' }); + } + + const scrapedAt = new Date(); + + await db.delete(courseSchedule); + await db.insert(courseSchedule).values( + scraped.map((c) => ({ + id: randomUUID(), + code: c.code, + name: c.name, + day: c.day ?? null, + time: c.time ?? null, + lecturer: c.lecturer ?? null, + location: c.location ?? null, + email: c.email ?? null, + scrapedAt + })) + ); + + redirect(303, '/admin/schedule'); + } +}; +``` + +**Step 2: Create `+page.svelte`** + +```svelte + + +
+
+
+

Course Schedule

+ {#if lastScraped} +

Last scraped: {lastScraped}

+ {:else} +

No data yet — click Refresh to scrape.

+ {/if} +
+ +
{ + refreshing = true; + return async ({ update }) => { + await update(); + refreshing = false; + }; + }} + > + +
+
+ + {#if form?.error} +
+ {form.error} +
+ {/if} + + {#if courses.length > 0} +
+ +
+ +
+
+ + + + + + + + + + + + + + {#each filtered as course (course.id)} + + + + + + + + + + {/each} + +
CodeNameDayTimeLecturerEmailLocation
{course.code}{course.name}{course.day ?? '—'}{course.time ?? '—'}{course.lecturer ?? '—'} + {#if course.email} + {course.email} + {:else} + + {/if} + {course.location ?? '—'}
+
+
+ {filtered.length} of {courses.length} courses +
+
+ {:else if !form?.error} +
+

No schedule data yet. Click Refresh to scrape the current schedule.

+
+ {/if} +
+``` + +**Step 3: Commit** + +```bash +git add src/routes/admin/schedule/ +git commit -m "feat: add /admin/schedule page" +``` + +--- + +### Task 6: Add "Course Schedule" to the admin dashboard + +**Files:** +- Modify: `src/routes/admin/+page.svelte` + +**Step 1: Add an entry to `adminActions`** + +In `src/routes/admin/+page.svelte`, find the `adminActions` array and add this entry: + +```typescript +{ + title: 'Course Schedule', + href: '/admin/schedule', + description: 'View the current CS course schedule with lecturer emails' +}, +``` + +Place it wherever makes sense in the list (e.g., after Lesson Icons). + +**Step 2: Commit** + +```bash +git add src/routes/admin/+page.svelte +git commit -m "feat: add course schedule link to admin dashboard" +``` + +--- + +### Task 7: Verify end-to-end + +**Step 1: Start the dev environment** + +```bash +npm run db:start # starts Postgres + Redis via Docker Compose +npm run dev # starts SvelteKit dev server +``` + +**Step 2: Start the schedule service locally for dev** + +```bash +cd schedule-service +uv run uvicorn main:app --port 8000 --reload +``` + +**Step 3: Log in and navigate to `/admin/schedule`** + +- Visit `http://localhost:5173/admin/schedule` +- Confirm the page loads with an empty state and a "Refresh" button + +**Step 4: Click "Refresh"** + +- The action should call `http://localhost:8000/scrape` +- Expect a delay (one HTTP call per lecturer) +- After redirect, courses should appear in the table + +**Step 5: Verify search works** + +- Type a lecturer name or course code in the search box +- Confirm the table filters correctly + +**Step 6: Verify error handling** + +- Stop the schedule service (`Ctrl+C` in the uvicorn terminal) +- Click "Refresh" again +- Confirm the red error banner appears: "Could not reach the schedule service…" + +**Step 7: Commit if any fixups were needed, then done** + +```bash +git add -p +git commit -m "fix: " +``` diff --git a/drizzle/0015_dizzy_spiral.sql b/drizzle/0015_dizzy_spiral.sql new file mode 100644 index 0000000..36286c9 --- /dev/null +++ b/drizzle/0015_dizzy_spiral.sql @@ -0,0 +1,11 @@ +CREATE TABLE "course_schedule" ( + "id" text PRIMARY KEY NOT NULL, + "code" text NOT NULL, + "name" text NOT NULL, + "day" text, + "time" text, + "lecturer" text, + "location" text, + "email" text, + "scraped_at" timestamp with time zone NOT NULL +); diff --git a/drizzle/meta/0015_snapshot.json b/drizzle/meta/0015_snapshot.json new file mode 100644 index 0000000..85ff835 --- /dev/null +++ b/drizzle/meta/0015_snapshot.json @@ -0,0 +1,544 @@ +{ + "id": "d678bcb2-1049-404e-aa2c-9a74d696b7aa", + "prevId": "a51df9aa-1b3f-44da-bc7a-43defebd6c27", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.admin_sessions": { + "name": "admin_sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "discord_user_id": { + "name": "discord_user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_admin": { + "name": "is_admin", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.course_schedule": { + "name": "course_schedule", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "day": { + "name": "day", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "time": { + "name": "time", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "lecturer": { + "name": "lecturer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "scraped_at": { + "name": "scraped_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.information": { + "name": "information", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "link": { + "name": "link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "photo": { + "name": "photo", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "sort_index": { + "name": "sort_index", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.leadership": { + "name": "leadership", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "grad_year": { + "name": "grad_year", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "grad_term": { + "name": "grad_term", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "github": { + "name": "github", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "photo": { + "name": "photo", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "titles": { + "name": "titles", + "type": "text[]", + "primaryKey": false, + "notNull": true + }, + "link": { + "name": "link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_current": { + "name": "is_current", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.lesson_icons": { + "name": "lesson_icons", + "schema": "", + "columns": { + "category_name": { + "name": "category_name", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "iconify_id": { + "name": "iconify_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.location": { + "name": "location", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "default": "'current'" + }, + "time": { + "name": "time", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "building_room": { + "name": "building_room", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "building_selector": { + "name": "building_selector", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "building_url": { + "name": "building_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.meetings": { + "name": "meetings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "date": { + "name": "date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "presenter": { + "name": "presenter", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "link": { + "name": "link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description_md": { + "name": "description_md", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "photo": { + "name": "photo", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.notes": { + "name": "notes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "date": { + "name": "date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tags": { + "name": "tags", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.redirects": { + "name": "redirects", + "schema": "", + "columns": { + "slug": { + "name": "slug", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "target_url": { + "name": "target_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "clicks": { + "name": "clicks", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json index 2ff8df6..cfea774 100644 --- a/drizzle/meta/_journal.json +++ b/drizzle/meta/_journal.json @@ -106,6 +106,13 @@ "when": 1765208300249, "tag": "0014_spotty_misty_knight", "breakpoints": true + }, + { + "idx": 15, + "version": "7", + "when": 1772330279963, + "tag": "0015_dizzy_spiral", + "breakpoints": true } ] } \ No newline at end of file diff --git a/schedule-service/.dockerignore b/schedule-service/.dockerignore new file mode 100644 index 0000000..c2420d5 --- /dev/null +++ b/schedule-service/.dockerignore @@ -0,0 +1,3 @@ +__pycache__ +*.pyc +.venv diff --git a/schedule-service/.python-version b/schedule-service/.python-version new file mode 100644 index 0000000..f3d529a --- /dev/null +++ b/schedule-service/.python-version @@ -0,0 +1 @@ +3.14 diff --git a/schedule-service/Dockerfile b/schedule-service/Dockerfile new file mode 100644 index 0000000..6e98df9 --- /dev/null +++ b/schedule-service/Dockerfile @@ -0,0 +1,11 @@ +FROM ghcr.io/astral-sh/uv:alpine +WORKDIR /app + +# Copy requirements first for better caching +COPY pyproject.toml uv.lock ./ +RUN uv sync --no-dev + +# Copy application code +COPY . ./ + +CMD ["uv", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] diff --git a/schedule-service/main.py b/schedule-service/main.py new file mode 100644 index 0000000..74eedf9 --- /dev/null +++ b/schedule-service/main.py @@ -0,0 +1,106 @@ +import asyncio +import logging +from concurrent.futures import ThreadPoolExecutor +from fastapi import FastAPI, HTTPException +from pydantic import BaseModel +import requests +from bs4 import BeautifulSoup + +logging.basicConfig(level=logging.INFO) +log = logging.getLogger(__name__) + +app = FastAPI() + +SCHEDULE_URL = "https://web.cs.kent.edu/schedule/index.php" +SEARCH_URL = "https://www.kent.edu/cs/faculty-staff?field_profile_type_target_id=All&title=" +SKIPPED_EMAILS = {"office@cs.kent.edu", "info@kent.edu"} + +COLUMN_MAP = [ + (0, "code"), + (4, "name"), + (5, "day"), + (6, "time"), + (7, "lecturer"), + (8, "location"), +] + + +class Course(BaseModel): + code: str + name: str + day: str | None = None + time: str | None = None + lecturer: str | None = None + location: str | None = None + email: str | None = None + + +def get_email(lecturer: str) -> str | None: + try: + last, first = lecturer.lower().strip().split(", ", 1) + url = f"{SEARCH_URL}{first}" + soup = BeautifulSoup(requests.get(url, timeout=10).content, "html.parser") + for anchor in soup.select('a[href^="mailto:"]'): + if anchor.string and anchor.string not in SKIPPED_EMAILS: + return anchor.string + except Exception: + pass + return None + + +def parse_row(tds) -> dict: + course: dict = {} + for idx, key in COLUMN_MAP: + value = tds[idx].string.strip() if tds[idx].string else "" + if value: + course[key] = value + elif key == "lecturer": + course[key] = None + return course + + +@app.get("/scrape", response_model=list[Course]) +async def scrape(): + log.info("scrape: fetching schedule") + try: + loop = asyncio.get_event_loop() + response = await loop.run_in_executor(None, lambda: requests.get(SCHEDULE_URL, timeout=15)) + soup = BeautifulSoup(response.content, "html.parser") + table = soup.find("table", id="scheduleTbl") + if not table: + raise HTTPException(status_code=502, detail="Schedule table not found") + rows = table.find("tbody").find_all("tr") + except HTTPException: + raise + except Exception as e: + log.exception("scrape: failed to fetch schedule") + raise HTTPException(status_code=502, detail=f"Failed to fetch schedule: {e}") + + raw = [parse_row(row.find_all("td")) for row in rows] + + merged: dict[str, dict] = {} + for course in raw: + code = course.get("code") + if not code: + continue + if code not in merged: + merged[code] = dict(course) + else: + for field in ("name", "day", "time", "lecturer", "location"): + if not merged[code].get(field) and course.get(field): + merged[code][field] = course[field] + + courses = [c for c in merged.values() if c.get("lecturer")] + log.info("scrape: parsed %d rows, %d merged with lecturers", len(raw), len(courses)) + + unique_lecturers = {c["lecturer"] for c in courses if c.get("lecturer")} + log.info("scrape: fetching emails for %d unique lecturers", len(unique_lecturers)) + + with ThreadPoolExecutor(max_workers=10) as executor: + email_results = await asyncio.gather( + *[loop.run_in_executor(executor, get_email, lecturer) for lecturer in unique_lecturers] + ) + email_map = dict(zip(unique_lecturers, email_results)) + + log.info("scrape: done, returning %d courses", len(courses)) + return [Course(**{**c, "email": email_map.get(c["lecturer"]) if c.get("lecturer") else None}) for c in courses] diff --git a/schedule-service/pyproject.toml b/schedule-service/pyproject.toml new file mode 100644 index 0000000..5a397d5 --- /dev/null +++ b/schedule-service/pyproject.toml @@ -0,0 +1,12 @@ +[project] +name = "schedule-service" +version = "0.1.0" +description = "Kent State CS course schedule scraper" +readme = "README.md" +requires-python = ">=3.14" +dependencies = [ + "fastapi>=0.115.0", + "uvicorn>=0.32.0", + "requests>=2.32.5", + "beautifulsoup4>=4.12.3", +] diff --git a/schedule-service/uv.lock b/schedule-service/uv.lock new file mode 100644 index 0000000..2fead9a --- /dev/null +++ b/schedule-service/uv.lock @@ -0,0 +1,294 @@ +version = 1 +requires-python = ">=3.14" + +[[package]] +name = "annotated-doc" +version = "0.0.4" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/57/ba/046ceea27344560984e26a590f90bc7f4a75b06701f653222458922b558c/annotated_doc-0.0.4.tar.gz", hash = "sha256:fbcda96e87e9c92ad167c2e53839e57503ecfda18804ea28102353485033faa4", size = 7288 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/1e/d3/26bf1008eb3d2daa8ef4cacc7f3bfdc11818d111f7e2d0201bc6e3b49d45/annotated_doc-0.0.4-py3-none-any.whl", hash = "sha256:571ac1dc6991c450b25a9c2d84a3705e2ae7a53467b5d111c24fa8baabbed320", size = 5303 }, +] + +[[package]] +name = "annotated-types" +version = "0.7.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/ee/67/531ea369ba64dcff5ec9c3402f9f51bf748cec26dde048a2f973a4eea7f5/annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89", size = 16081 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53", size = 13643 }, +] + +[[package]] +name = "anyio" +version = "4.12.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "idna" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/96/f0/5eb65b2bb0d09ac6776f2eb54adee6abe8228ea05b20a5ad0e4945de8aac/anyio-4.12.1.tar.gz", hash = "sha256:41cfcc3a4c85d3f05c932da7c26d0201ac36f72abd4435ba90d0464a3ffed703", size = 228685 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/38/0e/27be9fdef66e72d64c0cdc3cc2823101b80585f8119b5c112c2e8f5f7dab/anyio-4.12.1-py3-none-any.whl", hash = "sha256:d405828884fc140aa80a3c667b8beed277f1dfedec42ba031bd6ac3db606ab6c", size = 113592 }, +] + +[[package]] +name = "beautifulsoup4" +version = "4.14.3" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "soupsieve" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c3/b0/1c6a16426d389813b48d95e26898aff79abbde42ad353958ad95cc8c9b21/beautifulsoup4-4.14.3.tar.gz", hash = "sha256:6292b1c5186d356bba669ef9f7f051757099565ad9ada5dd630bd9de5fa7fb86", size = 627737 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/1a/39/47f9197bdd44df24d67ac8893641e16f386c984a0619ef2ee4c51fbbc019/beautifulsoup4-4.14.3-py3-none-any.whl", hash = "sha256:0918bfe44902e6ad8d57732ba310582e98da931428d231a5ecb9e7c703a735bb", size = 107721 }, +] + +[[package]] +name = "certifi" +version = "2026.2.25" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/af/2d/7bf41579a8986e348fa033a31cdd0e4121114f6bce2457e8876010b092dd/certifi-2026.2.25.tar.gz", hash = "sha256:e887ab5cee78ea814d3472169153c2d12cd43b14bd03329a39a9c6e2e80bfba7", size = 155029 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/9a/3c/c17fb3ca2d9c3acff52e30b309f538586f9f5b9c9cf454f3845fc9af4881/certifi-2026.2.25-py3-none-any.whl", hash = "sha256:027692e4402ad994f1c42e52a4997a9763c646b73e4096e4d5d6db8af1d6f0fa", size = 153684 }, +] + +[[package]] +name = "charset-normalizer" +version = "3.4.4" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/13/69/33ddede1939fdd074bce5434295f38fae7136463422fe4fd3e0e89b98062/charset_normalizer-3.4.4.tar.gz", hash = "sha256:94537985111c35f28720e43603b8e7b43a6ecfb2ce1d3058bbe955b73404e21a", size = 129418 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2a/35/7051599bd493e62411d6ede36fd5af83a38f37c4767b92884df7301db25d/charset_normalizer-3.4.4-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:da3326d9e65ef63a817ecbcc0df6e94463713b754fe293eaa03da99befb9a5bd", size = 207746 }, + { url = "https://files.pythonhosted.org/packages/10/9a/97c8d48ef10d6cd4fcead2415523221624bf58bcf68a802721a6bc807c8f/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8af65f14dc14a79b924524b1e7fffe304517b2bff5a58bf64f30b98bbc5079eb", size = 147889 }, + { url = "https://files.pythonhosted.org/packages/10/bf/979224a919a1b606c82bd2c5fa49b5c6d5727aa47b4312bb27b1734f53cd/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:74664978bb272435107de04e36db5a9735e78232b85b77d45cfb38f758efd33e", size = 143641 }, + { url = "https://files.pythonhosted.org/packages/ba/33/0ad65587441fc730dc7bd90e9716b30b4702dc7b617e6ba4997dc8651495/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:752944c7ffbfdd10c074dc58ec2d5a8a4cd9493b314d367c14d24c17684ddd14", size = 160779 }, + { url = "https://files.pythonhosted.org/packages/67/ed/331d6b249259ee71ddea93f6f2f0a56cfebd46938bde6fcc6f7b9a3d0e09/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:d1f13550535ad8cff21b8d757a3257963e951d96e20ec82ab44bc64aeb62a191", size = 159035 }, + { url = "https://files.pythonhosted.org/packages/67/ff/f6b948ca32e4f2a4576aa129d8bed61f2e0543bf9f5f2b7fc3758ed005c9/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ecaae4149d99b1c9e7b88bb03e3221956f68fd6d50be2ef061b2381b61d20838", size = 152542 }, + { url = "https://files.pythonhosted.org/packages/16/85/276033dcbcc369eb176594de22728541a925b2632f9716428c851b149e83/charset_normalizer-3.4.4-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:cb6254dc36b47a990e59e1068afacdcd02958bdcce30bb50cc1700a8b9d624a6", size = 149524 }, + { url = "https://files.pythonhosted.org/packages/9e/f2/6a2a1f722b6aba37050e626530a46a68f74e63683947a8acff92569f979a/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:c8ae8a0f02f57a6e61203a31428fa1d677cbe50c93622b4149d5c0f319c1d19e", size = 150395 }, + { url = "https://files.pythonhosted.org/packages/60/bb/2186cb2f2bbaea6338cad15ce23a67f9b0672929744381e28b0592676824/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:47cc91b2f4dd2833fddaedd2893006b0106129d4b94fdb6af1f4ce5a9965577c", size = 143680 }, + { url = "https://files.pythonhosted.org/packages/7d/a5/bf6f13b772fbb2a90360eb620d52ed8f796f3c5caee8398c3b2eb7b1c60d/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:82004af6c302b5d3ab2cfc4cc5f29db16123b1a8417f2e25f9066f91d4411090", size = 162045 }, + { url = "https://files.pythonhosted.org/packages/df/c5/d1be898bf0dc3ef9030c3825e5d3b83f2c528d207d246cbabe245966808d/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:2b7d8f6c26245217bd2ad053761201e9f9680f8ce52f0fcd8d0755aeae5b2152", size = 149687 }, + { url = "https://files.pythonhosted.org/packages/a5/42/90c1f7b9341eef50c8a1cb3f098ac43b0508413f33affd762855f67a410e/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:799a7a5e4fb2d5898c60b640fd4981d6a25f1c11790935a44ce38c54e985f828", size = 160014 }, + { url = "https://files.pythonhosted.org/packages/76/be/4d3ee471e8145d12795ab655ece37baed0929462a86e72372fd25859047c/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:99ae2cffebb06e6c22bdc25801d7b30f503cc87dbd283479e7b606f70aff57ec", size = 154044 }, + { url = "https://files.pythonhosted.org/packages/b0/6f/8f7af07237c34a1defe7defc565a9bc1807762f672c0fde711a4b22bf9c0/charset_normalizer-3.4.4-cp314-cp314-win32.whl", hash = "sha256:f9d332f8c2a2fcbffe1378594431458ddbef721c1769d78e2cbc06280d8155f9", size = 99940 }, + { url = "https://files.pythonhosted.org/packages/4b/51/8ade005e5ca5b0d80fb4aff72a3775b325bdc3d27408c8113811a7cbe640/charset_normalizer-3.4.4-cp314-cp314-win_amd64.whl", hash = "sha256:8a6562c3700cce886c5be75ade4a5db4214fda19fede41d9792d100288d8f94c", size = 107104 }, + { url = "https://files.pythonhosted.org/packages/da/5f/6b8f83a55bb8278772c5ae54a577f3099025f9ade59d0136ac24a0df4bde/charset_normalizer-3.4.4-cp314-cp314-win_arm64.whl", hash = "sha256:de00632ca48df9daf77a2c65a484531649261ec9f25489917f09e455cb09ddb2", size = 100743 }, + { url = "https://files.pythonhosted.org/packages/0a/4c/925909008ed5a988ccbb72dcc897407e5d6d3bd72410d69e051fc0c14647/charset_normalizer-3.4.4-py3-none-any.whl", hash = "sha256:7a32c560861a02ff789ad905a2fe94e3f840803362c84fecf1851cb4cf3dc37f", size = 53402 }, +] + +[[package]] +name = "click" +version = "8.3.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "platform_system == 'Windows'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/3d/fa/656b739db8587d7b5dfa22e22ed02566950fbfbcdc20311993483657a5c0/click-8.3.1.tar.gz", hash = "sha256:12ff4785d337a1bb490bb7e9c2b1ee5da3112e94a8622f26a6c77f5d2fc6842a", size = 295065 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/98/78/01c019cdb5d6498122777c1a43056ebb3ebfeef2076d9d026bfe15583b2b/click-8.3.1-py3-none-any.whl", hash = "sha256:981153a64e25f12d547d3426c367a4857371575ee7ad18df2a6183ab0545b2a6", size = 108274 }, +] + +[[package]] +name = "colorama" +version = "0.4.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335 }, +] + +[[package]] +name = "fastapi" +version = "0.134.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "annotated-doc" }, + { name = "pydantic" }, + { name = "starlette" }, + { name = "typing-extensions" }, + { name = "typing-inspection" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/96/15/647ea81cb73b55b48fb095158a9cd64e42e9e4f1d34dbb5cc4a4939779d6/fastapi-0.134.0.tar.gz", hash = "sha256:3122b1ea0dbeaab48b5976e80b99ca7eda02be154bf03e126a33220e73255a9a", size = 385667 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e3/e6/fd49c28a54b7d6f5c64045155e40f6cff9ed4920055043fb5ac7969f7f2f/fastapi-0.134.0-py3-none-any.whl", hash = "sha256:f4e7214f24b2262258492e05c48cf21125e4ffc427e30dd32fb4f74049a3d56a", size = 110404 }, +] + +[[package]] +name = "h11" +version = "0.16.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/01/ee/02a2c011bdab74c6fb3c75474d40b3052059d95df7e73351460c8588d963/h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1", size = 101250 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515 }, +] + +[[package]] +name = "idna" +version = "3.11" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/6f/6d/0703ccc57f3a7233505399edb88de3cbd678da106337b9fcde432b65ed60/idna-3.11.tar.gz", hash = "sha256:795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902", size = 194582 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/0e/61/66938bbb5fc52dbdf84594873d5b51fb1f7c7794e9c0f5bd885f30bc507b/idna-3.11-py3-none-any.whl", hash = "sha256:771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea", size = 71008 }, +] + +[[package]] +name = "pydantic" +version = "2.12.5" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "annotated-types" }, + { name = "pydantic-core" }, + { name = "typing-extensions" }, + { name = "typing-inspection" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/69/44/36f1a6e523abc58ae5f928898e4aca2e0ea509b5aa6f6f392a5d882be928/pydantic-2.12.5.tar.gz", hash = "sha256:4d351024c75c0f085a9febbb665ce8c0c6ec5d30e903bdb6394b7ede26aebb49", size = 821591 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/5a/87/b70ad306ebb6f9b585f114d0ac2137d792b48be34d732d60e597c2f8465a/pydantic-2.12.5-py3-none-any.whl", hash = "sha256:e561593fccf61e8a20fc46dfc2dfe075b8be7d0188df33f221ad1f0139180f9d", size = 463580 }, +] + +[[package]] +name = "pydantic-core" +version = "2.41.5" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/71/70/23b021c950c2addd24ec408e9ab05d59b035b39d97cdc1130e1bce647bb6/pydantic_core-2.41.5.tar.gz", hash = "sha256:08daa51ea16ad373ffd5e7606252cc32f07bc72b28284b6bc9c6df804816476e", size = 460952 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ea/28/46b7c5c9635ae96ea0fbb779e271a38129df2550f763937659ee6c5dbc65/pydantic_core-2.41.5-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:3f37a19d7ebcdd20b96485056ba9e8b304e27d9904d233d7b1015db320e51f0a", size = 2119622 }, + { url = "https://files.pythonhosted.org/packages/74/1a/145646e5687e8d9a1e8d09acb278c8535ebe9e972e1f162ed338a622f193/pydantic_core-2.41.5-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:1d1d9764366c73f996edd17abb6d9d7649a7eb690006ab6adbda117717099b14", size = 1891725 }, + { url = "https://files.pythonhosted.org/packages/23/04/e89c29e267b8060b40dca97bfc64a19b2a3cf99018167ea1677d96368273/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:25e1c2af0fce638d5f1988b686f3b3ea8cd7de5f244ca147c777769e798a9cd1", size = 1915040 }, + { url = "https://files.pythonhosted.org/packages/84/a3/15a82ac7bd97992a82257f777b3583d3e84bdb06ba6858f745daa2ec8a85/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:506d766a8727beef16b7adaeb8ee6217c64fc813646b424d0804d67c16eddb66", size = 2063691 }, + { url = "https://files.pythonhosted.org/packages/74/9b/0046701313c6ef08c0c1cf0e028c67c770a4e1275ca73131563c5f2a310a/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4819fa52133c9aa3c387b3328f25c1facc356491e6135b459f1de698ff64d869", size = 2213897 }, + { url = "https://files.pythonhosted.org/packages/8a/cd/6bac76ecd1b27e75a95ca3a9a559c643b3afcd2dd62086d4b7a32a18b169/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2b761d210c9ea91feda40d25b4efe82a1707da2ef62901466a42492c028553a2", size = 2333302 }, + { url = "https://files.pythonhosted.org/packages/4c/d2/ef2074dc020dd6e109611a8be4449b98cd25e1b9b8a303c2f0fca2f2bcf7/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:22f0fb8c1c583a3b6f24df2470833b40207e907b90c928cc8d3594b76f874375", size = 2064877 }, + { url = "https://files.pythonhosted.org/packages/18/66/e9db17a9a763d72f03de903883c057b2592c09509ccfe468187f2a2eef29/pydantic_core-2.41.5-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2782c870e99878c634505236d81e5443092fba820f0373997ff75f90f68cd553", size = 2180680 }, + { url = "https://files.pythonhosted.org/packages/d3/9e/3ce66cebb929f3ced22be85d4c2399b8e85b622db77dad36b73c5387f8f8/pydantic_core-2.41.5-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:0177272f88ab8312479336e1d777f6b124537d47f2123f89cb37e0accea97f90", size = 2138960 }, + { url = "https://files.pythonhosted.org/packages/a6/62/205a998f4327d2079326b01abee48e502ea739d174f0a89295c481a2272e/pydantic_core-2.41.5-cp314-cp314-musllinux_1_1_armv7l.whl", hash = "sha256:63510af5e38f8955b8ee5687740d6ebf7c2a0886d15a6d65c32814613681bc07", size = 2339102 }, + { url = "https://files.pythonhosted.org/packages/3c/0d/f05e79471e889d74d3d88f5bd20d0ed189ad94c2423d81ff8d0000aab4ff/pydantic_core-2.41.5-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:e56ba91f47764cc14f1daacd723e3e82d1a89d783f0f5afe9c364b8bb491ccdb", size = 2326039 }, + { url = "https://files.pythonhosted.org/packages/ec/e1/e08a6208bb100da7e0c4b288eed624a703f4d129bde2da475721a80cab32/pydantic_core-2.41.5-cp314-cp314-win32.whl", hash = "sha256:aec5cf2fd867b4ff45b9959f8b20ea3993fc93e63c7363fe6851424c8a7e7c23", size = 1995126 }, + { url = "https://files.pythonhosted.org/packages/48/5d/56ba7b24e9557f99c9237e29f5c09913c81eeb2f3217e40e922353668092/pydantic_core-2.41.5-cp314-cp314-win_amd64.whl", hash = "sha256:8e7c86f27c585ef37c35e56a96363ab8de4e549a95512445b85c96d3e2f7c1bf", size = 2015489 }, + { url = "https://files.pythonhosted.org/packages/4e/bb/f7a190991ec9e3e0ba22e4993d8755bbc4a32925c0b5b42775c03e8148f9/pydantic_core-2.41.5-cp314-cp314-win_arm64.whl", hash = "sha256:e672ba74fbc2dc8eea59fb6d4aed6845e6905fc2a8afe93175d94a83ba2a01a0", size = 1977288 }, + { url = "https://files.pythonhosted.org/packages/92/ed/77542d0c51538e32e15afe7899d79efce4b81eee631d99850edc2f5e9349/pydantic_core-2.41.5-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:8566def80554c3faa0e65ac30ab0932b9e3a5cd7f8323764303d468e5c37595a", size = 2120255 }, + { url = "https://files.pythonhosted.org/packages/bb/3d/6913dde84d5be21e284439676168b28d8bbba5600d838b9dca99de0fad71/pydantic_core-2.41.5-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:b80aa5095cd3109962a298ce14110ae16b8c1aece8b72f9dafe81cf597ad80b3", size = 1863760 }, + { url = "https://files.pythonhosted.org/packages/5a/f0/e5e6b99d4191da102f2b0eb9687aaa7f5bea5d9964071a84effc3e40f997/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3006c3dd9ba34b0c094c544c6006cc79e87d8612999f1a5d43b769b89181f23c", size = 1878092 }, + { url = "https://files.pythonhosted.org/packages/71/48/36fb760642d568925953bcc8116455513d6e34c4beaa37544118c36aba6d/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:72f6c8b11857a856bcfa48c86f5368439f74453563f951e473514579d44aa612", size = 2053385 }, + { url = "https://files.pythonhosted.org/packages/20/25/92dc684dd8eb75a234bc1c764b4210cf2646479d54b47bf46061657292a8/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5cb1b2f9742240e4bb26b652a5aeb840aa4b417c7748b6f8387927bc6e45e40d", size = 2218832 }, + { url = "https://files.pythonhosted.org/packages/e2/09/f53e0b05023d3e30357d82eb35835d0f6340ca344720a4599cd663dca599/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:bd3d54f38609ff308209bd43acea66061494157703364ae40c951f83ba99a1a9", size = 2327585 }, + { url = "https://files.pythonhosted.org/packages/aa/4e/2ae1aa85d6af35a39b236b1b1641de73f5a6ac4d5a7509f77b814885760c/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2ff4321e56e879ee8d2a879501c8e469414d948f4aba74a2d4593184eb326660", size = 2041078 }, + { url = "https://files.pythonhosted.org/packages/cd/13/2e215f17f0ef326fc72afe94776edb77525142c693767fc347ed6288728d/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d0d2568a8c11bf8225044aa94409e21da0cb09dcdafe9ecd10250b2baad531a9", size = 2173914 }, + { url = "https://files.pythonhosted.org/packages/02/7a/f999a6dcbcd0e5660bc348a3991c8915ce6599f4f2c6ac22f01d7a10816c/pydantic_core-2.41.5-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:a39455728aabd58ceabb03c90e12f71fd30fa69615760a075b9fec596456ccc3", size = 2129560 }, + { url = "https://files.pythonhosted.org/packages/3a/b1/6c990ac65e3b4c079a4fb9f5b05f5b013afa0f4ed6780a3dd236d2cbdc64/pydantic_core-2.41.5-cp314-cp314t-musllinux_1_1_armv7l.whl", hash = "sha256:239edca560d05757817c13dc17c50766136d21f7cd0fac50295499ae24f90fdf", size = 2329244 }, + { url = "https://files.pythonhosted.org/packages/d9/02/3c562f3a51afd4d88fff8dffb1771b30cfdfd79befd9883ee094f5b6c0d8/pydantic_core-2.41.5-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:2a5e06546e19f24c6a96a129142a75cee553cc018ffee48a460059b1185f4470", size = 2331955 }, + { url = "https://files.pythonhosted.org/packages/5c/96/5fb7d8c3c17bc8c62fdb031c47d77a1af698f1d7a406b0f79aaa1338f9ad/pydantic_core-2.41.5-cp314-cp314t-win32.whl", hash = "sha256:b4ececa40ac28afa90871c2cc2b9ffd2ff0bf749380fbdf57d165fd23da353aa", size = 1988906 }, + { url = "https://files.pythonhosted.org/packages/22/ed/182129d83032702912c2e2d8bbe33c036f342cc735737064668585dac28f/pydantic_core-2.41.5-cp314-cp314t-win_amd64.whl", hash = "sha256:80aa89cad80b32a912a65332f64a4450ed00966111b6615ca6816153d3585a8c", size = 1981607 }, + { url = "https://files.pythonhosted.org/packages/9f/ed/068e41660b832bb0b1aa5b58011dea2a3fe0ba7861ff38c4d4904c1c1a99/pydantic_core-2.41.5-cp314-cp314t-win_arm64.whl", hash = "sha256:35b44f37a3199f771c3eaa53051bc8a70cd7b54f333531c59e29fd4db5d15008", size = 1974769 }, + { url = "https://files.pythonhosted.org/packages/11/72/90fda5ee3b97e51c494938a4a44c3a35a9c96c19bba12372fb9c634d6f57/pydantic_core-2.41.5-graalpy311-graalpy242_311_native-macosx_10_12_x86_64.whl", hash = "sha256:b96d5f26b05d03cc60f11a7761a5ded1741da411e7fe0909e27a5e6a0cb7b034", size = 2115441 }, + { url = "https://files.pythonhosted.org/packages/1f/53/8942f884fa33f50794f119012dc6a1a02ac43a56407adaac20463df8e98f/pydantic_core-2.41.5-graalpy311-graalpy242_311_native-macosx_11_0_arm64.whl", hash = "sha256:634e8609e89ceecea15e2d61bc9ac3718caaaa71963717bf3c8f38bfde64242c", size = 1930291 }, + { url = "https://files.pythonhosted.org/packages/79/c8/ecb9ed9cd942bce09fc888ee960b52654fbdbede4ba6c2d6e0d3b1d8b49c/pydantic_core-2.41.5-graalpy311-graalpy242_311_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:93e8740d7503eb008aa2df04d3b9735f845d43ae845e6dcd2be0b55a2da43cd2", size = 1948632 }, + { url = "https://files.pythonhosted.org/packages/2e/1b/687711069de7efa6af934e74f601e2a4307365e8fdc404703afc453eab26/pydantic_core-2.41.5-graalpy311-graalpy242_311_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f15489ba13d61f670dcc96772e733aad1a6f9c429cc27574c6cdaed82d0146ad", size = 2138905 }, + { url = "https://files.pythonhosted.org/packages/09/32/59b0c7e63e277fa7911c2fc70ccfb45ce4b98991e7ef37110663437005af/pydantic_core-2.41.5-graalpy312-graalpy250_312_native-macosx_10_12_x86_64.whl", hash = "sha256:7da7087d756b19037bc2c06edc6c170eeef3c3bafcb8f532ff17d64dc427adfd", size = 2110495 }, + { url = "https://files.pythonhosted.org/packages/aa/81/05e400037eaf55ad400bcd318c05bb345b57e708887f07ddb2d20e3f0e98/pydantic_core-2.41.5-graalpy312-graalpy250_312_native-macosx_11_0_arm64.whl", hash = "sha256:aabf5777b5c8ca26f7824cb4a120a740c9588ed58df9b2d196ce92fba42ff8dc", size = 1915388 }, + { url = "https://files.pythonhosted.org/packages/6e/0d/e3549b2399f71d56476b77dbf3cf8937cec5cd70536bdc0e374a421d0599/pydantic_core-2.41.5-graalpy312-graalpy250_312_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c007fe8a43d43b3969e8469004e9845944f1a80e6acd47c150856bb87f230c56", size = 1942879 }, + { url = "https://files.pythonhosted.org/packages/f7/07/34573da085946b6a313d7c42f82f16e8920bfd730665de2d11c0c37a74b5/pydantic_core-2.41.5-graalpy312-graalpy250_312_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:76d0819de158cd855d1cbb8fcafdf6f5cf1eb8e470abe056d5d161106e38062b", size = 2139017 }, +] + +[[package]] +name = "requests" +version = "2.32.5" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "certifi" }, + { name = "charset-normalizer" }, + { name = "idna" }, + { name = "urllib3" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c9/74/b3ff8e6c8446842c3f5c837e9c3dfcfe2018ea6ecef224c710c85ef728f4/requests-2.32.5.tar.gz", hash = "sha256:dbba0bac56e100853db0ea71b82b4dfd5fe2bf6d3754a8893c3af500cec7d7cf", size = 134517 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/1e/db/4254e3eabe8020b458f1a747140d32277ec7a271daf1d235b70dc0b4e6e3/requests-2.32.5-py3-none-any.whl", hash = "sha256:2462f94637a34fd532264295e186976db0f5d453d1cdd31473c85a6a161affb6", size = 64738 }, +] + +[[package]] +name = "schedule-service" +version = "0.1.0" +source = { virtual = "." } +dependencies = [ + { name = "beautifulsoup4" }, + { name = "fastapi" }, + { name = "requests" }, + { name = "uvicorn" }, +] + +[package.metadata] +requires-dist = [ + { name = "beautifulsoup4", specifier = ">=4.12.3" }, + { name = "fastapi", specifier = ">=0.115.0" }, + { name = "requests", specifier = ">=2.32.5" }, + { name = "uvicorn", specifier = ">=0.32.0" }, +] + +[[package]] +name = "soupsieve" +version = "2.8.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/7b/ae/2d9c981590ed9999a0d91755b47fc74f74de286b0f5cee14c9269041e6c4/soupsieve-2.8.3.tar.gz", hash = "sha256:3267f1eeea4251fb42728b6dfb746edc9acaffc4a45b27e19450b676586e8349", size = 118627 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/46/2c/1462b1d0a634697ae9e55b3cecdcb64788e8b7d63f54d923fcd0bb140aed/soupsieve-2.8.3-py3-none-any.whl", hash = "sha256:ed64f2ba4eebeab06cc4962affce381647455978ffc1e36bb79a545b91f45a95", size = 37016 }, +] + +[[package]] +name = "starlette" +version = "0.52.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "anyio" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c4/68/79977123bb7be889ad680d79a40f339082c1978b5cfcf62c2d8d196873ac/starlette-0.52.1.tar.gz", hash = "sha256:834edd1b0a23167694292e94f597773bc3f89f362be6effee198165a35d62933", size = 2653702 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/81/0d/13d1d239a25cbfb19e740db83143e95c772a1fe10202dda4b76792b114dd/starlette-0.52.1-py3-none-any.whl", hash = "sha256:0029d43eb3d273bc4f83a08720b4912ea4b071087a3b48db01b7c839f7954d74", size = 74272 }, +] + +[[package]] +name = "typing-extensions" +version = "4.15.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/72/94/1a15dd82efb362ac84269196e94cf00f187f7ed21c242792a923cdb1c61f/typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466", size = 109391 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/18/67/36e9267722cc04a6b9f15c7f3441c2363321a3ea07da7ae0c0707beb2a9c/typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548", size = 44614 }, +] + +[[package]] +name = "typing-inspection" +version = "0.4.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/55/e3/70399cb7dd41c10ac53367ae42139cf4b1ca5f36bb3dc6c9d33acdb43655/typing_inspection-0.4.2.tar.gz", hash = "sha256:ba561c48a67c5958007083d386c3295464928b01faa735ab8547c5692e87f464", size = 75949 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/dc/9b/47798a6c91d8bdb567fe2698fe81e0c6b7cb7ef4d13da4114b41d239f65d/typing_inspection-0.4.2-py3-none-any.whl", hash = "sha256:4ed1cacbdc298c220f1bd249ed5287caa16f34d44ef4e9c3d0cbad5b521545e7", size = 14611 }, +] + +[[package]] +name = "urllib3" +version = "2.6.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/c7/24/5f1b3bdffd70275f6661c76461e25f024d5a38a46f04aaca912426a2b1d3/urllib3-2.6.3.tar.gz", hash = "sha256:1b62b6884944a57dbe321509ab94fd4d3b307075e0c2eae991ac71ee15ad38ed", size = 435556 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/39/08/aaaad47bc4e9dc8c725e68f9d04865dbcb2052843ff09c97b08904852d84/urllib3-2.6.3-py3-none-any.whl", hash = "sha256:bf272323e553dfb2e87d9bfd225ca7b0f467b919d7bbd355436d3fd37cb0acd4", size = 131584 }, +] + +[[package]] +name = "uvicorn" +version = "0.41.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "click" }, + { name = "h11" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/32/ce/eeb58ae4ac36fe09e3842eb02e0eb676bf2c53ae062b98f1b2531673efdd/uvicorn-0.41.0.tar.gz", hash = "sha256:09d11cf7008da33113824ee5a1c6422d89fbc2ff476540d69a34c87fab8b571a", size = 82633 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/83/e4/d04a086285c20886c0daad0e026f250869201013d18f81d9ff5eada73a88/uvicorn-0.41.0-py3-none-any.whl", hash = "sha256:29e35b1d2c36a04b9e180d4007ede3bcb32a85fbdfd6c6aeb3f26839de088187", size = 68783 }, +] diff --git a/src/lib/server/db/schema.ts b/src/lib/server/db/schema.ts index f1b2751..e43e91a 100644 --- a/src/lib/server/db/schema.ts +++ b/src/lib/server/db/schema.ts @@ -92,3 +92,16 @@ export const lessonIcons = pgTable('lesson_icons', { updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull() }); +// Course schedule table — populated by the schedule-service scraper +export const courseSchedule = pgTable('course_schedule', { + id: text('id').primaryKey(), + code: text('code').notNull(), + name: text('name').notNull(), + day: text('day'), + time: text('time'), + lecturer: text('lecturer'), + location: text('location'), + email: text('email'), + scrapedAt: timestamp('scraped_at', { withTimezone: true }).notNull() +}); + diff --git a/src/routes/admin/+page.svelte b/src/routes/admin/+page.svelte index ef2e97e..b1c4d04 100644 --- a/src/routes/admin/+page.svelte +++ b/src/routes/admin/+page.svelte @@ -36,6 +36,11 @@ title: 'Lesson Icons', href: '/admin/lesson-icons', description: 'Manage icon mappings for lesson categories' + }, + { + title: 'Course Schedule', + href: '/admin/schedule', + description: 'View the current CS course schedule with lecturer emails' } ]; diff --git a/src/routes/admin/schedule/+page.server.ts b/src/routes/admin/schedule/+page.server.ts new file mode 100644 index 0000000..79c2784 --- /dev/null +++ b/src/routes/admin/schedule/+page.server.ts @@ -0,0 +1,71 @@ +import { db } from '$lib/server/db'; +import { courseSchedule } from '$lib/server/db/schema'; +import { requireAdmin } from '$lib/server/admin'; +import { fail, redirect } from '@sveltejs/kit'; +import type { PageServerLoad, Actions } from './$types'; +import { asc } from 'drizzle-orm'; +import { env } from '$env/dynamic/private'; +import { randomUUID } from 'crypto'; + +export const load: PageServerLoad = async (event) => { + await requireAdmin(event); + + const courses = await db.query.courseSchedule.findMany({ + orderBy: [asc(courseSchedule.code)] + }); + + return { courses }; +}; + +export const actions: Actions = { + refresh: async (event) => { + await requireAdmin(event); + + const serviceUrl = env.SCHEDULE_SERVICE_URL ?? 'http://localhost:8000'; + + let scraped: Array<{ + code: string; + name: string; + day?: string; + time?: string; + lecturer?: string; + location?: string; + email?: string; + }>; + + try { + const response = await fetch(`${serviceUrl}/scrape`, { + signal: AbortSignal.timeout(120_000) + }); + if (!response.ok) { + const detail = await response.json().catch(() => ({})); + return fail(502, { error: `Schedule service error: ${detail?.detail ?? response.status}` }); + } + scraped = await response.json(); + } catch (e) { + if (e instanceof Error && e.name === 'TimeoutError') { + return fail(502, { error: 'Schedule service timed out. Try again.' }); + } + return fail(502, { error: 'Could not reach the schedule service. Is it running?' }); + } + + const scrapedAt = new Date(); + + await db.delete(courseSchedule); + await db.insert(courseSchedule).values( + scraped.map((c) => ({ + id: randomUUID(), + code: c.code, + name: c.name, + day: c.day ?? null, + time: c.time ?? null, + lecturer: c.lecturer ?? null, + location: c.location ?? null, + email: c.email ?? null, + scrapedAt + })) + ); + + redirect(303, '/admin/schedule'); + } +}; diff --git a/src/routes/admin/schedule/+page.svelte b/src/routes/admin/schedule/+page.svelte new file mode 100644 index 0000000..a712ca8 --- /dev/null +++ b/src/routes/admin/schedule/+page.svelte @@ -0,0 +1,134 @@ + + +
+
+
+

Course Schedule

+ {#if lastScraped} +

Last scraped: {lastScraped}

+ {:else} +

No data yet — click Refresh to scrape.

+ {/if} +
+ +
{ + refreshing = true; + return async ({ update }) => { + await update(); + refreshing = false; + }; + }} + > + +
+
+ + {#if form?.error} +
+ {form.error} +
+ {/if} + + {#if courses.length > 0} +
+ + +
+ +
+
+ + + + + + + + + + + + + + {#each filtered as course (course.id)} + + + + + + + + + + {/each} + +
CodeNameDayTimeLecturerEmailLocation
{course.code}{course.name}{course.day ?? '—'}{course.time ?? '—'}{course.lecturer ?? '—'} + {#if course.email} + {course.email} + {:else} + + {/if} + {course.location ?? '—'}
+
+
+ {filtered.length} of {courses.length} courses +
+
+ {:else if !form?.error} +
+

No schedule data yet. Click Refresh to scrape the current schedule.

+
+ {/if} +