@stacksjs/orm 0.72.16 → 0.72.18
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/index.d.ts +97 -97
- package/dist/index.js +7 -7
- package/dist/models/Activity.ts +95 -0
- package/dist/models/AnalyticsEvent.ts +70 -0
- package/dist/models/Automation.ts +23 -0
- package/dist/models/AutomationRun.ts +26 -0
- package/dist/models/Board.ts +104 -0
- package/dist/models/BoardColumn.ts +88 -0
- package/dist/models/Campaign.ts +321 -0
- package/dist/models/CampaignSend.ts +191 -0
- package/dist/models/CampaignVariant.ts +25 -0
- package/dist/models/Card.ts +118 -0
- package/dist/models/CardComment.ts +68 -0
- package/dist/models/Comment.ts +109 -0
- package/dist/models/CommunicationSuppression.ts +22 -0
- package/dist/models/ConsentEvent.ts +30 -0
- package/dist/models/Content/Author.ts +109 -0
- package/dist/models/Content/Menu.ts +56 -0
- package/dist/models/Content/MenuItem.ts +91 -0
- package/dist/models/Content/Page.ts +205 -0
- package/dist/models/Content/PageRevision.ts +86 -0
- package/dist/models/Content/Post.ts +230 -0
- package/dist/models/Content/Redirect.ts +80 -0
- package/dist/models/Deployment.ts +117 -0
- package/dist/models/EmailIdempotency.ts +64 -0
- package/dist/models/EmailList.ts +134 -0
- package/dist/models/EmailListSubscriber.ts +91 -0
- package/dist/models/EmailSuppression.ts +52 -0
- package/dist/models/EmailWebhookEvent.ts +51 -0
- package/dist/models/Error.ts +77 -0
- package/dist/models/FailedJob.ts +84 -0
- package/dist/models/Forms/Form.ts +91 -0
- package/dist/models/Forms/FormField.ts +127 -0
- package/dist/models/Forms/FormSubmission.ts +114 -0
- package/dist/models/Job.ts +69 -0
- package/dist/models/Label.ts +67 -0
- package/dist/models/Log.ts +134 -0
- package/dist/models/MagicLinkToken.ts +97 -0
- package/dist/models/MailPreference.ts +213 -0
- package/dist/models/Notification.ts +68 -0
- package/dist/models/NotificationDelivery.ts +102 -0
- package/dist/models/PaymentMethod.ts +98 -0
- package/dist/models/PaymentProduct.ts +91 -0
- package/dist/models/PaymentTransaction.ts +78 -0
- package/dist/models/QueryLog.ts +182 -0
- package/dist/models/README.md +31 -0
- package/dist/models/Release.ts +90 -0
- package/dist/models/Request.ts +133 -0
- package/dist/models/SenderDomain.ts +22 -0
- package/dist/models/Site.ts +112 -0
- package/dist/models/SiteDomain.ts +74 -0
- package/dist/models/SmsOptOut.ts +65 -0
- package/dist/models/SocialAccount.ts +70 -0
- package/dist/models/SocialPost.ts +144 -0
- package/dist/models/Subscriber.ts +89 -0
- package/dist/models/SubscriberEmail.ts +55 -0
- package/dist/models/Subscription.ts +153 -0
- package/dist/models/Tag.ts +105 -0
- package/dist/models/Team.ts +75 -0
- package/dist/models/TeamInvitation.ts +159 -0
- package/dist/models/TeamMember.ts +88 -0
- package/dist/models/UsageEvent.ts +24 -0
- package/dist/models/User.ts +142 -0
- package/dist/models/commerce/Auction.ts +173 -0
- package/dist/models/commerce/AuctionItem.ts +204 -0
- package/dist/models/commerce/Bid.ts +129 -0
- package/dist/models/commerce/Cart.ts +140 -0
- package/dist/models/commerce/CartItem.ts +138 -0
- package/dist/models/commerce/Category.ts +125 -0
- package/dist/models/commerce/Coupon.ts +186 -0
- package/dist/models/commerce/Customer.ts +132 -0
- package/dist/models/commerce/DeliveryRoute.ts +127 -0
- package/dist/models/commerce/DeliveryStop.ts +166 -0
- package/dist/models/commerce/DigitalDelivery.ts +106 -0
- package/dist/models/commerce/Driver.ts +168 -0
- package/dist/models/commerce/DriverPing.ts +103 -0
- package/dist/models/commerce/GiftCard.ts +195 -0
- package/dist/models/commerce/LicenseKey.ts +89 -0
- package/dist/models/commerce/LoyaltyPoint.ts +108 -0
- package/dist/models/commerce/LoyaltyReward.ts +129 -0
- package/dist/models/commerce/Manufacturer.ts +90 -0
- package/dist/models/commerce/Order.ts +198 -0
- package/dist/models/commerce/OrderIdempotency.ts +34 -0
- package/dist/models/commerce/OrderItem.ts +51 -0
- package/dist/models/commerce/Payment.ts +182 -0
- package/dist/models/commerce/Pledge.ts +112 -0
- package/dist/models/commerce/PrintDevice.ts +120 -0
- package/dist/models/commerce/Product.ts +153 -0
- package/dist/models/commerce/ProductUnit.ts +113 -0
- package/dist/models/commerce/ProductVariant.ts +111 -0
- package/dist/models/commerce/Receipt.ts +144 -0
- package/dist/models/commerce/Review.ts +171 -0
- package/dist/models/commerce/ShippingMethod.ts +102 -0
- package/dist/models/commerce/ShippingRate.ts +79 -0
- package/dist/models/commerce/ShippingZone.ts +116 -0
- package/dist/models/commerce/TaxRate.ts +167 -0
- package/dist/models/commerce/Transaction.ts +127 -0
- package/dist/models/commerce/WaitlistProduct.ts +151 -0
- package/dist/models/commerce/WaitlistRestaurant.ts +189 -0
- package/dist/models/realtime/Websocket.ts +78 -0
- package/dist/password-policy.ts +46 -0
- package/package.json +4 -4
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { defineModel } from '@stacksjs/orm'
|
|
2
|
+
import { schema } from '@stacksjs/validation'
|
|
3
|
+
|
|
4
|
+
export default defineModel({
|
|
5
|
+
name: 'NotificationDelivery',
|
|
6
|
+
table: 'notification_deliveries',
|
|
7
|
+
primaryKey: 'id',
|
|
8
|
+
autoIncrement: true,
|
|
9
|
+
|
|
10
|
+
traits: {
|
|
11
|
+
useTimestamps: true,
|
|
12
|
+
useSearch: {
|
|
13
|
+
displayable: ['id', 'channel', 'recipient', 'subject', 'status', 'sentAt'],
|
|
14
|
+
searchable: ['recipient', 'subject', 'body', 'error'],
|
|
15
|
+
sortable: ['channel', 'recipient', 'status', 'sentAt', 'createdAt'],
|
|
16
|
+
filterable: ['channel', 'status'],
|
|
17
|
+
},
|
|
18
|
+
useApi: {
|
|
19
|
+
uri: 'notification-deliveries',
|
|
20
|
+
routes: ['index', 'show', 'destroy'],
|
|
21
|
+
middleware: ['auth'],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
attributes: {
|
|
26
|
+
userId: {
|
|
27
|
+
required: false,
|
|
28
|
+
fillable: true,
|
|
29
|
+
validation: {
|
|
30
|
+
rule: schema.number(),
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
channel: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
required: true,
|
|
37
|
+
fillable: true,
|
|
38
|
+
validation: {
|
|
39
|
+
rule: schema.enum(['email', 'sms', 'chat', 'database', 'push', 'broadcast']),
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
recipient: {
|
|
44
|
+
required: true,
|
|
45
|
+
fillable: true,
|
|
46
|
+
validation: {
|
|
47
|
+
rule: schema.string().max(1000),
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
subject: {
|
|
52
|
+
required: false,
|
|
53
|
+
fillable: true,
|
|
54
|
+
validation: {
|
|
55
|
+
rule: schema.string().max(255),
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
body: {
|
|
60
|
+
required: true,
|
|
61
|
+
fillable: true,
|
|
62
|
+
validation: {
|
|
63
|
+
rule: schema.string().max(10000),
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
status: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
required: true,
|
|
70
|
+
fillable: true,
|
|
71
|
+
default: 'pending',
|
|
72
|
+
validation: {
|
|
73
|
+
rule: schema.enum(['pending', 'sent', 'delivered', 'failed']),
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
error: {
|
|
78
|
+
required: false,
|
|
79
|
+
fillable: true,
|
|
80
|
+
validation: {
|
|
81
|
+
rule: schema.string().max(5000),
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
metadata: {
|
|
86
|
+
type: 'text',
|
|
87
|
+
required: false,
|
|
88
|
+
fillable: true,
|
|
89
|
+
validation: {
|
|
90
|
+
rule: schema.string(),
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
sentAt: {
|
|
95
|
+
required: false,
|
|
96
|
+
fillable: true,
|
|
97
|
+
validation: {
|
|
98
|
+
rule: schema.timestamp(),
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
} as const)
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { defineModel } from '@stacksjs/orm'
|
|
2
|
+
import { collect } from '@stacksjs/collections'
|
|
3
|
+
|
|
4
|
+
import { schema } from '@stacksjs/validation'
|
|
5
|
+
|
|
6
|
+
export default defineModel({
|
|
7
|
+
name: 'PaymentMethod', // defaults to the sanitized file name
|
|
8
|
+
table: 'payment_methods', // defaults to the lowercase, plural name of the model name (or the name of the model file)
|
|
9
|
+
primaryKey: 'id', // defaults to `id`
|
|
10
|
+
autoIncrement: true, // defaults to true
|
|
11
|
+
belongsTo: ['User'],
|
|
12
|
+
hasMany: ['PaymentTransaction'],
|
|
13
|
+
traits: {
|
|
14
|
+
useSeeder: {
|
|
15
|
+
count: 5,
|
|
16
|
+
},
|
|
17
|
+
useUuid: true,
|
|
18
|
+
},
|
|
19
|
+
attributes: {
|
|
20
|
+
type: {
|
|
21
|
+
fillable: true,
|
|
22
|
+
validation: {
|
|
23
|
+
rule: schema.string().required().max(512),
|
|
24
|
+
message: {
|
|
25
|
+
string: 'type must be a string',
|
|
26
|
+
required: 'type is required',
|
|
27
|
+
max: 'type must have a maximum of 512 characters',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
factory: () => 'card',
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
lastFour: {
|
|
34
|
+
fillable: true,
|
|
35
|
+
validation: {
|
|
36
|
+
rule: schema.number().required(),
|
|
37
|
+
message: {
|
|
38
|
+
number: 'last_four must be a number',
|
|
39
|
+
required: 'last_four is required',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
factory: faker => faker.string.numeric(4),
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
brand: {
|
|
46
|
+
fillable: true,
|
|
47
|
+
validation: {
|
|
48
|
+
rule: schema.string().required().max(50),
|
|
49
|
+
message: {
|
|
50
|
+
number: 'brand must be a number',
|
|
51
|
+
required: 'brand is required',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
factory: () => collect(['visa', 'mastercard', 'amex', 'jcb']).random().first(),
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
expMonth: {
|
|
58
|
+
fillable: true,
|
|
59
|
+
validation: {
|
|
60
|
+
rule: schema.number().required(),
|
|
61
|
+
message: {
|
|
62
|
+
string: 'exp_month must be a number',
|
|
63
|
+
required: 'exp_month is required',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
factory: faker => faker.number.int({ min: 1, max: 12 }),
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
expYear: {
|
|
70
|
+
fillable: true,
|
|
71
|
+
validation: {
|
|
72
|
+
rule: schema.number().required(),
|
|
73
|
+
message: {
|
|
74
|
+
string: 'exp_year must be a number',
|
|
75
|
+
required: 'exp_year is required',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
factory: faker => faker.number.int({ min: 2024, max: 2050 }),
|
|
79
|
+
},
|
|
80
|
+
isDefault: {
|
|
81
|
+
fillable: true,
|
|
82
|
+
validation: {
|
|
83
|
+
rule: schema.boolean(),
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
providerId: {
|
|
87
|
+
fillable: true,
|
|
88
|
+
validation: {
|
|
89
|
+
rule: schema.string().max(255),
|
|
90
|
+
message: {
|
|
91
|
+
string: 'provider_id must be a string',
|
|
92
|
+
required: 'provider_id is required',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
factory: faker => faker.string.alphanumeric(10),
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
} as const)
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { defineModel } from '@stacksjs/orm'
|
|
2
|
+
import { schema } from '@stacksjs/validation'
|
|
3
|
+
|
|
4
|
+
export default defineModel({
|
|
5
|
+
name: 'PaymentProduct', // defaults to the sanitized file name
|
|
6
|
+
table: 'payment_products', // defaults to the lowercase, plural name of the model name (or the name of the model file)
|
|
7
|
+
primaryKey: 'id', // defaults to `id`
|
|
8
|
+
autoIncrement: true, // defaults to true
|
|
9
|
+
traits: {
|
|
10
|
+
useSeeder: {
|
|
11
|
+
count: 10,
|
|
12
|
+
},
|
|
13
|
+
useUuid: true,
|
|
14
|
+
},
|
|
15
|
+
attributes: {
|
|
16
|
+
name: {
|
|
17
|
+
fillable: true,
|
|
18
|
+
validation: {
|
|
19
|
+
rule: schema.string().required().max(512),
|
|
20
|
+
message: {
|
|
21
|
+
string: 'type must be a string',
|
|
22
|
+
required: 'type is required',
|
|
23
|
+
max: 'type must have a maximum of 512 characters',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
factory: faker => faker.food.dish(),
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
description: {
|
|
30
|
+
fillable: true,
|
|
31
|
+
validation: {
|
|
32
|
+
rule: schema.string(),
|
|
33
|
+
message: {
|
|
34
|
+
string: 'description must be a string',
|
|
35
|
+
required: 'description is required',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
factory: faker => faker.lorem.lines(3),
|
|
39
|
+
},
|
|
40
|
+
key: {
|
|
41
|
+
fillable: true,
|
|
42
|
+
validation: {
|
|
43
|
+
rule: schema.string().required(),
|
|
44
|
+
message: {
|
|
45
|
+
string: 'key must be a string',
|
|
46
|
+
required: 'key is required',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
factory: faker => faker.string.alphanumeric(5),
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
unitPrice: {
|
|
53
|
+
fillable: true,
|
|
54
|
+
validation: {
|
|
55
|
+
rule: schema.number().required(),
|
|
56
|
+
message: {
|
|
57
|
+
string: 'expires must be a string',
|
|
58
|
+
required: 'expires is required',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
factory: faker => faker.number.int({ min: 1000, max: 10000 }),
|
|
62
|
+
},
|
|
63
|
+
status: {
|
|
64
|
+
fillable: true,
|
|
65
|
+
validation: {
|
|
66
|
+
rule: schema.string(),
|
|
67
|
+
},
|
|
68
|
+
factory: faker => faker.lorem.lines(1),
|
|
69
|
+
},
|
|
70
|
+
image: {
|
|
71
|
+
fillable: true,
|
|
72
|
+
validation: {
|
|
73
|
+
rule: schema.string(),
|
|
74
|
+
message: {
|
|
75
|
+
string: 'image must be a string',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
factory: faker => faker.image.url(),
|
|
79
|
+
},
|
|
80
|
+
providerId: {
|
|
81
|
+
fillable: true,
|
|
82
|
+
validation: {
|
|
83
|
+
rule: schema.string().max(255),
|
|
84
|
+
message: {
|
|
85
|
+
string: 'provider_id must be a string',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
factory: faker => faker.string.alphanumeric(10),
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
} as const)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { defineModel } from '@stacksjs/orm'
|
|
2
|
+
import { collect } from '@stacksjs/collections'
|
|
3
|
+
|
|
4
|
+
import { schema } from '@stacksjs/validation'
|
|
5
|
+
|
|
6
|
+
export default defineModel({
|
|
7
|
+
name: 'PaymentTransaction', // defaults to the sanitized file name
|
|
8
|
+
table: 'payment_transactions', // defaults to the lowercase, plural name of the model name (or the name of the model file)
|
|
9
|
+
primaryKey: 'id', // defaults to `id`
|
|
10
|
+
autoIncrement: true, // defaults to true
|
|
11
|
+
belongsTo: ['User', 'PaymentMethod'],
|
|
12
|
+
traits: {
|
|
13
|
+
useUuid: true,
|
|
14
|
+
useSeeder: {
|
|
15
|
+
count: 5,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
attributes: {
|
|
19
|
+
name: {
|
|
20
|
+
fillable: true,
|
|
21
|
+
validation: {
|
|
22
|
+
rule: schema.string().required().max(255),
|
|
23
|
+
message: {
|
|
24
|
+
string: 'name must be a string',
|
|
25
|
+
required: 'name is required',
|
|
26
|
+
max: 'name must have a maximum of 255 characters',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
factory: () => 'Dashboard Subscription',
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
description: {
|
|
33
|
+
fillable: true,
|
|
34
|
+
validation: {
|
|
35
|
+
rule: schema.string(),
|
|
36
|
+
message: {
|
|
37
|
+
string: 'description must be a string',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
factory: faker => faker.lorem.lines(2),
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
amount: {
|
|
44
|
+
fillable: true,
|
|
45
|
+
validation: {
|
|
46
|
+
rule: schema.number().required(),
|
|
47
|
+
message: {
|
|
48
|
+
number: 'amount must be a number',
|
|
49
|
+
required: 'amount is required',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
factory: faker => faker.number.int({ min: 1000, max: 10000 }),
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
type: {
|
|
56
|
+
fillable: true,
|
|
57
|
+
validation: {
|
|
58
|
+
rule: schema.string().required().max(50),
|
|
59
|
+
message: {
|
|
60
|
+
string: 'type must be a string',
|
|
61
|
+
max: 'type must have a maximum of 512 characters',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
factory: () => collect(['one-time', 'subscription']).random().first(),
|
|
65
|
+
},
|
|
66
|
+
providerId: {
|
|
67
|
+
fillable: true,
|
|
68
|
+
validation: {
|
|
69
|
+
rule: schema.string().max(255),
|
|
70
|
+
message: {
|
|
71
|
+
string: 'provider_id must be a number',
|
|
72
|
+
required: 'provider_id is required',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
factory: faker => faker.string.alphanumeric(10),
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
} as const)
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { defineModel } from '@stacksjs/orm'
|
|
2
|
+
import { schema } from '@stacksjs/validation'
|
|
3
|
+
|
|
4
|
+
export default defineModel({
|
|
5
|
+
name: 'QueryLog',
|
|
6
|
+
table: 'query_logs',
|
|
7
|
+
primaryKey: 'id',
|
|
8
|
+
autoIncrement: true,
|
|
9
|
+
|
|
10
|
+
indexes: [
|
|
11
|
+
{
|
|
12
|
+
name: 'query_logs_executed_at_index',
|
|
13
|
+
columns: ['executed_at'],
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'query_logs_status_index',
|
|
17
|
+
columns: ['status'],
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'query_logs_duration_index',
|
|
21
|
+
columns: ['duration'],
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
|
|
25
|
+
traits: {
|
|
26
|
+
useTimestamps: true,
|
|
27
|
+
useApi: {
|
|
28
|
+
uri: 'query-logs',
|
|
29
|
+
routes: ['index', 'show'],
|
|
30
|
+
middleware: ['auth'],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
attributes: {
|
|
35
|
+
query: {
|
|
36
|
+
required: true,
|
|
37
|
+
fillable: true,
|
|
38
|
+
type: 'text',
|
|
39
|
+
validation: {
|
|
40
|
+
rule: schema.string().required(),
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
normalized_query: {
|
|
44
|
+
fillable: true,
|
|
45
|
+
type: 'text',
|
|
46
|
+
validation: {
|
|
47
|
+
rule: schema.string(),
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
duration: {
|
|
51
|
+
fillable: true,
|
|
52
|
+
default: 0,
|
|
53
|
+
validation: {
|
|
54
|
+
rule: schema.number().min(0),
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
connection: {
|
|
58
|
+
fillable: true,
|
|
59
|
+
default: 'unknown',
|
|
60
|
+
validation: {
|
|
61
|
+
rule: schema.string().max(255),
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
status: {
|
|
65
|
+
fillable: true,
|
|
66
|
+
default: 'completed',
|
|
67
|
+
validation: {
|
|
68
|
+
rule: schema.enum(['completed', 'failed', 'slow']),
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
error: {
|
|
72
|
+
fillable: true,
|
|
73
|
+
type: 'text',
|
|
74
|
+
validation: {
|
|
75
|
+
rule: schema.string(),
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
executed_at: {
|
|
79
|
+
required: true,
|
|
80
|
+
fillable: true,
|
|
81
|
+
validation: {
|
|
82
|
+
rule: schema.string().required(),
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
bindings: {
|
|
86
|
+
hidden: true,
|
|
87
|
+
fillable: true,
|
|
88
|
+
type: 'text',
|
|
89
|
+
validation: {
|
|
90
|
+
rule: schema.string(),
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
trace: {
|
|
94
|
+
hidden: true,
|
|
95
|
+
fillable: true,
|
|
96
|
+
type: 'text',
|
|
97
|
+
validation: {
|
|
98
|
+
rule: schema.string(),
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
model: {
|
|
102
|
+
fillable: true,
|
|
103
|
+
validation: {
|
|
104
|
+
rule: schema.string().max(255),
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
method: {
|
|
108
|
+
fillable: true,
|
|
109
|
+
validation: {
|
|
110
|
+
rule: schema.string().max(255),
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
file: {
|
|
114
|
+
hidden: true,
|
|
115
|
+
fillable: true,
|
|
116
|
+
validation: {
|
|
117
|
+
rule: schema.string(),
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
line: {
|
|
121
|
+
fillable: true,
|
|
122
|
+
validation: {
|
|
123
|
+
rule: schema.number().min(0),
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
memory_usage: {
|
|
127
|
+
fillable: true,
|
|
128
|
+
validation: {
|
|
129
|
+
rule: schema.number().min(0),
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
rows_affected: {
|
|
133
|
+
fillable: true,
|
|
134
|
+
validation: {
|
|
135
|
+
rule: schema.number().min(0),
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
transaction_id: {
|
|
139
|
+
fillable: true,
|
|
140
|
+
foreignKey: false,
|
|
141
|
+
validation: {
|
|
142
|
+
rule: schema.string().max(255),
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
tags: {
|
|
146
|
+
fillable: true,
|
|
147
|
+
validation: {
|
|
148
|
+
rule: schema.string(),
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
affected_tables: {
|
|
152
|
+
fillable: true,
|
|
153
|
+
validation: {
|
|
154
|
+
rule: schema.string(),
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
indexes_used: {
|
|
158
|
+
fillable: true,
|
|
159
|
+
validation: {
|
|
160
|
+
rule: schema.string(),
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
missing_indexes: {
|
|
164
|
+
fillable: true,
|
|
165
|
+
validation: {
|
|
166
|
+
rule: schema.string(),
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
explain_plan: {
|
|
170
|
+
fillable: true,
|
|
171
|
+
validation: {
|
|
172
|
+
rule: schema.string(),
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
optimization_suggestions: {
|
|
176
|
+
fillable: true,
|
|
177
|
+
validation: {
|
|
178
|
+
rule: schema.string(),
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
} as const)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# What are Models
|
|
2
|
+
|
|
3
|
+
Models are a way to define the structure of your data. They are used to interact with your database, and can be used to define relationships between different types of data.
|
|
4
|
+
|
|
5
|
+
## Get Started
|
|
6
|
+
|
|
7
|
+
The following command will bootstrap a new model in the `app/Models` directory.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
buddy make:model User
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 🚜 Contributing
|
|
14
|
+
|
|
15
|
+
Please review the [Contributing Guide](https://github.com/stacksjs/contributing) for details.
|
|
16
|
+
|
|
17
|
+
## 🏝 Community
|
|
18
|
+
|
|
19
|
+
For help, discussion about best practices, or any other conversation that would benefit from being searchable:
|
|
20
|
+
|
|
21
|
+
[Discussions on GitHub](https://github.com/stacksjs/stacks/discussions)
|
|
22
|
+
|
|
23
|
+
For casual chit-chat with others using this package:
|
|
24
|
+
|
|
25
|
+
[Join the Stacks Discord Server](https://stacksjs.com/discord)
|
|
26
|
+
|
|
27
|
+
## 📄 License
|
|
28
|
+
|
|
29
|
+
The MIT License (MIT). Please see [LICENSE](../../LICENSE.md) for more information.
|
|
30
|
+
|
|
31
|
+
Made with 💙
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { defineModel } from '@stacksjs/orm'
|
|
2
|
+
import { schema } from '@stacksjs/validation'
|
|
3
|
+
|
|
4
|
+
export default defineModel({
|
|
5
|
+
name: 'Release',
|
|
6
|
+
table: 'releases',
|
|
7
|
+
primaryKey: 'id',
|
|
8
|
+
autoIncrement: true,
|
|
9
|
+
|
|
10
|
+
traits: {
|
|
11
|
+
useUuid: true,
|
|
12
|
+
useTimestamps: true,
|
|
13
|
+
useSearch: {
|
|
14
|
+
displayable: ['id', 'version', 'type', 'status', 'createdAt'],
|
|
15
|
+
searchable: ['version', 'type', 'notes'],
|
|
16
|
+
sortable: ['createdAt', 'version'],
|
|
17
|
+
filterable: ['type', 'status'],
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
useApi: {
|
|
21
|
+
// Public catalog: anyone may browse, only authenticated callers may
|
|
22
|
+
// write. Declared explicitly because the trait now defaults BOTH sides to
|
|
23
|
+
// `auth` — an undeclared read route is how a customer list leaks
|
|
24
|
+
// (stacksjs/stacks#2224). Behaviour here is unchanged.
|
|
25
|
+
middleware: { read: [], write: ['auth'] },
|
|
26
|
+
uri: 'releases',
|
|
27
|
+
routes: ['index', 'show'],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
attributes: {
|
|
32
|
+
version: {
|
|
33
|
+
order: 1,
|
|
34
|
+
fillable: true,
|
|
35
|
+
validation: {
|
|
36
|
+
rule: schema.string().required().max(50),
|
|
37
|
+
},
|
|
38
|
+
factory: faker => faker.system.semver(),
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
type: {
|
|
42
|
+
order: 2,
|
|
43
|
+
fillable: true,
|
|
44
|
+
validation: {
|
|
45
|
+
rule: schema.string().required(),
|
|
46
|
+
},
|
|
47
|
+
factory: faker => faker.helpers.arrayElement(['major', 'minor', 'patch']),
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
status: {
|
|
51
|
+
order: 3,
|
|
52
|
+
fillable: true,
|
|
53
|
+
validation: {
|
|
54
|
+
rule: schema.string().required(),
|
|
55
|
+
},
|
|
56
|
+
factory: faker => faker.helpers.arrayElement(['published', 'draft', 'scheduled']),
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
notes: {
|
|
60
|
+
order: 4,
|
|
61
|
+
fillable: true,
|
|
62
|
+
validation: {
|
|
63
|
+
rule: schema.string(),
|
|
64
|
+
},
|
|
65
|
+
factory: faker => faker.lorem.paragraph(),
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
downloads: {
|
|
69
|
+
order: 5,
|
|
70
|
+
fillable: true,
|
|
71
|
+
validation: {
|
|
72
|
+
rule: schema.number().min(0),
|
|
73
|
+
},
|
|
74
|
+
factory: faker => faker.number.int({ min: 0, max: 50000 }),
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
author: {
|
|
78
|
+
order: 6,
|
|
79
|
+
fillable: true,
|
|
80
|
+
validation: {
|
|
81
|
+
rule: schema.string().max(255),
|
|
82
|
+
},
|
|
83
|
+
factory: faker => faker.person.fullName(),
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
dashboard: {
|
|
88
|
+
highlight: true,
|
|
89
|
+
},
|
|
90
|
+
} as const)
|