Skip to content

Commit 07c9edd

Browse files
chore: wip
1 parent c3a70f7 commit 07c9edd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+324
-156
lines changed

app/Models/AccessToken.ts

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,38 +21,52 @@ export default {
2121

2222
attributes: {
2323
name: {
24-
validator: {
24+
validation: {
2525
rule: schema.string(),
26-
message: '`name` must be a string',
26+
message: {
27+
string: 'name must be a string',
28+
required: 'name is required',
29+
},
2730
},
2831

2932
factory: () => faker.lorem.sentence({ min: 3, max: 6 }),
3033
},
3134

3235
token: {
3336
unique: true,
34-
validator: {
37+
validation: {
3538
rule: schema.string().maxLength(512),
36-
message: '`token` must be a string',
39+
message: {
40+
string: 'token must be a string',
41+
required: 'token is required',
42+
maxLength: 'token must have a maximum of 512 characters',
43+
},
3744
},
3845

3946
factory: () => faker.string.uuid(),
4047
},
4148

4249
plainTextToken: {
43-
validator: {
50+
validation: {
4451
rule: schema.string().maxLength(512),
45-
message: '`plainTextToken` must be a string',
52+
message: {
53+
string: 'plainTextToken must be a string',
54+
required: 'plainTextToken is required',
55+
maxLength: 'plainTextToken must have a maximum of 512 characters',
56+
},
4657
},
4758

4859
factory: () => faker.string.uuid(),
4960
},
5061

5162
abilities: {
52-
validator: {
63+
validation: {
5364
rule: schema.enum(['read', 'write', 'admin', 'read|write', 'read|admin', 'write|admin', 'read|write|admin']),
54-
message:
55-
'`abilities` must be string of either `read`, `write`, `admin`, `read|write`, `read|admin`, `write|admin`, or `read|write|admin`',
65+
message: {
66+
required: 'abilities is required',
67+
maxLength: 'plainTextToken must have a maximum of 512 characters',
68+
string: '`abilities` must be string of either `read`, `write`, `admin`, `read|write`, `read|admin`, `write|admin`, or `read|write|admin`',
69+
},
5670
},
5771

5872
factory: () =>

app/Models/Deployment.ts

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,64 +23,86 @@ export default {
2323
commitSha: {
2424
unique: true,
2525

26-
validator: {
26+
validation: {
2727
rule: schema.string().maxLength(512),
28-
message: '`commit_sha` must be a string',
28+
message: {
29+
string: 'commit_sha must be a string',
30+
required: 'commit_sha is required',
31+
maxLength: 'commit_sha must have a maximum of 512 characters',
32+
},
2933
},
3034

3135
factory: () => faker.git.commitSha(),
3236
},
3337

3438
commitMessage: {
35-
validator: {
39+
validation: {
3640
rule: schema.string(),
37-
message: '`commit_message` must be a string',
41+
message: {
42+
string: 'commit_message must be a string',
43+
required: 'commit_message is required',
44+
},
3845
},
3946

4047
factory: () => faker.git.commitMessage(),
4148
},
4249

4350
branch: {
44-
validator: {
51+
validation: {
4552
rule: schema.string(),
46-
message: '`branch` must be a string',
53+
message: {
54+
string: 'branch must be a string',
55+
required: 'branch is required',
56+
},
4757
},
4858

4959
factory: () => faker.git.branch(),
5060
},
5161

5262
status: {
53-
validator: {
63+
validation: {
5464
rule: schema.string(),
55-
message: '`status` must be a string',
65+
message: {
66+
string: 'status must be a string',
67+
required: 'status is required',
68+
},
5669
},
5770

5871
factory: () => collect(['pending', 'success', 'failure']).random(),
5972
},
6073

6174
executionTime: {
6275
// in nanoseconds
63-
validator: {
76+
validation: {
6477
rule: schema.number(),
65-
message: '`execution_time` must be a number',
78+
message: {
79+
number: 'execution_time must be a number',
80+
required: 'execution_time is required',
81+
},
6682
},
6783

6884
factory: () => faker.number.int({ max: 100 }),
6985
},
7086

7187
deployScript: {
72-
validator: {
88+
validation: {
7389
rule: schema.string(),
74-
message: '`deploy_script` must be a string',
90+
message: {
91+
string: 'deploy_script must be a string',
92+
required: 'deploy_script is required',
93+
},
7594
},
7695

7796
factory: () => faker.lorem.sentence(),
7897
},
7998

8099
terminalOutput: {
81-
validator: {
100+
validation: {
82101
rule: schema.string(),
83-
message: '`terminal_output` must be a string',
102+
message: {
103+
string: 'terminal_output must be a string',
104+
required: 'terminal_output is required',
105+
},
84106
},
85107

86108
factory: () => faker.lorem.sentence(),

app/Models/Post.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,24 @@ export default {
2424

2525
attributes: {
2626
title: {
27-
validator: {
27+
validation: {
2828
rule: schema.string(),
29-
message: '`title` must be a string',
29+
message: {
30+
string: 'title must be a string',
31+
required: 'title is required',
32+
},
3033
},
3134

3235
factory: () => faker.lorem.sentence({ min: 3, max: 6 }),
3336
},
3437

3538
body: {
36-
validator: {
39+
validation: {
3740
rule: schema.string(),
38-
message: '`body` must be a string',
41+
message: {
42+
string: 'body must be a string',
43+
required: 'body is required',
44+
},
3945
},
4046
factory: () => faker.lorem.sentence({ min: 10, max: 10 }),
4147
},

app/Models/Project.ts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,48 @@ export default {
1919

2020
attributes: {
2121
name: {
22-
validator: {
22+
validation: {
2323
rule: schema.string(),
24-
message: '`name` must be a string',
24+
message: {
25+
string: 'name must be a string',
26+
required: 'name is required',
27+
},
2528
},
2629

2730
factory: () => faker.lorem.sentence({ min: 3, max: 6 }),
2831
},
2932

3033
description: {
31-
validator: {
34+
validation: {
3235
rule: schema.string(),
33-
message: '`description` must be a string',
36+
message: {
37+
string: 'description must be a string',
38+
required: 'description is required',
39+
},
3440
},
3541

3642
factory: () => faker.lorem.sentence({ min: 10, max: 25 }),
3743
},
3844

3945
url: {
40-
validator: {
46+
validation: {
4147
rule: schema.string(),
42-
message: '`url` must be a string',
48+
message: {
49+
string: 'url must be a string',
50+
required: 'url is required',
51+
},
4352
},
4453

4554
factory: () => faker.internet.url(),
4655
},
4756

4857
status: {
49-
validator: {
58+
validation: {
5059
rule: schema.string(),
51-
message: '`status` must be a string',
60+
message: {
61+
string: 'status must be a string',
62+
required: 'status is required',
63+
},
5264
},
5365

5466
factory: () => collect(['active', 'inactive']).random(),

app/Models/Subscriber.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ export default {
2424

2525
attributes: {
2626
subscribed: {
27-
validator: {
27+
validation: {
2828
rule: schema.boolean(),
29-
message: '`subscribed` must be a boolean',
29+
message: {
30+
boolean: 'subscribed must be a boolean',
31+
required: 'subscribed is required',
32+
},
3033
},
3134

3235
factory: () => faker.datatype.boolean(),

app/Models/SubscriberEmail.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default {
2424
attributes: {
2525
email: {
2626
unique: true,
27-
validator: {
27+
validation: {
2828
rule: schema.string().email(),
2929
message: {
3030
email: 'Email must be valid',

app/Models/Team.ts

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,72 +21,96 @@ export default {
2121

2222
attributes: {
2323
name: {
24-
validator: {
24+
validation: {
2525
rule: schema.string(),
26-
message: '`name` must be a string',
26+
message: {
27+
string: 'name must be a string',
28+
required: 'name is required',
29+
},
2730
},
2831

2932
factory: () => faker.lorem.sentence({ min: 3, max: 6 }),
3033
},
3134

3235
companyName: {
33-
validator: {
36+
validation: {
3437
rule: schema.string(),
35-
message: '`companyName` must be a string',
38+
message: {
39+
string: 'companyName must be a string',
40+
required: 'companyName is required',
41+
},
3642
},
3743

3844
factory: () => faker.company.name(),
3945
},
4046

4147
email: {
42-
validator: {
48+
validation: {
4349
rule: schema.string().email(),
44-
message: '`email` must be a string',
50+
message: {
51+
email: 'email must be valid',
52+
required: 'email is required',
53+
},
4554
},
4655

4756
factory: () => faker.internet.email(),
4857
},
4958

5059
billingEmail: {
51-
validator: {
60+
validation: {
5261
rule: schema.string().email(),
53-
message: '`billingEmail` must be a string',
62+
message: {
63+
email: 'billingEmail must be a valid email',
64+
required: 'billingEmail is required',
65+
},
5466
},
5567

5668
factory: () => faker.internet.email(),
5769
},
5870

5971
status: {
60-
validator: {
72+
validation: {
6173
rule: schema.string(),
62-
message: '`status` must be a string',
74+
message: {
75+
string: 'status must be a string',
76+
required: 'status is required',
77+
},
6378
},
6479

6580
factory: () => collect(['deployed', 'inactive']).random(),
6681
},
6782

6883
description: {
69-
validator: {
84+
validation: {
7085
rule: schema.string(),
71-
message: '`description` must be a string',
86+
message: {
87+
string: 'description must be a string',
88+
required: 'description is required',
89+
},
7290
},
7391

7492
factory: () => faker.lorem.sentence({ min: 10, max: 30 }),
7593
},
7694

7795
path: {
78-
validator: {
96+
validation: {
7997
rule: schema.string(),
80-
message: '`path` must be a string',
98+
message: {
99+
string: 'path must be a string',
100+
required: 'path is required',
101+
},
81102
},
82103

83104
factory: () => `/Users/chrisbreuer/Code/${faker.lorem.words().toLowerCase().replace(/\s+/g, '-')}`,
84105
},
85106

86107
isPersonal: {
87-
validator: {
108+
validation: {
88109
rule: schema.boolean(),
89-
message: '`isPersonal` must be a boolean',
110+
message: {
111+
boolean: 'isPersonal must be a boolean',
112+
required: 'isPersonal is required',
113+
},
90114
},
91115

92116
factory: () => faker.datatype.boolean(),

0 commit comments

Comments
 (0)