@meghjs/cli 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/generators/auth-files.d.ts +37 -0
  2. package/dist/generators/auth-files.js +198 -0
  3. package/dist/generators/auth.d.ts +26 -0
  4. package/dist/generators/auth.js +542 -0
  5. package/dist/generators/make.d.ts +8 -0
  6. package/dist/generators/make.js +12 -0
  7. package/dist/generators/migration-schema.d.ts +5 -0
  8. package/dist/generators/migration-schema.js +17 -0
  9. package/dist/generators/scaffold.d.ts +76 -0
  10. package/dist/generators/scaffold.js +353 -0
  11. package/dist/program.js +125 -3
  12. package/dist/templates/cascade.d.ts +37 -0
  13. package/dist/templates/cascade.js +87 -0
  14. package/dist/templates/catalog/common.d.ts +1 -0
  15. package/dist/templates/catalog/common.js +63 -0
  16. package/dist/templates/catalog/construction.d.ts +1 -0
  17. package/dist/templates/catalog/construction.js +138 -0
  18. package/dist/templates/catalog/crm.d.ts +1 -0
  19. package/dist/templates/catalog/crm.js +81 -0
  20. package/dist/templates/catalog/ecommerce.d.ts +1 -0
  21. package/dist/templates/catalog/ecommerce.js +143 -0
  22. package/dist/templates/catalog/education.d.ts +1 -0
  23. package/dist/templates/catalog/education.js +80 -0
  24. package/dist/templates/catalog/hr.d.ts +1 -0
  25. package/dist/templates/catalog/hr.js +83 -0
  26. package/dist/templates/catalog/logistics.d.ts +1 -0
  27. package/dist/templates/catalog/logistics.js +60 -0
  28. package/dist/templates/catalog/marketing.d.ts +1 -0
  29. package/dist/templates/catalog/marketing.js +104 -0
  30. package/dist/templates/catalog/medical.d.ts +1 -0
  31. package/dist/templates/catalog/medical.js +147 -0
  32. package/dist/templates/catalog/pos.d.ts +1 -0
  33. package/dist/templates/catalog/pos.js +110 -0
  34. package/dist/templates/catalog/real-estate.d.ts +1 -0
  35. package/dist/templates/catalog/real-estate.js +171 -0
  36. package/dist/templates/fields.d.ts +64 -0
  37. package/dist/templates/fields.js +331 -0
  38. package/dist/templates/index.d.ts +27 -0
  39. package/dist/templates/index.js +175 -0
  40. package/dist/templates/migration.d.ts +7 -0
  41. package/dist/templates/migration.js +80 -0
  42. package/dist/templates/template.d.ts +37 -0
  43. package/dist/templates/template.js +36 -0
  44. package/dist/utils/dialect.d.ts +8 -0
  45. package/dist/utils/dialect.js +57 -0
  46. package/package.json +17 -5
  47. package/readme.md +26 -1
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hr = void 0;
4
+ const template_1 = require("../template");
5
+ exports.hr = (0, template_1.domain)("hr", "HR", "Employees, departments, attendance, leave and payroll", [
6
+ ["department", "A department of the company", ["name", "code", "description", "is_active"]],
7
+ [
8
+ "position",
9
+ "A job position",
10
+ ["department_id:nullOnDelete", "title", "description", "min_salary?:money", "max_salary?:money"],
11
+ ],
12
+ [
13
+ "employee",
14
+ "An employee",
15
+ [
16
+ "user_id:nullOnDelete",
17
+ "department_id:nullOnDelete",
18
+ "position_id:nullOnDelete",
19
+ "employee_number:string(32):unique",
20
+ "person",
21
+ "email:unique",
22
+ "phone",
23
+ "gender",
24
+ "date_of_birth",
25
+ "hire_date:date",
26
+ "employment_type:in(full_time|part_time|contract|intern)",
27
+ "salary?:money",
28
+ "status:in(active|on_leave|terminated)",
29
+ "address?",
30
+ ],
31
+ { softDeletes: true },
32
+ ],
33
+ [
34
+ "attendance",
35
+ "An employee's attendance on one day",
36
+ [
37
+ "employee_id:cascade",
38
+ "date",
39
+ "check_in?:timestamp",
40
+ "check_out?:timestamp",
41
+ "status:in(present|absent|late|half_day|on_leave)",
42
+ "hours?:decimal(5,2)",
43
+ "notes",
44
+ ],
45
+ { unique: [["employee_id", "date"]] },
46
+ ],
47
+ [
48
+ "leave_type",
49
+ "A kind of leave, e.g. annual or sick",
50
+ ["name", "code", "days_per_year:integer:default(0)", "is_paid:boolean:default(true)"],
51
+ ],
52
+ [
53
+ "leave_request",
54
+ "A request for leave",
55
+ [
56
+ "employee_id:cascade",
57
+ "leave_type_id:restrict",
58
+ "approved_by_id:foreign(users):nullOnDelete",
59
+ "start_date:date",
60
+ "end_date:date",
61
+ "days:decimal(5,1)",
62
+ "reason?:text",
63
+ "status:in(pending|approved|rejected|cancelled)",
64
+ "approved_at?:timestamp",
65
+ ],
66
+ ],
67
+ [
68
+ "payroll",
69
+ "An employee's pay for one period",
70
+ [
71
+ "employee_id:restrict",
72
+ "period_start:date",
73
+ "period_end:date",
74
+ "basic_salary:money",
75
+ "allowances:money:default(0)",
76
+ "deductions:money:default(0)",
77
+ "tax",
78
+ "net_pay:money",
79
+ "status:in(draft|approved|paid)",
80
+ "paid_at",
81
+ ],
82
+ ],
83
+ ]);
@@ -0,0 +1 @@
1
+ export declare const logistics: import("../template").Domain;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.logistics = void 0;
4
+ const template_1 = require("../template");
5
+ exports.logistics = (0, template_1.domain)("logistics", "Logistics", "Warehouses, vehicles, drivers and deliveries", [
6
+ ["warehouse", "A warehouse or depot", ["name", "code", "address", "geo", "phone", "capacity?:integer", "is_active"]],
7
+ [
8
+ "vehicle",
9
+ "A delivery vehicle",
10
+ [
11
+ "warehouse_id:nullOnDelete",
12
+ "plate_number:string(32):unique",
13
+ "type:in(van|truck|bike|car|trailer)",
14
+ "make?:string(64)",
15
+ "model?:string(64)",
16
+ "year?:integer",
17
+ "capacity_kg?:decimal(10,2)",
18
+ "status:in(available|in_use|maintenance|retired)",
19
+ ],
20
+ ],
21
+ [
22
+ "driver",
23
+ "A driver",
24
+ [
25
+ "user_id:nullOnDelete",
26
+ "vehicle_id:nullOnDelete",
27
+ "person",
28
+ "phone:phone",
29
+ "email?",
30
+ "license_number:string(64):unique",
31
+ "license_expires_at?:date",
32
+ "status:in(available|on_trip|off_duty|inactive)",
33
+ ],
34
+ ],
35
+ [
36
+ "delivery",
37
+ "A parcel or load to deliver",
38
+ [
39
+ "warehouse_id:nullOnDelete",
40
+ "vehicle_id:nullOnDelete",
41
+ "driver_id:nullOnDelete",
42
+ "tracking_number:string(64):unique",
43
+ "recipient_name:string",
44
+ "recipient_phone:phone",
45
+ "address",
46
+ "geo",
47
+ "weight",
48
+ "status:in(pending|assigned|picked_up|in_transit|delivered|failed|returned)",
49
+ "scheduled_at?:timestamp",
50
+ "delivered_at?:timestamp",
51
+ "proof_url?:url",
52
+ "notes",
53
+ ],
54
+ ],
55
+ [
56
+ "tracking_event",
57
+ "A status update of a delivery",
58
+ ["delivery_id:cascade", "status:string(32)", "location?:string", "geo", "occurred_at:timestamp", "notes"],
59
+ ],
60
+ ]);
@@ -0,0 +1 @@
1
+ export declare const marketing: import("../template").Domain;
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.marketing = void 0;
4
+ const template_1 = require("../template");
5
+ exports.marketing = (0, template_1.domain)("marketing", "Marketing", "Campaigns, leads, contacts, segments and email", [
6
+ [
7
+ "campaign",
8
+ "A marketing campaign",
9
+ [
10
+ "owner_id:foreign(users):nullOnDelete",
11
+ "name",
12
+ "slug",
13
+ "type:in(email|sms|social|ads|content|event)",
14
+ "status:in(draft|scheduled|active|paused|completed)",
15
+ "budget?:money",
16
+ "spent:money:default(0)",
17
+ "starts_at",
18
+ "ends_at",
19
+ "description",
20
+ ],
21
+ ],
22
+ [
23
+ "contact",
24
+ "A person in the marketing database",
25
+ [
26
+ "person",
27
+ "email:unique",
28
+ "phone",
29
+ "company?:string",
30
+ "job_title?:string(128)",
31
+ "source?:string(64)",
32
+ "country?:string(100)",
33
+ "status:in(subscribed|unsubscribed|bounced)",
34
+ ],
35
+ ],
36
+ [
37
+ "lead",
38
+ "A potential customer",
39
+ [
40
+ "contact_id:nullOnDelete",
41
+ "campaign_id:nullOnDelete",
42
+ "owner_id:foreign(users):nullOnDelete",
43
+ "name",
44
+ "email",
45
+ "phone",
46
+ "company?:string",
47
+ "source?:string(64)",
48
+ "status:in(new|contacted|qualified|converted|lost)",
49
+ "score:integer:default(0)",
50
+ "notes",
51
+ ],
52
+ ],
53
+ ["segment", "A group of contacts", ["name", "description", "rules?:json", "is_dynamic:boolean:default(false)"]],
54
+ ["contact_segment", "Which segments each contact is in", ["contact_id:cascade", "segment_id:cascade"], { pivot: true }],
55
+ [
56
+ "email_template",
57
+ "A reusable email",
58
+ ["name", "subject:string", "body", "from_name?:string", "from_email?:email", "is_active"],
59
+ ],
60
+ [
61
+ "subscriber",
62
+ "A newsletter subscriber",
63
+ [
64
+ "email:unique",
65
+ "name?",
66
+ "status:in(pending|subscribed|unsubscribed|bounced)",
67
+ "source?:string(64)",
68
+ "subscribed_at?:timestamp",
69
+ "unsubscribed_at?:timestamp",
70
+ "ip_address",
71
+ ],
72
+ ],
73
+ [
74
+ "landing_page",
75
+ "A campaign landing page",
76
+ [
77
+ "campaign_id:nullOnDelete",
78
+ "title",
79
+ "slug",
80
+ "content?:text",
81
+ "meta_title?:string",
82
+ "meta_description?:string(500)",
83
+ "status:in(draft|published|archived)",
84
+ "published_at",
85
+ "views:integer:default(0)",
86
+ "conversions:integer:default(0)",
87
+ ],
88
+ ],
89
+ [
90
+ "utm_link",
91
+ "A tracked link with UTM parameters",
92
+ [
93
+ "campaign_id:cascade",
94
+ "url:url",
95
+ "utm_source:string(128)",
96
+ "utm_medium:string(128)",
97
+ "utm_campaign:string(128)",
98
+ "utm_term?:string(128)",
99
+ "utm_content?:string(128)",
100
+ "short_code?:string(32):unique",
101
+ "clicks:integer:default(0)",
102
+ ],
103
+ ],
104
+ ]);
@@ -0,0 +1 @@
1
+ export declare const medical: import("../template").Domain;
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.medical = void 0;
4
+ const template_1 = require("../template");
5
+ exports.medical = (0, template_1.domain)("medical", "Medical", "Clinics and hospitals: patients, doctors, appointments and records", [
6
+ ["department", "A hospital or clinic department", ["name", "code", "description", "phone", "is_active"]],
7
+ [
8
+ "doctor",
9
+ "A doctor or other practitioner",
10
+ [
11
+ "user_id:nullOnDelete",
12
+ "department_id:nullOnDelete",
13
+ "person",
14
+ "email:unique",
15
+ "phone",
16
+ "specialization:string(128)",
17
+ "license_number:string(64):unique",
18
+ "consultation_fee?:money",
19
+ "is_active",
20
+ ],
21
+ ],
22
+ [
23
+ "patient",
24
+ "A patient, identified by their medical record number (mrn)",
25
+ [
26
+ "mrn:string(32):unique",
27
+ "person",
28
+ "gender",
29
+ "date_of_birth",
30
+ "phone",
31
+ "email?",
32
+ "address?",
33
+ "blood_group?:in(A+|A-|B+|B-|AB+|AB-|O+|O-)",
34
+ "allergies?:text",
35
+ "emergency_contact_name?:string",
36
+ "emergency_contact_phone?:phone",
37
+ ],
38
+ { softDeletes: true },
39
+ ],
40
+ [
41
+ "appointment",
42
+ "A booked visit",
43
+ [
44
+ "patient_id:cascade",
45
+ "doctor_id:cascade",
46
+ "department_id:nullOnDelete",
47
+ "scheduled_at:timestamp:index",
48
+ "duration_minutes:integer:default(30)",
49
+ "status:in(scheduled|confirmed|checked_in|completed|cancelled|no_show)",
50
+ "reason?:string(500)",
51
+ "notes",
52
+ ],
53
+ ],
54
+ [
55
+ "medical_record",
56
+ "The notes of one visit",
57
+ [
58
+ "patient_id:cascade",
59
+ "doctor_id:nullOnDelete",
60
+ "appointment_id:nullOnDelete",
61
+ "visit_date:date",
62
+ "chief_complaint?:text",
63
+ "diagnosis?:text",
64
+ "treatment?:text",
65
+ "vitals?:json",
66
+ "notes",
67
+ ],
68
+ ],
69
+ [
70
+ "medication",
71
+ "A drug in the formulary",
72
+ [
73
+ "name",
74
+ "generic_name?:string",
75
+ "form?:string(32)",
76
+ "strength?:string(64)",
77
+ "manufacturer?:string",
78
+ "price?:money",
79
+ "stock",
80
+ "is_active",
81
+ ],
82
+ ],
83
+ [
84
+ "prescription",
85
+ "A medication prescribed to a patient",
86
+ [
87
+ "patient_id:cascade",
88
+ "doctor_id:nullOnDelete",
89
+ "medical_record_id:nullOnDelete",
90
+ "medication_id:restrict",
91
+ "dosage:string(64)",
92
+ "frequency:string(64)",
93
+ "duration?:string(64)",
94
+ "quantity",
95
+ "instructions?:text",
96
+ "prescribed_at:timestamp",
97
+ ],
98
+ ],
99
+ [
100
+ "lab_test",
101
+ "A lab test ordered for a patient, and its result",
102
+ [
103
+ "patient_id:cascade",
104
+ "doctor_id:nullOnDelete",
105
+ "name",
106
+ "code?:string(32)",
107
+ "status:in(ordered|collected|completed|cancelled)",
108
+ "result?:text",
109
+ "normal_range?:string(128)",
110
+ "unit?:string(32)",
111
+ "ordered_at:timestamp",
112
+ "completed_at?:timestamp",
113
+ ],
114
+ ],
115
+ [
116
+ "insurance",
117
+ "A patient's insurance policy",
118
+ [
119
+ "patient_id:cascade",
120
+ "provider:string",
121
+ "policy_number:string(64)",
122
+ "group_number?:string(64)",
123
+ "coverage_percent?:percent",
124
+ "valid_from?:date",
125
+ "valid_until?:date",
126
+ "is_active",
127
+ ],
128
+ ],
129
+ [
130
+ "invoice",
131
+ "A bill for a patient",
132
+ [
133
+ "patient_id:restrict",
134
+ "appointment_id:nullOnDelete",
135
+ "insurance_id:nullOnDelete",
136
+ "number:string(32):unique",
137
+ "subtotal",
138
+ "discount",
139
+ "tax",
140
+ "total",
141
+ "paid_amount:money:default(0)",
142
+ "status:in(draft|issued|paid|partially_paid|void)",
143
+ "issued_at?:timestamp",
144
+ "due_date",
145
+ ],
146
+ ],
147
+ ]);
@@ -0,0 +1 @@
1
+ export declare const pos: import("../template").Domain;
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pos = void 0;
4
+ const template_1 = require("../template");
5
+ exports.pos = (0, template_1.domain)("pos", "Point of sale", "Shops and tills: outlets, shifts, sales, purchases and stock", [
6
+ ["outlet", "A shop or branch", ["name", "code", "phone", "email?", "address?", "is_active"]],
7
+ ["register", "A till in an outlet", ["outlet_id:cascade", "name", "is_active"]],
8
+ [
9
+ "shift",
10
+ "A cashier's shift on a register",
11
+ [
12
+ "register_id:cascade",
13
+ "user_id:nullOnDelete",
14
+ "opened_at:timestamp",
15
+ "closed_at?:timestamp",
16
+ "opening_cash:money:default(0)",
17
+ "closing_cash?:money",
18
+ "expected_cash?:money",
19
+ "status:in(open|closed)",
20
+ "notes",
21
+ ],
22
+ ],
23
+ ["customer", "A walk-in or loyalty customer", ["name", "email?", "phone", "loyalty_points:integer:default(0)", "notes"]],
24
+ [
25
+ "supplier",
26
+ "A supplier stock is bought from",
27
+ ["name", "contact_name?:string", "email?", "phone", "address?", "tax_number?:string(64)", "is_active"],
28
+ ],
29
+ ["tax_rate", "A sales tax", ["name", "rate:percent", "is_inclusive:boolean:default(false)", "is_active"]],
30
+ [
31
+ "product",
32
+ "An item sold at the till",
33
+ [
34
+ "category_id:nullOnDelete",
35
+ "name",
36
+ "sku",
37
+ "barcode?:string(64):unique",
38
+ "price",
39
+ "cost",
40
+ "stock",
41
+ "reorder_level:integer:default(0)",
42
+ "tax_rate_id:nullOnDelete",
43
+ "is_active",
44
+ ],
45
+ ],
46
+ [
47
+ "sale",
48
+ "A completed sale",
49
+ [
50
+ "outlet_id:restrict",
51
+ "register_id:nullOnDelete",
52
+ "shift_id:nullOnDelete",
53
+ "customer_id:nullOnDelete",
54
+ "user_id:nullOnDelete",
55
+ "number:string(32):unique",
56
+ "subtotal",
57
+ "discount",
58
+ "tax",
59
+ "total",
60
+ "paid_amount:money:default(0)",
61
+ "change_amount:money:default(0)",
62
+ "status:in(completed|refunded|void)",
63
+ "sold_at:timestamp",
64
+ ],
65
+ ],
66
+ [
67
+ "sale_item",
68
+ "A line of a sale",
69
+ ["sale_id:cascade", "product_id:nullOnDelete", "name", "quantity", "price", "discount", "tax", "total"],
70
+ ],
71
+ [
72
+ "sale_payment",
73
+ "A payment towards a sale (cash, card, ...)",
74
+ ["sale_id:cascade", "method:string(32):default(cash)", "amount", "reference?:string(64)"],
75
+ ],
76
+ [
77
+ "purchase",
78
+ "A purchase order to a supplier",
79
+ [
80
+ "supplier_id:restrict",
81
+ "outlet_id:nullOnDelete",
82
+ "number:string(32):unique",
83
+ "status:in(draft|ordered|received|cancelled)",
84
+ "subtotal",
85
+ "tax",
86
+ "total",
87
+ "ordered_at?:timestamp",
88
+ "received_at?:timestamp",
89
+ "notes",
90
+ ],
91
+ ],
92
+ [
93
+ "purchase_item",
94
+ "A line of a purchase order",
95
+ ["purchase_id:cascade", "product_id:restrict", "quantity:integer", "unit_cost:money", "total"],
96
+ ],
97
+ [
98
+ "stock_movement",
99
+ "A change in stock: sale, purchase, adjustment or transfer",
100
+ [
101
+ "product_id:cascade",
102
+ "outlet_id:nullOnDelete",
103
+ "user_id:nullOnDelete",
104
+ "type:in(in|out|adjustment|transfer|sale|purchase)",
105
+ "quantity:integer",
106
+ "reference?:string(64)",
107
+ "notes",
108
+ ],
109
+ ],
110
+ ]);
@@ -0,0 +1 @@
1
+ export declare const realEstate: import("../template").Domain;
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.realEstate = void 0;
4
+ const template_1 = require("../template");
5
+ exports.realEstate = (0, template_1.domain)("real-estate", "Real estate", "Properties, listings, agents, tenants, leases and rent", [
6
+ [
7
+ "agent",
8
+ "A real estate agent",
9
+ [
10
+ "user_id:nullOnDelete",
11
+ "person",
12
+ "email:unique",
13
+ "phone",
14
+ "license_number?:string(64)",
15
+ "agency?:string",
16
+ "commission_rate?:percent",
17
+ "avatar",
18
+ "is_active",
19
+ ],
20
+ ],
21
+ [
22
+ "property",
23
+ "A building or plot",
24
+ [
25
+ "agent_id:nullOnDelete",
26
+ "title",
27
+ "slug",
28
+ "description",
29
+ "type:in(apartment|house|condo|townhouse|land|commercial|office)",
30
+ "status:in(available|under_contract|sold|rented|off_market)",
31
+ "address",
32
+ "geo",
33
+ "bedrooms:integer:default(0)",
34
+ "bathrooms:decimal(3,1):default(0)",
35
+ "area?:decimal(10,2)",
36
+ "area_unit:string(8):default(sqft)",
37
+ "lot_size?:decimal(12,2)",
38
+ "year_built?:integer",
39
+ "price?",
40
+ "currency",
41
+ "is_featured",
42
+ ],
43
+ { table: "properties", softDeletes: true },
44
+ ],
45
+ [
46
+ "unit",
47
+ "A rentable unit of a property",
48
+ [
49
+ "property_id:cascade",
50
+ "unit_number:string(32)",
51
+ "floor?:integer",
52
+ "bedrooms:integer:default(0)",
53
+ "bathrooms:decimal(3,1):default(0)",
54
+ "area?:decimal(10,2)",
55
+ "rent?:money",
56
+ "status:in(vacant|occupied|reserved|maintenance)",
57
+ ],
58
+ { unique: [["property_id", "unit_number"]] },
59
+ ],
60
+ ["amenity", "A feature such as a pool or parking", ["name", "slug", "icon?:string(64)", "category?:string(64)"]],
61
+ [
62
+ "property_amenity",
63
+ "Which amenities each property has",
64
+ ["property_id:cascade", "amenity_id:cascade"],
65
+ { pivot: true },
66
+ ],
67
+ [
68
+ "listing",
69
+ "A property offered for sale or rent",
70
+ [
71
+ "property_id:cascade",
72
+ "agent_id:nullOnDelete",
73
+ "type:in(sale|rent)",
74
+ "price",
75
+ "currency",
76
+ "status:in(draft|active|pending|closed|expired)",
77
+ "listed_at?:timestamp",
78
+ "expires_at?:timestamp",
79
+ "description",
80
+ "views:integer:default(0)",
81
+ ],
82
+ ],
83
+ [
84
+ "tenant",
85
+ "A person renting a unit",
86
+ [
87
+ "user_id:nullOnDelete",
88
+ "person",
89
+ "email:unique",
90
+ "phone",
91
+ "date_of_birth",
92
+ "national_id",
93
+ "employer?:string",
94
+ "monthly_income?:money",
95
+ "emergency_contact_name?:string",
96
+ "emergency_contact_phone?:phone",
97
+ ],
98
+ ],
99
+ [
100
+ "lease",
101
+ "A rental agreement for a unit",
102
+ [
103
+ "unit_id:restrict",
104
+ "tenant_id:restrict",
105
+ "start_date:date",
106
+ "end_date:date",
107
+ "rent_amount:money",
108
+ "deposit_amount:money:default(0)",
109
+ "billing_day:integer:default(1)",
110
+ "status:in(draft|active|ended|terminated)",
111
+ "terms?:text",
112
+ "signed_at?:timestamp",
113
+ ],
114
+ ],
115
+ [
116
+ "rent_payment",
117
+ "A rent payment for a lease",
118
+ [
119
+ "lease_id:cascade",
120
+ "amount",
121
+ "due_date:date",
122
+ "paid_at",
123
+ "method?:string(32)",
124
+ "reference?:string(64)",
125
+ "status:in(pending|paid|late|partial|failed)",
126
+ "late_fee:money:default(0)",
127
+ ],
128
+ ],
129
+ [
130
+ "inquiry",
131
+ "A question about a property",
132
+ [
133
+ "property_id:cascade",
134
+ "listing_id:nullOnDelete",
135
+ "agent_id:nullOnDelete",
136
+ "name",
137
+ "email",
138
+ "phone",
139
+ "message:text",
140
+ "status:in(new|contacted|scheduled|closed)",
141
+ ],
142
+ { table: "inquiries" },
143
+ ],
144
+ [
145
+ "viewing",
146
+ "A scheduled property viewing",
147
+ [
148
+ "property_id:cascade",
149
+ "inquiry_id:foreign(inquiries):nullOnDelete",
150
+ "agent_id:nullOnDelete",
151
+ "scheduled_at:timestamp",
152
+ "status:in(scheduled|completed|cancelled|no_show)",
153
+ "feedback?:text",
154
+ ],
155
+ ],
156
+ [
157
+ "maintenance_request",
158
+ "A repair requested for a unit",
159
+ [
160
+ "unit_id:cascade",
161
+ "tenant_id:nullOnDelete",
162
+ "title",
163
+ "description",
164
+ "priority",
165
+ "status:in(open|in_progress|resolved|closed)",
166
+ "reported_at?:timestamp",
167
+ "resolved_at?:timestamp",
168
+ "cost",
169
+ ],
170
+ ],
171
+ ]);