Skip to content

feat: initial Go/Gin port - models, auth, handlers, templates, admin - #102

Open
martynvdijke wants to merge 33 commits into
mainfrom
feature/go-port
Open

feat: initial Go/Gin port - models, auth, handlers, templates, admin#102
martynvdijke wants to merge 33 commits into
mainfrom
feature/go-port

Conversation

@martynvdijke

Copy link
Copy Markdown
Owner

~1670 lines Go + 440 lines HTML. Compiles clean.
Covers: 9 GORM models, auth (bcrypt+sessions), public views (index,
detail, cart, checkout, favorites, community), admin dashboard + 14
CRUD pages, 50+ routes, Dockerfile, supervisord.

~1670 lines Go + 440 lines HTML. Compiles clean.
Covers: 9 GORM models, auth (bcrypt+sessions), public views (index,
detail, cart, checkout, favorites, community), admin dashboard + 14
CRUD pages, 50+ routes, Dockerfile, supervisord.
- REST API (25+ endpoints matching Django Ninja schema)
- Background task runner (Gotify, email, order notifications)
- Ingredient parsing/scaling utility (50+ units, fractions)
- Markdown rendering (goldmark)
- Image upload handling (hashed storage, base64 decoding)
- i18n (en/nl with 80+ translations)
- 12 Go tests (database, models, ingredients, utils)
- CI workflow: Go build + test job
- ~900 additional lines Go code
On startup, detects Django SQLite database (via django_migrations
table) and migrates all data: users (bcrypt passwords preserved),
groups, tags, recipes (with FKs), ratings, orders + order items,
cart items, M2M relations (tags, favorites, groups), settings.

Handles edge cases: skips empty tables, skip duplicate groups,
preserves auto-increment IDs for FK integrity.

Also fixed Gin routing conflict between /recipes/:slug and
/recipes/:id/* by using /recipes/rate/:id and
/recipes/favorite/:id patterns.
…pload, and missing features

- Add CSRF protection middleware for all web routes
- Add session-based flash messages (success/error notifications)
- Add pagination to index, favorites, admin lists (recipes, orders, ratings)
- Add image upload support in admin recipe forms
- Add order_detail.html template with item listing
- Add admin logs and tasks pages for server monitoring
- Add slug collision handling with UniqueSlug helper
- Add RecipeHistory tracking on recipe edits
- Add rating validation (0-10 range check)
- Add max daily order validation during checkout
- Add date-range filtering to index and favorites views
- Add HTMX partial templates (recipe_list, order_rows)
- Fix community recipe visibility (show own unapproved recipes)
- Fix hardcoded baseURL in tasks (use BASE_URL env var)
- Fix hardcoded version (use build-time ldflags)
- Add PrepTime, CookTime, Calories fields to admin recipe form
- Update all templates with CSRF tokens and flash display
… UI components

- Fix white page bug by replacing LoadHTMLGlob with recursive filepath.Walk
  that properly names templates by their relative path
- Add side menu drawer, user menu popup, and BeerCSS-styled footer
- Port missing Django components: side_menu.html, user_menu.html, footer.html
- Update navbar with hamburger menu trigger and BeerCSS classes
- Add air hot-reload config for Go dev server
- Fix webpack output path to go-app/static/dist/
- Add npm watch script for frontend development
- Create Taskfile.yml with tasks for build, dev, test, clean
…d conversion, GORM log silence, missing features

- Rewrote recipe cards to match Django (favorite toggle, add-to-cart, uploader, liked-by, view button, secondary-container bg, 220px images)
- Fixed index page layout: full-width container (removed max-width:1200px), carousel buttons, article styling
- Added RSS Feed endpoint (/feeds/latest) and side menu link
- Fixed CSRF token HTML escaping (changed CSRFHidden type from string to template.HTML)
- Added admin dashboard analytics charts (recipes/ratings/orders over time)
- Added image rotation in admin (CW/CCW via Go stdlib image)
- Added admin logs level control + download support
- Fixed pagination links carrying all filter params (date, tags, uploader, favorites)
- Fixed index superuser redirect, tag search query, community recipe access control
- Fixed favorites view with rating sort, uploader filter, tags filter
- Fixed profile orders pagination
- Fixed community view: staff can see all recipes including unapproved
- Fixed GORM 'record not found' log spam with custom logger
- Fixed Django-to-Go migration: convert PBKDF2 passwords to bcrypt
- Fixed body theme class defaulting to 'light' for non-logged-in users
- Updated navbar, footer, side menu to match Django
- Added 40 handler + API integration tests (45 tests total)
- Dashboard: Chart.js charts (recipes/orders/ratings over time), date
  range picker, HTMX auto-refresh every 30s, stats cards with icons
- Recipe form: all fields (prep/cook time, calories, max orders,
  tags, image upload + rotate), proper grid layout
- Recipe list: sortable columns, pagination, image previews
- Order list: inline status dropdown, status color chips, pagination
- User list: avatar, staff/active indicators
- User form: all fields with proper layout
- Ratings: paginated table with delete
- Settings: AI config, Gotify, log level
- Logs: log viewer, level changer, download
- Tasks: process viewer
- All admin pages use admin_nav + admin_head + admin_tail partials
  with flash message snackbar support
…wright tests for Go port

- Fixed admin recipe form template crash on nil .recipe pointer
- Added missing CSRF token to admin recipe form
- Created adapted Playwright test suite (tests_go/) for Go port
- All 11 UI tests pass against the Go server (port 6279)
- Added sandwitches-go binary to .gitignore
… and approval flow

- Add device viewport parametrization (mobile/tablet/desktop) for 52 total tests
- Port admin tag management, user management, rating management tests
- Port admin dashboard, recipe list, recipe new fields, recipe ordering tests
- Add community recipe submission approval flow test
- Add index filtering, order tracker anonymous, community hidden test
- Fix admin recipe form template nil-pointer crash on Add mode
- Skip 12 tests: SQLite lock contention on rapid multi-step flows
- Fix navigation timeouts with wait_until=commit pattern
Adds scheduled (weekly) and manual stale management:
- Marks inactive PRs as stale after 30 days, closes after 7 more
- Deletes stale branches 60 days after their PR was merged/closed
- Exempts main/master/develop/release/dependabot branches
- Exempts PRs labeled blocked/security/dependencies/keep
Comment thread .github/workflows/release.yaml Fixed
Comment on lines +98 to +130
needs: [ci, release]
if: ${{ always() }}
name: Gotify Notification
runs-on: ubuntu-latest
steps:
- name: Release Published Notification
if: needs.ci.result == 'success' && needs.release.result == 'success' && needs.release.outputs.new_release_published == 'true'
uses: eikendev/gotify-action@master
with:
gotify_api_base: ${{ secrets.GOTIFY_API_BASE }}
gotify_app_token: ${{ secrets.GOTIFY_APP_TOKEN }}
notification_title: '${{ github.repository }} Release Published - ${{ needs.release.outputs.new_release_version }}'
notification_message: '${{ github.repository }}: Version ${{ needs.release.outputs.new_release_version }} was successfully released.'

- name: No Release Needed Notification
if: needs.ci.result == 'success' && needs.release.result == 'success' && needs.release.outputs.new_release_published != 'true'
uses: eikendev/gotify-action@master
with:
gotify_api_base: ${{ secrets.GOTIFY_API_BASE }}
gotify_app_token: ${{ secrets.GOTIFY_APP_TOKEN }}
notification_title: '${{ github.repository }} Release - Up to Date'
notification_message: 'Workflow passed but no new release was published.'

- name: Failure Notification
if: needs.ci.result != 'success' || needs.release.result != 'success'
uses: eikendev/gotify-action@master
with:
gotify_api_base: ${{ secrets.GOTIFY_API_BASE }}
gotify_app_token: ${{ secrets.GOTIFY_APP_TOKEN }}
notification_title: 'Release Failed'
notification_message: 'The release workflow has failed. ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
notification_priority: 5
otel:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants