|
1
|
import { buildAllowedFields } from "@medusajs/medusa/api/store/utils/allowed-fields"; |
|
2
|
|
|
3
|
export const storeCreditAccountFields = [ |
|
4
|
"id", |
|
5
|
"currency_code", |
|
6
|
"customer_id", |
|
7
|
"*customer", |
|
8
|
"credits", |
|
9
|
"debits", |
|
10
|
"balance", |
|
11
|
"updated_at", |
|
12
|
"created_at", |
|
13
|
"metadata", |
|
14
|
]; |
|
15
|
|
|
16
|
export const storeCreditAccountScalarFields = [ |
|
17
|
"id", |
|
18
|
"code", |
|
19
|
"currency_code", |
|
20
|
"customer_id", |
|
21
|
"credits", |
|
22
|
"debits", |
|
23
|
"balance", |
|
24
|
"updated_at", |
|
25
|
"created_at", |
|
26
|
"metadata", |
|
27
|
]; |
|
28
|
|
|
29
|
export const accountTransactionScalarFields = [ |
|
30
|
"id", |
|
31
|
"amount", |
|
32
|
"type", |
|
33
|
"reference", |
|
34
|
"reference_id", |
|
35
|
"note", |
|
36
|
"metadata", |
|
37
|
"updated_at", |
|
38
|
"created_at", |
|
39
|
]; |
|
40
|
|
|
41
|
export const storeCreditAccountAllowedFields = buildAllowedFields( |
|
42
|
storeCreditAccountFields, |
|
43
|
storeCreditAccountScalarFields, |
|
44
|
["transactions"], |
|
45
|
accountTransactionScalarFields.map((field) => `transactions.${field}`) |
|
46
|
); |
|
47
|
|
|
48
|
export const retrieveStoreCreditAccountTransformQueryConfig = { |
|
49
|
defaults: storeCreditAccountFields, |
|
50
|
allowed: storeCreditAccountAllowedFields, |
|
51
|
isList: false, |
|
52
|
}; |
|
53
|
|
|
54
|
export const listStoreCreditAccountsTransformQueryConfig = { |
|
55
|
defaults: storeCreditAccountFields, |
|
56
|
allowed: storeCreditAccountAllowedFields, |
|
57
|
isList: true, |
|
58
|
}; |