Skip to content

[BE-09] Build RestaurantModule with CRUD endpoints - entity exists, module does not #267

Description

@Leothosine

Problem

src/modules/restaurant/restaurant.entity.ts defines the Restaurant entity but there is no RestaurantModule, RestaurantService, or RestaurantController. Restaurants can only be created as a side effect of user registration. There is no API to update restaurant info, change the URL slug, manage settings JSON, or support multi-location scenarios.

Proposed Solution

Create a complete RestaurantModule with the following endpoints, all scoped to the authenticated user's restaurantId from their JWT payload:

Method Path Description
GET /api/restaurant Get own restaurant info
PATCH /api/restaurant Update name, phone, email, WhatsApp
GET /api/restaurant/settings Get settings JSON blob
PATCH /api/restaurant/settings Merge-update settings JSON

Acceptance Criteria

  • Authenticated admin can fetch their own restaurant with GET /api/restaurant
  • PATCH /api/restaurant with a slug already used by another restaurant returns 409
  • Cross-restaurant data access returns 403 (restaurantId comes from JWT, not request body)
  • Slug validation rejects non-URL-safe characters (regex: /^[a-z0-9-]+$/)
  • Settings endpoint stores and returns arbitrary JSON without overwriting unrelated keys

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions