Pantry

listens.js 121 lines

Files · 8
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121export const listens = [
  {
    name: "add-product",
    description:
      "Create a pantry product. Purchase and stock quantity units may differ.",
    schema: {
      type: "object",
      properties: {
        id: {
          type: "integer",
          description: "Product identifier; generated locally when omitted.",
        },
        name: {
          type: "string",
          description: "Product name.",
        },
        description: {
          type: ["string", "null"],
          description: "Product description.",
        },
        location_id: {
          type: ["integer", "null"],
          description: "Default storage location ID.",
        },
        qu_id_purchase: {
          type: ["integer", "null"],
          description: "Purchase quantity-unit ID.",
        },
        qu_id_stock: {
          type: ["integer", "null"],
          description: "Stock quantity-unit ID; stock amounts use this unit.",
        },
        min_stock_amount: {
          type: "number",
          description: "Desired minimum amount in stock units.",
          minimum: 0,
        },
        default_best_before_days: {
          type: "integer",
          description: "Default shelf life in days.",
          minimum: 0,
        },
        default_best_before_days_after_open: {
          type: "integer",
          description: "Default shelf life after opening in days.",
          minimum: 0,
        },
        product_group_id: {
          type: ["integer", "null"],
          description: "Product group ID.",
        },
      },
      required: ["name"],
      additionalProperties: false,
    },
  },
  {
    name: "add-stock",
    description:
      "Add a new stock lot for an existing product. amount is in that product stock unit, not its purchase unit.",
    schema: {
      type: "object",
      properties: {
        id: {
          type: "integer",
          description: "Stock-entry row identifier; distinct from stock_id.",
        },
        product_id: {
          type: "integer",
          description: "Product identifier.",
        },
        location_id: {
          type: ["integer", "null"],
          description: "Storage location ID.",
        },
        amount: {
          type: "number",
          description:
            "Stock amount in the product stock quantity unit; may be fractional.",
          exclusiveMinimum: 0,
        },
        best_before_date: {
          type: ["string", "null"],
          description: "Best-before date in YYYY-MM-DD.",
          pattern: "^\\d{4}-\\d{2}-\\d{2}$",
        },
        purchased_date: {
          type: ["string", "null"],
          description: "Purchase date in YYYY-MM-DD.",
          pattern: "^\\d{4}-\\d{2}-\\d{2}$",
        },
        stock_id: {
          type: "string",
          description:
            "Stable opaque stock-entry identifier for its lifetime; local entries receive a local- prefix.",
        },
        price: {
          type: ["number", "null"],
          description:
            "Purchase price in the configured Grocy currency; no per-entry currency code.",
        },
        open: {
          type: "integer",
          description: "Grocy open integer flag: 0 unopened, 1 opened.",
          enum: [0, 1],
        },
        opened_date: {
          type: ["string", "null"],
          description: "Opening date in YYYY-MM-DD.",
          pattern: "^\\d{4}-\\d{2}-\\d{2}$",
        },
        note: {
          type: ["string", "null"],
          description: "Stock-entry note.",
        },
      },
      required: ["product_id", "amount"],
      additionalProperties: false,
    },
  },
];