Skip to main content

Takeaway Offers

This section documents the takeaway offer endpoints of the MiseOS API.

After lunch service, head chefs and sous chefs can publish leftover portions as takeaway offers. Customers can browse available offers and place orders through the order endpoints.

Each offer is linked to a dish from the dish bank and tracks the number of offered and remaining portions. When all portions are sold, the offer is automatically marked as sold out and disabled.


Takeaway offer lifecycle
#

stateDiagram-v2
    [*] --> ENABLED : offer created (after 12:00)

    ENABLED --> DISABLED : manually disabled
    DISABLED --> ENABLED : re-enabled

    ENABLED --> SOLD_OUT : all portions sold
    SOLD_OUT --> [*] : offer closed

One offer per dish per day is allowed. Offers can only be created after 12:00.


Takeaway Offer Endpoints
#

MethodURLAuth
GET/takeaway/offersANYONE
GET/takeaway/offers/{id}ANYONE
POST/takeaway/offersHEAD_CHEF, SOUS_CHEF
PUT/takeaway/offers/{id}HEAD_CHEF, SOUS_CHEF
PATCH/takeaway/offers/{id}/enableHEAD_CHEF, SOUS_CHEF
PATCH/takeaway/offers/{id}/disableHEAD_CHEF, SOUS_CHEF
DELETE/takeaway/offers/{id}HEAD_CHEF, SOUS_CHEF

TakeAwayOffer response object
#

The take away offer object contains the following fields:

{
  "id": 1,
  "enabled": true,
  "soldOut": false,
  "offeredPortions": 20,
  "availablePortions": 14,
  "price": 65.00,
  "dish": {
    "id": 3,
    "nameDA": "Boller i karry"
  },
  "createdBy": {
    "id": 1,
    "firstName": "Gordon",
    "lastName": "Ramsay"
  },
  "createdAt": "2026-04-09",
  "updatedAt": "2026-04-09 13:15"
}

GET /takeaway/offers
#

Returns all offers with optional filters. Available to anyone — no token required.

Query parameters

ParameterTypeDescription
dateLocalDateFilter by offer date (yyyy-MM-dd)
enabledBooleanFilter by enabled status
soldOutBooleanFilter by sold out status
dishIdLongFilter by specific dish

Example Request
#

curl "https://miseos.corral.dk/api/v1/takeaway/offers?enabled=true&soldOut=false"

Response 200 — array of TakeAwayOffer objects:

[
    {
      "id": 1,
      "enabled": true,
      "soldOut": false,
      "offeredPortions": 20,
      "availablePortions": 14,
      "price": 65.00,
      "dish": {
        "id": 3,
        "nameDA": "Boller i karry"
      },
      "createdBy": {
        "id": 1,
        "firstName": "Gordon",
        "lastName": "Ramsay"
      },
      "createdAt": "2026-04-09",
      "updatedAt": "2026-04-09 13:15"
    },
    {
      "id": 2,
      "enabled": true,
      "soldOut": false,
      "offeredPortions": 35,
      "availablePortions": 17,
      "price": 65.00,
      "dish": {
        "id": 7,
        "nameDA": "Stegt flæsk"
      },
      "createdBy": {
        "id": 2,
        "firstName": "Jamie",
        "lastName": "Oliver"
      },
      "createdAt": "2026-04-09",
      "updatedAt": "2026-04-09 13:20"
    }
]

GET /takeaway/offers/{id}
#

Returns a single offer by ID. Available to anyone.

Example Request
#

curl https://miseos.corral.dk/api/v1/takeaway/offers/1

Response 200TakeAwayOffer object.

Errors

StatusCause
400Invalid ID
404Offer not found

POST /takeaway/offers
#

Creates a new takeaway offer for today’s service.

Domain rules:

  • Offers can only be created after 12:00
  • Only one offer per dish per day is allowed
  • The dish must be active in the dish bank

Request body

{
  "dishId": 3,
  "offeredPortions": 20,
  "price": 65.00
}

Example Request
#

curl -X POST \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"dishId": 3, "offeredPortions": 20, "price": 65.00}' \
  https://miseos.corral.dk/api/v1/takeaway/offers

Response 201 — created TakeAwayOffer object.

Errors

StatusCause
400Invalid input — missing or invalid field
404Dish not found
409Offer creation before 12:00
409An offer for this dish already exists today

PUT /takeaway/offers/{id}
#

Updates an existing offer. Useful to correct portions or price before orders are placed.

Domain rules:

  • Portions cannot be set below already sold quantity

Request body

{
  "dishId": 3,
  "offeredPortions": 25,
  "price": 60.00
}

Response 200 — updated TakeAwayOffer object.

Errors

StatusCause
400Invalid input
404Offer or dish not found
409New portions below already sold quantity

PATCH /takeaway/offers/{id}/enable
#

Re-enables a disabled offer, making it visible and orderable again.

Cannot enable a sold out offer.

Example Request
#

curl -X PATCH \
  -H "Authorization: Bearer <token>" \
  https://miseos.corral.dk/api/v1/takeaway/offers/1/enable

Response 200 — updated TakeAwayOffer object with enabled: true.

Errors

StatusCause
404Offer not found
409Offer is sold out and cannot be re-enabled

PATCH /takeaway/offers/{id}/disable
#

Disables an active offer, hiding it from customers without deleting it.

Example Request
#

curl -X PATCH \
  -H "Authorization: Bearer <token>" \
  https://miseos.corral.dk/api/v1/takeaway/offers/1/disable

Response 200 — updated TakeAwayOffer object with enabled: false.


DELETE /takeaway/offers/{id}
#

Permanently deletes an offer.

Offers that have active or completed orders cannot be deleted.

Response 204 — no content.

Errors

StatusCause
404Offer not found
409Offer has existing orders and cannot be deleted