Refactor code structure for improved readability and maintainability

This commit is contained in:
2025-05-17 15:46:11 +08:00
parent 9753aeb4bf
commit 4e671e9db5
6 changed files with 12 additions and 15 deletions
+5 -11
View File
@@ -20,24 +20,18 @@ ENV UV_COMPILE_BYTECODE=1
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#caching
ENV UV_LINK_MODE=copy
# Copy project files first so they're available for dependency installation
COPY ./pyproject.toml ./uv.lock ./alembic.ini /app/
# Install dependencies
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#intermediate-layers
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --frozen --no-install-project
uv pip install --system -e .
ENV PYTHONPATH=/app
# Copy application code and scripts
COPY ./scripts /app/scripts
COPY ./pyproject.toml ./uv.lock ./alembic.ini /app/
COPY ./app /app/app
# Sync the project
# Ref: https://docs.astral.sh/uv/guides/integration/docker/#intermediate-layers
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync
CMD ["fastapi", "run", "--workers", "4", "app/main.py"]
+3
View File
@@ -37,6 +37,9 @@ dev-dependencies = [
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["app"]
[tool.mypy]
strict = true
exclude = ["venv", ".venv", "alembic"]
Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

+2 -2
View File
@@ -1,7 +1,7 @@
import { Flex, Image, useBreakpointValue } from "@chakra-ui/react"
import { Link } from "@tanstack/react-router"
import Logo from "/assets/images/fastapi-logo.svg"
import Logo from "/assets/images/logo.png"
import UserMenu from "./UserMenu"
function Navbar() {
@@ -20,7 +20,7 @@ function Navbar() {
p={4}
>
<Link to="/">
<Image src={Logo} alt="Logo" maxW="3xs" p={2} />
<Image src={Logo} alt="Logo" height="40px" width="auto" />
</Link>
<Flex gap={2} alignItems="center">
<UserMenu />
+1 -1
View File
@@ -13,7 +13,7 @@ import { Field } from "@/components/ui/field"
import { InputGroup } from "@/components/ui/input-group"
import { PasswordInput } from "@/components/ui/password-input"
import useAuth, { isLoggedIn } from "@/hooks/useAuth"
import Logo from "/assets/images/fastapi-logo.svg"
import Logo from "/assets/images/logo.png"
import { emailPattern, passwordRules } from "../utils"
export const Route = createFileRoute("/login")({
+1 -1
View File
@@ -14,7 +14,7 @@ import { InputGroup } from "@/components/ui/input-group"
import { PasswordInput } from "@/components/ui/password-input"
import useAuth, { isLoggedIn } from "@/hooks/useAuth"
import { confirmPasswordRules, emailPattern, passwordRules } from "@/utils"
import Logo from "/assets/images/fastapi-logo.svg"
import Logo from "/assets/images/logo.png"
export const Route = createFileRoute("/signup")({
component: SignUp,