order.vala 1.1 KB

1234567891011121314151617181920212223242526272829
  1. using InvercargillSql.Orm;
  2. /**
  3. * Order entity representing an order in the e-commerce system.
  4. */
  5. public class Order : Object {
  6. public int64 id { get; set; }
  7. public int64 user_id { get; set; }
  8. public int64 product_id { get; set; }
  9. public int64 quantity { get; set; }
  10. public double total { get; set; }
  11. public string status { get; set; }
  12. public DateTime? created_at { get; set; }
  13. public Order() {
  14. status = "";
  15. }
  16. public static void configure_mapper(EntityMapperBuilder<Order> b) {
  17. b.table("orders")
  18. .column<int64?>("id", o => o.id, (o, v) => o.id = v)
  19. .column<int64?>("user_id", o => o.user_id, (o, v) => o.user_id = v)
  20. .column<int64?>("product_id", o => o.product_id, (o, v) => o.product_id = v)
  21. .column<int64?>("quantity", o => o.quantity, (o, v) => o.quantity = v)
  22. .column<double?>("total", o => o.total, (o, v) => o.total = v)
  23. .column<string>("status", o => o.status, (o, v) => o.status = v)
  24. .column<DateTime?>("created_at", o => o.created_at, (o, v) => o.created_at = v);
  25. }
  26. }