product.vala 882 B

1234567891011121314151617181920212223242526
  1. using InvercargillSql.Orm;
  2. /**
  3. * Product entity representing a product in the e-commerce system.
  4. */
  5. public class Product : Object {
  6. public int64 id { get; set; }
  7. public string name { get; set; }
  8. public string category { get; set; }
  9. public double price { get; set; }
  10. public int64 stock { get; set; }
  11. public Product() {
  12. name = "";
  13. category = "";
  14. }
  15. public static void configure_mapper(EntityMapperBuilder<Product> b) {
  16. b.table("products")
  17. .column<int64?>("id", p => p.id, (p, v) => p.id = v)
  18. .column<string>("name", p => p.name, (p, v) => p.name = v)
  19. .column<string>("category", p => p.category, (p, v) => p.category = v)
  20. .column<double?>("price", p => p.price, (p, v) => p.price = v)
  21. .column<int64?>("stock", p => p.stock, (p, v) => p.stock = v);
  22. }
  23. }