Skip to content

The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.

645 B
Raw Blame
import { model } from "@medusajs/framework/utils"

import Offer from "./offer"

const OfferCondition = model
  .define("OfferCondition", {
    id: model.id({ prefix: "ofcond" }).primaryKey(),
    code: model.text().searchable(),
    label: model.text().searchable(),
    is_active: model.boolean().default(true),
    rank: model.number().default(0),
    metadata: model.json().nullable(),
    offers: model.hasMany(() => Offer, { mappedBy: "condition" }),
  })
  .indexes([
    {
      name: "IDX_offer_condition_code_unique",
      on: ["code"],
      unique: true,
      where: "deleted_at IS NULL",
    },
  ])

export default OfferCondition