WUT_Computer_Science/Programming/ERSMS-project
Krzysztof kuhy Rudnicki 2a59de6363 The six mypy errors are gone: four were fixable, two are scoped
The note in TODO-refactor-remaining.md said ERSMS's four were structural and
that a fix "would rewrite both models". Both halves were wrong.
flask-sqlalchemy 3.1.1 does ship py.typed; the real blocker was that
`class User(db.Model)` is attribute access, which mypy cannot resolve in a
base-class position.

backend/models.py now declares a named DeclarativeBase with SQLAlchemy 2.0
Mapped[] columns. The Model mixin goes away with the base, so the six legacy
Model.query call sites became db.session selects and the two table names are
spelled out rather than derived.

Verified by driving the real routes through Flask's test client with Firebase
stubbed out -- 16 scenarios covering every one of the six call sites, plus
both CREATE TABLE statements, byte-identical to the submitted version. That
harness caught the one thing review would not have: mapped_column(ForeignKey(
"user.uid")) silently infers VARCHAR(80) from the referenced column, which
had changed the submitted `user_id INTEGER`. An explicit Integer puts it back.

app.py went over the 250-line cap on the way, hence the split; models.py takes
the shebang + exec bit that NLP's nine import-only modules already use, since
__init__.py would make `from models import` unresolvable to mypy while it
still works at runtime. backend/Dockerfile copied only app.py, so it needed
the new file too.

PSD's two are pyflink's MapFunction and KeyedProcessFunction, which ship no
types and are not installed in that venv at all -- a hand-written .pyi would
assert an API nothing here can check. A [[tool.mypy.overrides]] scoped to that
one module turns off disallow_subclassing_any and nothing else.

ERSMS 4 -> 0, PSD 2 -> 0, under --strict. ruff and ruff format clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172dj34FDpao6wsix8ZuCzE
2026-08-29 11:00:28 +02:00
..
analytics ERSMS-project: zero findings, and the SQL is parameterised now 2026-08-29 08:30:01 +02:00
backend The six mypy errors are gone: four were fixable, two are scoped 2026-08-29 11:00:28 +02:00
connector ERSMS-project: zero findings, and the SQL is parameterised now 2026-08-29 08:30:01 +02:00
database Add 'Programming/ERSMS-project/' from commit 'd060e8285ad6f3dddde51a842f2c8498138afb0b' 2026-02-06 22:14:41 +01:00
docs Run all 33 safe courses; fix what that broke 2026-08-28 18:52:31 +02:00
frontend Add 'Programming/ERSMS-project/' from commit 'd060e8285ad6f3dddde51a842f2c8498138afb0b' 2026-02-06 22:14:41 +01:00
movie_recommendations ERSMS-project: zero findings, and the SQL is parameterised now 2026-08-29 08:30:01 +02:00
nginx Add pre-commit and fix everything it found 2026-08-28 18:21:22 +02:00
test_scripts Add 'Programming/ERSMS-project/' from commit 'd060e8285ad6f3dddde51a842f2c8498138afb0b' 2026-02-06 22:14:41 +01:00
.gitignore Add 'Programming/ERSMS-project/' from commit 'd060e8285ad6f3dddde51a842f2c8498138afb0b' 2026-02-06 22:14:41 +01:00
docker-compose.yml ERSMS-project: zero findings, and the SQL is parameterised now 2026-08-29 08:30:01 +02:00
Dockerfile Add 'Programming/ERSMS-project/' from commit 'd060e8285ad6f3dddde51a842f2c8498138afb0b' 2026-02-06 22:14:41 +01:00
README.md Add 'Programming/ERSMS-project/' from commit 'd060e8285ad6f3dddde51a842f2c8498138afb0b' 2026-02-06 22:14:41 +01:00
run.sh Add a run.sh to every course, and fix the code that would not build 2026-08-28 18:37:55 +02:00

Projekt z ERSMS

Backend

budowanie i uruchamianie obrazu z bazą danych oraz serwerem:

docker compose up

w przypadku zmian w bazie danych, usunąć kontener oraz dołączone do niego volumy

stronka administracyjna do bazy danych

Najpierw wpisujemy w przeglądarce http://localhost:8080/ Przy logowaniu wpisujemy:

Po zalogowaniu się poraz pierwszy od zbudowania obrazu, widzimy stronę główną. Klikamy na niej duży przycisk "Add New Server" i pojawia się okienko z menu dodawania serwera.

W nazwie można napisać cokolwiek, jednak w zakładce "Connection" piszemy następujące rzeczy:

  • host name - db
  • login - root
  • password - root

Reszta pozostaje jak była. Po zapisaniu ustawień, mamy już dostęp do narzędzi administratora dla naszej bazy danych.

gadanie z endpointami

GET http://localhost:8090/ - testowy domowy

GET http://localhost:8090//api/v3/get/string:username - info o userach

GET http://localhost:8090//api/v3/get_movie/int:movie_ID - info o filmie

POST http://localhost:8090/api/v3/add/string:oauth_ID/string:username - dodawanie usera

POST http://localhost:8090/api/v3/add/string:oauth_ID/string:movie_ID/int:rating - dodawanie oceny do filmu przez usera

GET http://localhost:8090/api/v3/ai/string:oauth_ID - wyciąganie rekomendacji od AI