Open KrzysztofKulak opened 3 years ago
Thanks. I yeeted the redirection entirely and added an endpoint to look up target urls instead, the redirection will be handled in a separate app as it doesn't need to know anything about the db: https://github.com/mkmozgawa/urlshortener-srv/commit/06d7fcb6a97b01e1e3330bb0eda4c26d0d200822
https://github.com/mkmozgawa/urlshortener-srv/blob/e3b753db0879ca0d37ad0730214b0c9d3b5e8bfd/src/views/redirects.py#L11
Cool use of a walrus operator! However I'd think of a way to hide the
db.session.query(Url.target_url).filter_by(custom_name=path).scalar()
implementation in the method in Url module, so you don't have to leak as much of internal implementation and db connection details into the most external layer of the app.Also I wonder about putting blueprints in
api/urls
andviews
. It seems a little bit inconsistent and confusing to me. Have you seen similar module organisation somewhere else?