-
Notifications
You must be signed in to change notification settings - Fork 39
/
entity.beef-5.yaml
187 lines (179 loc) · 10.5 KB
/
entity.beef-5.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
cosmosType: ICosmos
entities:
# Account as per the defined schema, including corresponding collection/result.
# API route prefixed defined.
# Auto-implementing data access using Cosmos with Container 'Account', leveraging auto-mapping to a 'Model.Account'.
#
- { name: Account, text: Account, collection: true, collectionResult: true, webApiRoutePrefix: api/v1/banking/accounts, autoImplement: Cosmos, cosmosModel: Model.Account, cosmosContainerId: Accounts, webApiTags: [ Banking ],
properties: [
# Convention of Id property within entity.
# Reference as accountId otherwise (ArgumentName and JsonName).
# It is the PrimaryKey.
#
{ name: Id, argumentName: accountId, jsonName: accountId, primaryKey: true },
# Creation date should have no time associated; therefore, DateTimeTransform is set to DateOnly.
#
{ name: CreationDate, type: DateTime, dateTimeTransform: DateOnly },
{ name: DisplayName },
{ name: Nickname },
# Property is ReferenceData and as per the defined Type.
# For serialization the RefDataType is set to string; i.e. only the underlying code is serialized.
#
{ name: OpenStatus, type: ^OpenStatus },
{ name: IsOwned, type: bool },
{ name: MaskedNumber },
{ name: ProductCategory, type: ^ProductCategory },
{ name: ProductName }
],
operations: [
# Operation to get all Accounts for the user.
# No further route information defined.
# Supports filtering using defined properies from AccountArgs (the args will be validated (AccountArgsValidator) to ensure valid values are passed).
# Supports paging.
# Data access will be auto-implemented for Cosmos as defined for the entity.
#
{ name: GetAccounts, text: Get all accounts, type: GetColl, paging: true, webApiTags: [ ^, Accounts ],
parameters: [
{ name: Args, type: AccountArgs, validator: AccountArgsValidator }
]
},
# Operation to get all Accounts for the user with OData-like $filter.
# Supports paging.
# Data access will be auto-implemented for Cosmos as defined for the entity.
{ name: GetAccountsQuery, text: Get all accounts, type: GetColl, query: true, webApiRoute: query, paging: true, webApiTags: [ ^, Accounts ] },
# Operation to get the AccountDetail for a specified account.
# Operation attached to Account for logical grouping.
# Returns AccountDetail (the DataEntityMapper is overridden to ensure correct mapper is used).
# PrimaryKey="true" indicates that all properties marked as PrimaryKey are to be used for parameters (avoids having to explicitly define again).
# Route requires accountId; e.g. api/v1/banking/accounts/{accountId}
# Data access will be auto-implemented for Cosmos as defined for the entity.
#
{ name: GetDetail, text: 'Get {{AccountDetail}}', type: Get, returnType: AccountDetail, webApiRoute: '{accountId}', primaryKey: true, dataEntityMapper: AccountDetailData.CosmosMapper, cosmosContainerId: AccountDetails },
# Operation to get the Balance for a specified account.
# Operation attached to Account for logical grouping.
# Returns Balanace and no DataEntityMapper is required as implementing using custom logic.
# PrimaryKey="true" indicates that all properties marked as PrimaryKey are to be used for parameters (avoids having to explicitly define again).
# Route requires accountId; e.g. api/v1/banking/accounts/{accountId}/balance
# Data access logic cannot be auto-implemented.
#
{ name: GetBalance, text: 'Get {{Account}} {{Balance}}', type: Get, returnType: Balance, webApiRoute: '{accountId}/balance', primaryKey: true, autoImplement: None },
# Operation to get an Account statement _file_.
# Operation is 'Custom' to specifically override and manually implement data.
# ReturnType of FileContentResult (standard ASP.NET) is an IActionResult which will be returned as-is.
# PrimaryKey="true" indicates that all properties marked as PrimaryKey are to be used for parameters (avoids having to explicitly define again).
# WebApiProducesResponseType="none" indicates that the [ProducesResponseType()] attribute should not include the response type (also ensures that the Agent code does not include response type).
# WebApiProduces enables specification of the [Produces()] attribute and corresponding value(s) array.
#
{ name: GetStatement, text: 'Get {{Account}} statement (file)', type: Custom, primaryKey: true, returnType: FileContentResult?, webApiMethod: HttpGet, webApiRoute: '{accountId}/statement', webApiProducesResponseType: none, webApiProduces: [ text/plain ] }
]
}
# Specifying the arguments for the Account.GetAccounts; note usage of the JsonName to override the default query string parameter names.
# ExcludeAll ensures that only the corresponding Entity is generated; i.e. other layer artefacts are only required where an operation is being exposed.
#
- { name: AccountArgs, text: '{{Account}} arguments',
properties: [
{ name: ProductCategory, jsonName: 'product-category', type: ^ProductCategory },
{ name: OpenStatus, jsonName: 'open-status', type: ^OpenStatus },
{ name: IsOwned, jsonName: 'is-owned', type: bool? }
]
}
# As per the AccountDetail schema it inherits from Account and extends the properties (also inherits the data mapper).
#
- { name: AccountDetail, text: '{{Account}} Detail', inherits: Account, excludeData: RequiresMapper, cosmosMapperBase: AccountData, autoImplement: Cosmos, cosmosModel: Model.Account, cosmosContainerId: Account, cosmosValueContainer: true,
properties: [
{ name: Bsb },
{ name: AccountNumber },
{ name: BundleName },
{ name: SpecificAccountUType, type: ^AccountUType },
{ name: TermDeposit, type: TermDepositAccount, isEntity: true },
{ name: CreditCard, type: CreditCardAccount, isEntity: true }
]
}
# Remaining entities required as per defined schema.
#
- { name: TermDepositAccount, excludeData: RequiresMapper, cosmosModel: Model.TermDepositAccount,
properties: [
{ name: LodgementDate, type: DateTime, dateTimeTransform: DateOnly },
{ name: MaturityDate, type: DateTime, dateTimeTransform: DateOnly },
{ name: MaturityAmount, type: decimal },
{ name: MaturityCurrency },
{ name: MaturityInstructions, type: ^MaturityInstructions }
]
}
- { name: CreditCardAccount, excludeData: RequiresMapper, cosmosModel: Model.CreditCardAccount,
properties: [
{ name: MinPaymentAmount, type: decimal },
{ name: PaymentDueAmount, type: decimal },
{ name: PaymentCurrency },
{ name: PaymentDueDate, type: DateTime, dateTimeTransform: DateOnly }
]
}
- { name: Balance, excludeData: RequiresMapper, cosmosModel: Model.Balance,
properties: [
{ name: Id, jsonName: accountId, text: '{{Account}} identifier', primaryKey: true, cosmosMapper: Ignore },
{ name: CurrentBalance, type: decimal, serializationAlwaysInclude: true },
{ name: AvailableBalance, type: decimal, serializationAlwaysInclude: true },
{ name: CreditLimit, type: decimal },
{ name: AmortisedLimit, type: decimal },
{ name: Currency },
{ name: Purses, type: BalancePurseCollection, isEntity: true }
]
}
- { name: BalancePurse, collection: true, excludeData: RequiresMapper, cosmosModel: Model.BalancePurse,
properties: [
{ name: Amount, type: decimal },
{ name: Currency }
]
}
# Account as per the defined schema, including corresponding collection/result.
# API route prefixed defined (note same as Account to ensure correct API surface).
# Auto-implementing data access using Cosmos with Container 'Transaction', leveraging auto-mapping to a 'Model.Transaction'.
#
- { name: Transaction, text: Transaction, collection: true, collectionResult: true, webApiRoutePrefix: api/v1/banking/accounts, autoImplement: Cosmos, cosmosModel: Model.Transaction, cosmosContainerId: Transactions,
properties: [
{ name: Id, jsonName: transactionId, text: '{{Account}} identifier', primaryKey: true, dataAutoGenerated: false },
{ name: AccountId },
{ name: IsDetailAvailable, type: bool },
{ name: Type, type: ^TransactionType },
{ name: Status, type: ^TransactionStatus },
{ name: Description },
{ name: PostingDateTime, type: DateTime },
{ name: ExecutionDateTime, type: DateTime },
{ name: Amount, type: decimal },
{ name: Currency },
{ name: Reference },
{ name: MerchantName },
{ name: MerchantCategoryCode },
{ name: BillerCode },
{ name: BillerName },
{ name: ApcaNumber }
],
operations: [
# Operation to get all Transactions for a specified Account.
# Operation and Route requires accountId; e.g. api/v1/banking/accounts/{accountId}/transactions
# Supports filtering using defined properies from TransactionArgs (the args will be validated (TransactionArgsValidator) to ensure valid values are passed).
# Supports paging.
# Data access will be auto-implemented for Cosmos as defined for the entity.
# Cosmos PartitionKey will be set to the accountId parameter value for data access.
#
{ name: GetTransactions, text: Get transaction for account, type: GetColl, webApiRoute: '{accountId}/transactions', paging: true, cosmosPartitionKey: accountId,
parameters: [
# Note usage of ValidatorCode which will inject the code as-is into the validation logic; being a common validator 'Validators.Account' that will perform the authorization check.
{ name: AccountId, validatorCode: Common(Validators.AccountId), webApiFrom: FromRoute, isMandatory: true },
{ name: Args, type: TransactionArgs, validator: TransactionArgsValidator }
]
}
]
}
# Specifying the arguments for the Transaction.GetTransactions; note usage of the JsonName to override the default query string parameter names.
# FromDate & ToDate are so named for C# access; however, they are referred to 'Oldest time' and 'Newest time' externally - DisplayName is used for corresponding error message text.
#
- { name: TransactionArgs,
properties: [
{ name: FromDate, text: From (oldest time), displayName: Oldest time, jsonName: 'oldest-time', type: DateTime? },
{ name: ToDate, text: To (newest time), displayName: Newest time, jsonName: 'newest-time', type: DateTime? },
{ name: MinAmount, jsonName: 'min-amount', type: decimal? },
{ name: MaxAmount, jsonName: 'max-amount', type: decimal? },
{ name: Text, jsonName: text }
]
}