Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/AndrewwCO/Panahashi-Backend/llms.txt

Use this file to discover all available pages before exploring further.

The Promotions API lets bakers offer discounts on their products. Three promotion types are supported: percentage off, fixed amount off, and happy-hour (percentage discount active only within a specified time window). Customers apply a promotion at order creation by passing promotionId.

Promotion types

TypeRequired fieldsDescription
PERCENTAGEdiscountPct (1–100)Percentage off the order or product total
FIXED_AMOUNTdiscountAmount (> 0)Fixed currency amount off
HAPPY_HOURhappyHourStart, happyHourEnd, discountPctPercentage off, active only during specified hours

Promotion object

id
string
Unique promotion ID.
bakeryId
string
Owning bakery ID.
productId
string
If set, discount applies only to this product. Empty string = order-wide.
title
string
Promotion title shown to customers.
description
string
Optional description.
type
string
PERCENTAGE, FIXED_AMOUNT, or HAPPY_HOUR.
discountPct
number
Percentage discount (1–100). Used for PERCENTAGE and HAPPY_HOUR types.
discountAmount
number
Fixed discount amount. Used for FIXED_AMOUNT type.
happyHourStart
string
Start time in HH:mm format (HAPPY_HOUR only).
happyHourEnd
string
End time in HH:mm format (HAPPY_HOUR only).
active
boolean
Whether this promotion is currently active.
createdAt
integer
Creation epoch ms.

GET /api/v1/promotions

Returns active promotions for a bakery. Public endpoint. Auth required: No
bakeryId
string
required
ID of the bakery.
curl "http://localhost:8080/api/v1/promotions?bakeryId=bak001"

GET /api/v1/promotions/me

Returns all promotions (including inactive) for the baker’s bakery. Auth required: Yes — BAKER
curl -H "Authorization: Bearer <token>" \
  http://localhost:8080/api/v1/promotions/me

POST /api/v1/promotions

Creates a new promotion for the baker’s bakery. Auth required: Yes — BAKER
title
string
required
Promotion title.
description
string
Optional description.
type
string
required
Promotion type.
productId
string
Target product ID. Omit for order-wide discount.
discountPct
number
Required for PERCENTAGE and HAPPY_HOUR (1–100).
discountAmount
number
Required for FIXED_AMOUNT (must be > 0).
happyHourStart
string
Start time HH:mm. Required for HAPPY_HOUR.
happyHourEnd
string
End time HH:mm. Required for HAPPY_HOUR.
curl -X POST \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"title":"10% off mornings","type":"HAPPY_HOUR","discountPct":10,"happyHourStart":"07:00","happyHourEnd":"10:00"}' \
  http://localhost:8080/api/v1/promotions

PATCH /api/v1/promotions//toggle

Toggles a promotion active or inactive. Auth required: Yes — BAKER
id
string
required
Promotion ID.
curl -X PATCH \
  -H "Authorization: Bearer <token>" \
  http://localhost:8080/api/v1/promotions/promo001/toggle

DELETE /api/v1/promotions/

Deletes a promotion. Baker must own the promotion’s bakery. Auth required: Yes — BAKER
id
string
required
Promotion ID.
curl -X DELETE \
  -H "Authorization: Bearer <token>" \
  http://localhost:8080/api/v1/promotions/promo001

Build docs developers (and LLMs) love