Transaction.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { User } from 'src/models/User'
  2. import { Invoice } from 'src/models/Invoice.js'
  3. import { Model, Collection } from 'js-abstract-model'
  4. class Transaction extends Model {
  5. constructor (data) {
  6. super(data, [
  7. { key: 'id' },
  8. { key: 'is_active' },
  9. { key: 'is_deleted' },
  10. { key: 'amount' },
  11. { key: 'authority_code' },
  12. { key: 'reference_code' },
  13. { key: 'description' },
  14. { key: 'status' }, // IN_PROGRESS
  15. {
  16. key: 'additional_data',
  17. default: []
  18. },
  19. { key: 'creation_time' },
  20. { key: 'last_modification_time' },
  21. { key: 'creator' },
  22. {
  23. key: 'creator_info',
  24. relatedModel: User
  25. },
  26. { key: 'owner' },
  27. {
  28. key: 'owner_info',
  29. relatedModel: User
  30. },
  31. { key: 'invoice' },
  32. {
  33. key: 'invoice_info',
  34. relatedModel: Invoice
  35. }
  36. ])
  37. }
  38. }
  39. class TransactionList extends Collection {
  40. model () {
  41. return Transaction
  42. }
  43. }
  44. export { Transaction, TransactionList }