diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..aff4418 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,54 @@ +version: '2' + +linters: + default: none + enable: + - copyloopvar + - errcheck + - govet + - ineffassign + - revive + - staticcheck + - unconvert + - unused + settings: + revive: + enable-all-rules: false + rules: + - name: blank-imports + - name: context-as-argument + - name: context-keys-type + - name: early-return + - name: error-naming + - name: error-return + - name: if-return + - name: increment-decrement + - name: range + - name: receiver-naming + - name: time-naming + - name: unnecessary-stmt + - name: var-declaration + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - third_party$ + - builtin$ + - examples$ + - node_modules$ + +issues: + max-issues-per-linter: 0 + max-same-issues: 0 + +formatters: + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/CONFLICTS.md b/CONFLICTS.md new file mode 100644 index 0000000..3eb5777 --- /dev/null +++ b/CONFLICTS.md @@ -0,0 +1,32 @@ +# Conflicts / Remaining Issues + +1. **God interface (`AnimeService`)** + - `internal/domain/anime.go` still defines a large `AnimeService` interface (catalog + discover + search + details + staff/stats/reviews). + - Needs to be split into smaller interfaces (ISP) and rewired through handlers/services. + +2. **Domain layer still leaks external models** + - While `domain.User` and `domain.Anime` are now real types, many other domain types are still direct aliases to integration/DB types (e.g. `Genre`, `Recommendation`, etc. in `internal/domain/anime.go`). + - Goal is a stable domain model that does not break if Jikan/DB structs change. + +3. **No real DB transactions for multi-write operations** + - Multi-step writes (e.g. playback completion / watchlist updates) still do not run inside a database transaction. + - Errors are no longer swallowed in several places, but atomicity is still not guaranteed. + +4. **DiceBear URL duplication** + - Default avatar URL logic is duplicated in `cmd/user/main.go` and `internal/database/migrations/016_add_avatar_url.sql`. + - Needs centralization (or migration updated to match single source of truth). + +5. **AllAnime package-level shared HTTP client** + - `integrations/playback/allanime/client.go` still has a package-level mutable `http.Client` (`allAnimeUTLSClient`). + - Should be instance-owned or injected to avoid cross-test/env coupling. + +6. **Regex-based parsing of upstream JSON-ish responses** + - `integrations/playback/allanime/extractor.go` still parses provider responses using regex. + - Should be replaced with real JSON decoding (or a more robust parser) where possible. + +7. **Template duplication / drift risk** + - `templates/watchlist.gohtml` and `templates/watchlist_partial.gohtml` are still separate with overlapping markup. + - Inline JS was removed, but the duplication itself remains and can still drift. + +8. **Remaining handler consistency** + - Some modules still have duplicated user extraction patterns and could be unified (e.g. `currentUser()` helper usage beyond playback). diff --git a/Dockerfile b/Dockerfile index 75d050f..659a03b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,14 +5,22 @@ WORKDIR /app # Enable CGO for sqlite3 ENV CGO_ENABLED=1 -# Install sqlc for code generation -RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@v1.30.0 +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + unzip \ + gcc \ + libc6-dev \ + libsqlite3-dev \ + && rm -rf /var/lib/apt/lists/* -# Install build dependencies for bun + assets -RUN apt-get update && apt-get install -y ca-certificates sqlite3 curl unzip && rm -rf /var/lib/apt/lists/* +# Install bun (for building frontend assets) RUN curl -fsSL https://bun.sh/install | bash ENV PATH="/root/.bun/bin:${PATH}" +# Install sqlc for code generation +RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@v1.30.0 + ENV GOPROXY=direct COPY go.mod go.sum ./ RUN go mod download @@ -50,7 +58,7 @@ COPY --from=builder /app/templates ./templates COPY --from=builder /app/static ./static COPY --from=builder /app/dist ./dist COPY --from=builder /app/internal/database/migrations ./migrations -COPY docker/entrypoint.sh ./entrypoint.sh +COPY entrypoint.sh ./entrypoint.sh EXPOSE 3000 diff --git a/README.md b/README.md index 373f26e..3c2ac55 100644 --- a/README.md +++ b/README.md @@ -1,136 +1,53 @@ # MyAnimeList -
|
- |
-
- MyAnimeList - My personal anime tracker, built because nothing else felt right. - |
-
+
+
-
+
{{if $anime.Synopsis}}{{$anime.Synopsis}}{{else}}No synopsis available.{{end}}
{{if and $anime.Synopsis (gt (len $anime.Synopsis) 400)}} -