1 import { model } from "@medusajs/framework/utils";
2 import { TransactionType } from "../../../types";
3 import storeCreditAccount from "./store-credit-account";
4
5 export default model.define(
6 { tableName: "store_credit_account_transaction", name: "AccountTransaction" },
7 {
8 id: model.id({ prefix: "sc_trx" }).primaryKey(),
9
10 amount: model.bigNumber(),
11 type: model.enum(TransactionType),
12 reference: model.text(),
13 reference_id: model.text(),
14 note: model.text().nullable(),
15
16 account: model.belongsTo(() => storeCreditAccount, {
17 mappedBy: "transactions",
18 }),
19
20 metadata: model.json().nullable(),
21 }
22 );