@meghjs/cli 0.5.2 → 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.
- package/dist/commands/migrate.d.ts +23 -5
- package/dist/commands/migrate.js +44 -6
- package/dist/commands/new.js +7 -1
- package/dist/generators/auth-files.d.ts +37 -0
- package/dist/generators/auth-files.js +198 -0
- package/dist/generators/auth.d.ts +26 -0
- package/dist/generators/auth.js +542 -0
- package/dist/generators/factory.d.ts +25 -0
- package/dist/generators/factory.js +159 -0
- package/dist/generators/make.d.ts +38 -0
- package/dist/generators/make.js +176 -0
- package/dist/generators/migration-schema.d.ts +5 -0
- package/dist/generators/migration-schema.js +25 -2
- package/dist/generators/orm-model.d.ts +6 -1
- package/dist/generators/orm-model.js +31 -2
- package/dist/generators/resource.d.ts +21 -0
- package/dist/generators/resource.js +17 -3
- package/dist/generators/scaffold.d.ts +76 -0
- package/dist/generators/scaffold.js +353 -0
- package/dist/generators/update-model.d.ts +21 -0
- package/dist/generators/update-model.js +129 -0
- package/dist/program.js +175 -6
- package/dist/templates/cascade.d.ts +37 -0
- package/dist/templates/cascade.js +87 -0
- package/dist/templates/catalog/common.d.ts +1 -0
- package/dist/templates/catalog/common.js +63 -0
- package/dist/templates/catalog/construction.d.ts +1 -0
- package/dist/templates/catalog/construction.js +138 -0
- package/dist/templates/catalog/crm.d.ts +1 -0
- package/dist/templates/catalog/crm.js +81 -0
- package/dist/templates/catalog/ecommerce.d.ts +1 -0
- package/dist/templates/catalog/ecommerce.js +143 -0
- package/dist/templates/catalog/education.d.ts +1 -0
- package/dist/templates/catalog/education.js +80 -0
- package/dist/templates/catalog/hr.d.ts +1 -0
- package/dist/templates/catalog/hr.js +83 -0
- package/dist/templates/catalog/logistics.d.ts +1 -0
- package/dist/templates/catalog/logistics.js +60 -0
- package/dist/templates/catalog/marketing.d.ts +1 -0
- package/dist/templates/catalog/marketing.js +104 -0
- package/dist/templates/catalog/medical.d.ts +1 -0
- package/dist/templates/catalog/medical.js +147 -0
- package/dist/templates/catalog/pos.d.ts +1 -0
- package/dist/templates/catalog/pos.js +110 -0
- package/dist/templates/catalog/real-estate.d.ts +1 -0
- package/dist/templates/catalog/real-estate.js +171 -0
- package/dist/templates/fields.d.ts +64 -0
- package/dist/templates/fields.js +331 -0
- package/dist/templates/index.d.ts +27 -0
- package/dist/templates/index.js +175 -0
- package/dist/templates/migration.d.ts +7 -0
- package/dist/templates/migration.js +80 -0
- package/dist/templates/template.d.ts +37 -0
- package/dist/templates/template.js +36 -0
- package/dist/utils/dialect.d.ts +8 -0
- package/dist/utils/dialect.js +57 -0
- package/package.json +17 -5
- package/readme.md +30 -1
- package/stubs/controllers/model-controller.stub +10 -1
- package/stubs/seeders/database-seeder.stub +8 -0
- package/stubs/seeders/seeder.stub +10 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ecommerce = void 0;
|
|
4
|
+
const template_1 = require("../template");
|
|
5
|
+
exports.ecommerce = (0, template_1.domain)("ecommerce", "E-commerce", "An online store: catalog, carts, orders and payments", [
|
|
6
|
+
["brand", "A product brand", ["name", "slug", "logo", "description", "website", "is_active"]],
|
|
7
|
+
[
|
|
8
|
+
"product",
|
|
9
|
+
"A product in the catalog",
|
|
10
|
+
[
|
|
11
|
+
"category_id:nullOnDelete",
|
|
12
|
+
"brand_id:nullOnDelete",
|
|
13
|
+
"name",
|
|
14
|
+
"slug",
|
|
15
|
+
"sku",
|
|
16
|
+
"description",
|
|
17
|
+
"price",
|
|
18
|
+
"compare_at_price?:money",
|
|
19
|
+
"cost",
|
|
20
|
+
"stock",
|
|
21
|
+
"weight",
|
|
22
|
+
"status:in(draft|active|archived)",
|
|
23
|
+
"is_featured",
|
|
24
|
+
],
|
|
25
|
+
{ softDeletes: true },
|
|
26
|
+
],
|
|
27
|
+
[
|
|
28
|
+
"product_variant",
|
|
29
|
+
"A size, color or other option of a product",
|
|
30
|
+
["product_id:cascade", "sku", "name", "price", "stock", "options?:json", "image"],
|
|
31
|
+
],
|
|
32
|
+
["product_tag", "Which tags each product has", ["product_id:cascade", "tag_id:cascade"], { pivot: true }],
|
|
33
|
+
[
|
|
34
|
+
"customer",
|
|
35
|
+
"A shopper",
|
|
36
|
+
["user_id:nullOnDelete", "person", "email:unique", "phone", "accepts_marketing:boolean:default(false)"],
|
|
37
|
+
],
|
|
38
|
+
[
|
|
39
|
+
"cart",
|
|
40
|
+
"A shopping cart",
|
|
41
|
+
["customer_id:nullOnDelete", "session_id?:string(128):index", "currency", "status:in(active|converted|abandoned)"],
|
|
42
|
+
],
|
|
43
|
+
[
|
|
44
|
+
"cart_item",
|
|
45
|
+
"A product in a cart",
|
|
46
|
+
["cart_id:cascade", "product_id:cascade", "product_variant_id:nullOnDelete", "quantity", "price"],
|
|
47
|
+
],
|
|
48
|
+
[
|
|
49
|
+
"coupon",
|
|
50
|
+
"A discount code",
|
|
51
|
+
[
|
|
52
|
+
"code",
|
|
53
|
+
"description",
|
|
54
|
+
"discount_type:in(percent|fixed)",
|
|
55
|
+
"value:money",
|
|
56
|
+
"min_order_amount?:money",
|
|
57
|
+
"max_uses?:integer",
|
|
58
|
+
"used_count:integer:default(0)",
|
|
59
|
+
"starts_at",
|
|
60
|
+
"ends_at",
|
|
61
|
+
"is_active",
|
|
62
|
+
],
|
|
63
|
+
],
|
|
64
|
+
[
|
|
65
|
+
"order",
|
|
66
|
+
"A placed order",
|
|
67
|
+
[
|
|
68
|
+
"customer_id:nullOnDelete",
|
|
69
|
+
"coupon_id:nullOnDelete",
|
|
70
|
+
"number:string(32):unique",
|
|
71
|
+
"status:in(pending|paid|processing|shipped|delivered|cancelled|refunded)",
|
|
72
|
+
"subtotal",
|
|
73
|
+
"discount",
|
|
74
|
+
"tax",
|
|
75
|
+
"shipping_total:money:default(0)",
|
|
76
|
+
"total",
|
|
77
|
+
"currency",
|
|
78
|
+
"shipping_address?:json",
|
|
79
|
+
"billing_address?:json",
|
|
80
|
+
"placed_at?:timestamp",
|
|
81
|
+
"notes",
|
|
82
|
+
],
|
|
83
|
+
],
|
|
84
|
+
[
|
|
85
|
+
"order_item",
|
|
86
|
+
"A line of an order; name, sku and price are copied from the product",
|
|
87
|
+
[
|
|
88
|
+
"order_id:cascade",
|
|
89
|
+
"product_id:nullOnDelete",
|
|
90
|
+
"product_variant_id:nullOnDelete",
|
|
91
|
+
"name",
|
|
92
|
+
"sku?:string(64)",
|
|
93
|
+
"quantity",
|
|
94
|
+
"price",
|
|
95
|
+
"discount",
|
|
96
|
+
"total",
|
|
97
|
+
],
|
|
98
|
+
],
|
|
99
|
+
[
|
|
100
|
+
"payment",
|
|
101
|
+
"A payment for an order",
|
|
102
|
+
[
|
|
103
|
+
"order_id:cascade",
|
|
104
|
+
"method:string(32)",
|
|
105
|
+
"provider?:string(64)",
|
|
106
|
+
"transaction_id?:string(128):index",
|
|
107
|
+
"amount",
|
|
108
|
+
"currency",
|
|
109
|
+
"status:in(pending|completed|failed|refunded)",
|
|
110
|
+
"paid_at",
|
|
111
|
+
],
|
|
112
|
+
],
|
|
113
|
+
[
|
|
114
|
+
"shipment",
|
|
115
|
+
"A shipment of an order",
|
|
116
|
+
[
|
|
117
|
+
"order_id:cascade",
|
|
118
|
+
"carrier?:string(64)",
|
|
119
|
+
"tracking_number?:string(128)",
|
|
120
|
+
"status:in(pending|shipped|in_transit|delivered|returned)",
|
|
121
|
+
"shipped_at?:timestamp",
|
|
122
|
+
"delivered_at?:timestamp",
|
|
123
|
+
],
|
|
124
|
+
],
|
|
125
|
+
[
|
|
126
|
+
"review",
|
|
127
|
+
"A customer's review of a product",
|
|
128
|
+
[
|
|
129
|
+
"product_id:cascade",
|
|
130
|
+
"customer_id:nullOnDelete",
|
|
131
|
+
"rating",
|
|
132
|
+
"title?:string",
|
|
133
|
+
"comment?:text",
|
|
134
|
+
"is_approved:boolean:default(false)",
|
|
135
|
+
],
|
|
136
|
+
],
|
|
137
|
+
[
|
|
138
|
+
"wishlist",
|
|
139
|
+
"A product a customer saved for later",
|
|
140
|
+
["customer_id:cascade", "product_id:cascade"],
|
|
141
|
+
{ unique: [["customer_id", "product_id"]] },
|
|
142
|
+
],
|
|
143
|
+
]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const education: import("../template").Domain;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.education = void 0;
|
|
4
|
+
const template_1 = require("../template");
|
|
5
|
+
exports.education = (0, template_1.domain)("education", "Education", "Schools and courses: students, teachers, enrollments and grades", [
|
|
6
|
+
[
|
|
7
|
+
"teacher",
|
|
8
|
+
"A teacher or instructor",
|
|
9
|
+
[
|
|
10
|
+
"user_id:nullOnDelete",
|
|
11
|
+
"staff_number:string(32):unique",
|
|
12
|
+
"person",
|
|
13
|
+
"email:unique",
|
|
14
|
+
"phone",
|
|
15
|
+
"specialization?:string",
|
|
16
|
+
"hire_date?:date",
|
|
17
|
+
"is_active",
|
|
18
|
+
],
|
|
19
|
+
],
|
|
20
|
+
[
|
|
21
|
+
"student",
|
|
22
|
+
"A student",
|
|
23
|
+
[
|
|
24
|
+
"user_id:nullOnDelete",
|
|
25
|
+
"student_number:string(32):unique",
|
|
26
|
+
"person",
|
|
27
|
+
"email:unique",
|
|
28
|
+
"phone",
|
|
29
|
+
"gender",
|
|
30
|
+
"date_of_birth",
|
|
31
|
+
"admission_date?:date",
|
|
32
|
+
"status:in(active|graduated|suspended|withdrawn)",
|
|
33
|
+
"address?",
|
|
34
|
+
],
|
|
35
|
+
],
|
|
36
|
+
[
|
|
37
|
+
"course",
|
|
38
|
+
"A course or class",
|
|
39
|
+
[
|
|
40
|
+
"teacher_id:nullOnDelete",
|
|
41
|
+
"code",
|
|
42
|
+
"title",
|
|
43
|
+
"description",
|
|
44
|
+
"credits:integer:default(3)",
|
|
45
|
+
"level?:string(32)",
|
|
46
|
+
"capacity?:integer",
|
|
47
|
+
"price?",
|
|
48
|
+
"status:in(draft|published|archived)",
|
|
49
|
+
"starts_at",
|
|
50
|
+
"ends_at",
|
|
51
|
+
],
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
"enrollment",
|
|
55
|
+
"A student taking a course",
|
|
56
|
+
[
|
|
57
|
+
"student_id:cascade",
|
|
58
|
+
"course_id:cascade",
|
|
59
|
+
"enrolled_at:timestamp",
|
|
60
|
+
"status:in(enrolled|completed|dropped|failed)",
|
|
61
|
+
"progress:integer:default(0)",
|
|
62
|
+
"completed_at?:timestamp",
|
|
63
|
+
],
|
|
64
|
+
{ unique: [["student_id", "course_id"]] },
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
"grade",
|
|
68
|
+
"A score for one assessment of an enrollment",
|
|
69
|
+
[
|
|
70
|
+
"enrollment_id:cascade",
|
|
71
|
+
"assessment:string(128)",
|
|
72
|
+
"score:decimal(6,2)",
|
|
73
|
+
"max_score:decimal(6,2):default(100)",
|
|
74
|
+
"letter?:string(4)",
|
|
75
|
+
"weight?:percent",
|
|
76
|
+
"graded_at?:timestamp",
|
|
77
|
+
"remarks?:text",
|
|
78
|
+
],
|
|
79
|
+
],
|
|
80
|
+
]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const hr: import("../template").Domain;
|
|
@@ -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;
|