Skip to content

Admin restaurant apis - #21

Merged
laithanhhung merged 4 commits into
devfrom
admin-restaurant-apis
Jul 24, 2026
Merged

Admin restaurant apis#21
laithanhhung merged 4 commits into
devfrom
admin-restaurant-apis

Conversation

@laithanhhung

@laithanhhung laithanhhung commented Jul 24, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Added a restaurant profile page for viewing and editing business details, including pickup hours and validation.
    • Enhanced admin management for restaurants, markets, products, categories, users, credits, and analytics.
    • Added market-agent assignment, credit statements, PDF export, filtering, sorting, expandable details, and image uploads.
    • Added restaurant-only profile navigation and improved responsive sidebar behavior.
  • Bug Fixes

    • Improved localized API error messages and field-level validation feedback.
    • Updated deployment caching behavior to ensure new releases load correctly.
    • Added accent-insensitive search support, including Vietnamese text.

laithanhhung and others added 4 commits July 23, 2026 19:51
…e image

Deployed builds rendered raw i18n keys (`admin.categories.map.open`) beside
strings that translated fine. The file on the server was correct — the browser
was reusing an old copy of it.

nginx set no Cache-Control at all, so browsers fell back to guessing a lifetime
from Last-Modified. Angular fingerprints its JS/CSS, so those always refreshed;
`i18n/vi.json` is fetched from a fixed path, so a stale copy could sit in the
cache for hours. New code, previous deploy's strings. index.html had the same
exposure, which pins the whole app to an older bundle.

Caching is now stated rather than guessed: fingerprinted JS/CSS immutable for a
year, index.html and /i18n/ revalidated on every request (the ETag makes that a
304 with no body), other unhashed assets a day.

Also repairs the deploy path for the required API_BASE_URL introduced in the
previous commit. `.dockerignore` did not exclude `.env`, so an image would
either bake real config into a layer or — with no file in the CI context — fail
the build. `.env` is now out of the build context and the values arrive as
build args, which `generate-env.mjs` already prefers over any file. They are set
only in the discarded builder stage, so they do not reach the final image's
metadata.

Verified against a real image: nginx config passes `nginx -t`; a build without
API_BASE_URL fails with the fix in the message; a build with args bakes the
values into the bundle, serves the intended Cache-Control per path, and leaks
nothing into `docker history`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Restaurant onboarding (M2, /profile), spec-driven under
specs/001-restaurant-onboarding:
- self-service business-profile page: name/address/contact/receiving-window
  form with cross-field window validation, approval-status gate, save toasts
- lazy /profile route (restaurant-gated), storefront nav item, wired user menu

Admin > Restaurants -- surface RestaurantCredit endpoints that had no UI:
- credit statements list + monthly statement generation + PDF download
- credit transactions ledger

Admin > Categories:
- status (active/inactive) filter and a shared "clear all filters" button on
  the config-driven CRUD screen

Backend rejection surfacing:
- shared apiErrorMessage now reads the reason from BOTH the typed ApiError
  subclasses (401/403/5xx) and the generated ResponseError (4xx); wired into
  the admin CRUD screen and the restaurant profile form so permission/
  validation/conflict reasons show in the toast instead of a generic message

Contract:
- add PATCH /categories/{id}/activate to the generated client and use it for
  category reactivate (replacing the ignored PUT+isActive workaround); refresh
  the openapi.json snapshot
- fix stale ignore paths (src/api -> src/contract) in .prettierignore and
  eslint.config.js so the generated client/spec are excluded as intended

Verified: lint, prettier, 53 unit tests, production build all green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Align admin lists with the Fuse inventory pattern, move market-agent assignment onto markets, and wire restaurant approve/suspend/credit actions into the restaurants detail flow. Ignore the local Fuse demo folder.

Co-authored-by: Cursor <cursoragent@cursor.com>
@laithanhhung
laithanhhung merged commit 3f7e91d into dev Jul 24, 2026
0 of 3 checks passed
@kody-ai

kody-ai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Code Review Could Not Complete ⚠️

The review failed before suggestions could be generated.

Reason: The configured API key (google_gemini) is out of credits or has hit its billing limit. Top up the account or adjust the plan.

After fixing the issue, comment @kody review on this PR to re-run the review.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug
Performance
Security
Business Logic

Access your configuration settings here.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 71a07766-f083-4e71-8700-38be2ba44081

📥 Commits

Reviewing files that changed from the base of the PR and between 4e3212b and 32b5bb6.

⛔ Files ignored due to path filters (1)
  • src/contract/generated/apis/CategoriesApi.ts is excluded by !**/generated/**
📒 Files selected for processing (78)
  • .dockerignore
  • .gitignore
  • .prettierignore
  • .specify/feature.json
  • CLAUDE.md
  • Dockerfile
  • eslint.config.js
  • nginx.conf
  • public/i18n/en.json
  • public/i18n/vi.json
  • scripts/generate-env.mjs
  • specs/001-restaurant-onboarding/checklists/requirements.md
  • specs/001-restaurant-onboarding/contracts/restaurant-profile-api.md
  • specs/001-restaurant-onboarding/data-model.md
  • specs/001-restaurant-onboarding/plan.md
  • specs/001-restaurant-onboarding/quickstart.md
  • specs/001-restaurant-onboarding/research.md
  • specs/001-restaurant-onboarding/spec.md
  • specs/001-restaurant-onboarding/tasks.md
  • src/app/app.routes.ts
  • src/app/core/api/envelope.spec.ts
  • src/app/core/api/envelope.ts
  • src/app/core/api/error-codes.spec.ts
  • src/app/core/api/error-codes.ts
  • src/app/core/api/validators.spec.ts
  • src/app/core/api/validators.ts
  • src/app/core/navigation/navigation.data.ts
  • src/app/core/util/text-search.spec.ts
  • src/app/core/util/text-search.ts
  • src/app/layout/common/user/user.component.html
  • src/app/layout/common/user/user.component.ts
  • src/app/layout/layout.component.html
  • src/app/layout/layout.component.ts
  • src/app/layout/layouts/vertical/classic/classic.component.html
  • src/app/layout/layouts/vertical/classic/classic.component.ts
  • src/app/layout/layouts/vertical/dense/dense.component.html
  • src/app/layout/layouts/vertical/dense/dense.component.ts
  • src/app/modules/admin/admin.routes.ts
  • src/app/modules/admin/admin.service.ts
  • src/app/modules/admin/admin.types.ts
  • src/app/modules/admin/analytics/analytics-dashboard.component.html
  • src/app/modules/admin/analytics/analytics-dashboard.component.ts
  • src/app/modules/admin/catalog/catalog-admin.service.ts
  • src/app/modules/admin/catalog/categories.component.ts
  • src/app/modules/admin/catalog/category-map.component.ts
  • src/app/modules/admin/catalog/market-products.component.html
  • src/app/modules/admin/catalog/markets.component.html
  • src/app/modules/admin/catalog/markets.component.ts
  • src/app/modules/admin/catalog/products.component.html
  • src/app/modules/admin/catalog/products.component.ts
  • src/app/modules/admin/catalog/units.component.ts
  • src/app/modules/admin/logistics/hub-staff.component.ts
  • src/app/modules/admin/order-groups/order-groups.component.html
  • src/app/modules/admin/order-groups/order-groups.component.ts
  • src/app/modules/admin/restaurants/restaurants-admin.component.html
  • src/app/modules/admin/restaurants/restaurants-admin.component.ts
  • src/app/modules/admin/settings/settings.component.html
  • src/app/modules/admin/settings/settings.component.ts
  • src/app/modules/admin/shared/resource-crud.component.html
  • src/app/modules/admin/shared/resource-crud.component.ts
  • src/app/modules/admin/shared/resource-crud.types.ts
  • src/app/modules/admin/users/user-detail.component.html
  • src/app/modules/admin/users/user-detail.component.ts
  • src/app/modules/admin/users/users-list.component.html
  • src/app/modules/admin/users/users-list.component.ts
  • src/app/modules/restaurant/business-profile/business-profile-form.component.html
  • src/app/modules/restaurant/business-profile/business-profile-form.component.ts
  • src/app/modules/restaurant/business-profile/pickup-window.validator.spec.ts
  • src/app/modules/restaurant/business-profile/pickup-window.validator.ts
  • src/app/modules/restaurant/profile.component.html
  • src/app/modules/restaurant/profile.component.scss
  • src/app/modules/restaurant/profile.component.ts
  • src/app/modules/restaurant/profile.routes.ts
  • src/app/modules/restaurant/restaurant-profile.service.spec.ts
  • src/app/modules/restaurant/restaurant-profile.service.ts
  • src/app/modules/restaurant/restaurant-profile.types.ts
  • src/contract/openapi.json
  • src/styles/styles.scss

📝 Walkthrough

Walkthrough

A restaurant self-service profile flow, expanded admin management screens, centralized API error localization, responsive layout updates, and Docker/nginx configuration changes were added. New specifications, translations, validators, services, routes, and UI workflows accompany the changes.

Changes

Restaurant onboarding

Layer / File(s) Summary
Specification and implementation plan
specs/001-restaurant-onboarding/*, .specify/feature.json, CLAUDE.md
Defines the restaurant profile scope, contracts, data model, tasks, validation rules, and implementation sequence.
Profile service and form
src/app/modules/restaurant/*, src/app/app.routes.ts, src/app/core/navigation/navigation.data.ts, src/app/layout/common/user/*, public/i18n/*.json
Adds the lazy /profile route, restaurant role guard, signal-backed profile service, business profile form, pickup-window validation, and bilingual strings.

Admin workspace

Layer / File(s) Summary
Admin API workflows
src/app/modules/admin/admin.service.ts, src/app/modules/admin/admin.types.ts, src/app/modules/admin/catalog/catalog-admin.service.ts
Adds market-agent assignment, credit statements and transactions, statement generation/PDF retrieval, and dedicated category activation.
Catalog and shared CRUD
src/app/modules/admin/catalog/*, src/app/modules/admin/shared/*
Replaces several resource-driven screens with searchable grids, inline details, dialogs, filtering, pagination, image upload, location editing, and localized errors.
Users, restaurants, and analytics
src/app/modules/admin/users/*, src/app/modules/admin/restaurants/*, src/app/modules/admin/analytics/*
Adds inline user and restaurant workflows, restaurant creation and credit actions, ApexCharts dashboards, and updated admin translations.

Platform and delivery

Layer / File(s) Summary
Shared API and validation utilities
src/app/core/api/*, src/app/core/util/*
Adds normalized API error parsing/localization, password and phone validators, accent-insensitive search helpers, and tests.
Navigation and layout behavior
src/app/layout/*, src/app/core/navigation/navigation.data.ts, src/styles/styles.scss
Synchronizes responsive sidebar state, removes unused layout controls, adds profile navigation, and adjusts admin search styling.
Build and runtime configuration
.dockerignore, .gitignore, .prettierignore, Dockerfile, eslint.config.js, nginx.conf, scripts/generate-env.mjs, src/contract/openapi.json
Updates environment exclusions, required Docker build arguments, generated-contract paths, nginx caching rules, missing-config guidance, and OpenAPI formatting.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

Poem

A bunny hops through forms so neat,
With profile fields and charts to greet.
Errors bloom in translated light,
Sidebars fold just right.
Docker guards the secrets tight—
Fresh admin screens now shine bright!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch admin-restaurant-apis

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Trivy (0.72.0)

Trivy execution failed: 2026-07-24T00:14:20Z FATAL Fatal error run error: fs scan error: scan error: scan failed: failed analysis: post analysis error: post analysis error: helm scan error: fs filter error: fs filter error: walk error range error: stat .coderabbit-oasdiff.yaml: no such file or directory: range error: stat .coderabbit-oasdiff.yaml: no such file or directory


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot mentioned this pull request Aug 6, 2026
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.

1 participant