Pantry

emits.js 185 lines

Files · 8
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185export const emits = [
  {
    name: "product-added",
    description: "A product was added to the pantry catalog.",
    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: ["id", "name"],
      additionalProperties: false,
    },
  },
  {
    name: "stock-added",
    description: "A new stock lot was purchased or imported.",
    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: ["id", "product_id", "amount", "stock_id", "open"],
      additionalProperties: false,
    },
  },
  {
    name: "stock-consumed",
    description:
      "Some quantity from a stock lot was consumed; amount is the positive quantity used, not the remaining balance.",
    schema: {
      type: "object",
      properties: {
        product_id: {
          type: "integer",
          description: "Product identifier.",
        },
        stock_id: {
          type: "string",
          description:
            "Stable opaque stock-entry identifier for its lifetime; local entries receive a local- prefix.",
        },
        amount: {
          type: "number",
          description:
            "Stock amount in the product stock quantity unit; may be fractional.",
          exclusiveMinimum: 0,
        },
        note: {
          type: ["string", "null"],
          description: "Stock-entry note.",
        },
      },
      required: ["product_id", "stock_id", "amount"],
      additionalProperties: false,
    },
  },
  {
    name: "stock-opened",
    description: "A stock lot was opened.",
    schema: {
      type: "object",
      properties: {
        id: {
          type: "integer",
          description: "Stock-entry row identifier; distinct from stock_id.",
        },
        product_id: {
          type: "integer",
          description: "Product identifier.",
        },
        stock_id: {
          type: "string",
          description:
            "Stable opaque stock-entry identifier for its lifetime; local entries receive a local- prefix.",
        },
        opened_date: {
          type: ["string", "null"],
          description: "Opening date in YYYY-MM-DD.",
          pattern: "^\\d{4}-\\d{2}-\\d{2}$",
        },
        open: {
          type: "integer",
          description: "Grocy open integer flag: 0 unopened, 1 opened.",
          enum: [0, 1],
          const: 1,
        },
      },
      required: ["product_id", "stock_id", "open"],
      additionalProperties: false,
    },
  },
];