Skip to content

Commit c620dcf

Browse files
chore: wip
1 parent 2477783 commit c620dcf

File tree

23 files changed

+74
-24
lines changed

23 files changed

+74
-24
lines changed

app/Models/AccessToken.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default {
2121

2222
attributes: {
2323
name: {
24+
fillable: true,
2425
validation: {
2526
rule: schema.string(),
2627
message: {
@@ -33,6 +34,7 @@ export default {
3334
},
3435

3536
token: {
37+
fillable: true,
3638
unique: true,
3739
validation: {
3840
rule: schema.string().maxLength(512),
@@ -47,6 +49,7 @@ export default {
4749
},
4850

4951
plainTextToken: {
52+
fillable: true,
5053
validation: {
5154
rule: schema.string().maxLength(512),
5255
message: {
@@ -60,6 +63,7 @@ export default {
6063
},
6164

6265
abilities: {
66+
fillable: true,
6367
validation: {
6468
rule: schema.enum(['read', 'write', 'admin', 'read|write', 'read|admin', 'write|admin', 'read|write|admin']),
6569
message: {
@@ -71,7 +75,7 @@ export default {
7175
},
7276

7377
factory: () =>
74-
collect(['read', 'write', 'admin', 'read|write', 'read|admin', 'write|admin', 'read|write|admin']).random(),
78+
collect(['read', 'write', 'admin', 'read|write', 'read|admin', 'write|admin', 'read|write|admin']).random().toString(),
7579
},
7680
},
7781
} satisfies Model

app/Models/Deployment.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default {
2222
attributes: {
2323
commitSha: {
2424
unique: true,
25-
25+
fillable: true,
2626
validation: {
2727
rule: schema.string().maxLength(512),
2828
message: {
@@ -36,6 +36,7 @@ export default {
3636
},
3737

3838
commitMessage: {
39+
fillable: true,
3940
validation: {
4041
rule: schema.string(),
4142
message: {
@@ -48,6 +49,7 @@ export default {
4849
},
4950

5051
branch: {
52+
fillable: true,
5153
validation: {
5254
rule: schema.string(),
5355
message: {
@@ -60,6 +62,7 @@ export default {
6062
},
6163

6264
status: {
65+
fillable: true,
6366
validation: {
6467
rule: schema.string(),
6568
message: {
@@ -68,10 +71,11 @@ export default {
6871
},
6972
},
7073

71-
factory: () => collect(['pending', 'success', 'failure']).random(),
74+
factory: () => collect(['pending', 'success', 'failure']).random().toString(),
7275
},
7376

7477
executionTime: {
78+
fillable: true,
7579
// in nanoseconds
7680
validation: {
7781
rule: schema.number(),
@@ -85,6 +89,7 @@ export default {
8589
},
8690

8791
deployScript: {
92+
fillable: true,
8893
validation: {
8994
rule: schema.string(),
9095
message: {
@@ -97,6 +102,7 @@ export default {
97102
},
98103

99104
terminalOutput: {
105+
fillable: true,
100106
validation: {
101107
rule: schema.string(),
102108
message: {

app/Models/Post.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export default {
2424

2525
attributes: {
2626
title: {
27+
fillable: true,
2728
validation: {
2829
rule: schema.string(),
2930
message: {
@@ -36,6 +37,7 @@ export default {
3637
},
3738

3839
body: {
40+
fillable: true,
3941
validation: {
4042
rule: schema.string(),
4143
message: {

app/Models/Project.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Model } from '@stacksjs/types'
2-
import { collect } from '@stacksjs/collections'
32
import { faker } from '@stacksjs/faker'
43
import { schema } from '@stacksjs/validation'
4+
import { collect } from '@stacksjs/collections'
55

66
export default {
77
name: 'Project', // defaults to the sanitized file name
@@ -19,6 +19,7 @@ export default {
1919

2020
attributes: {
2121
name: {
22+
fillable: true,
2223
validation: {
2324
rule: schema.string(),
2425
message: {
@@ -31,6 +32,7 @@ export default {
3132
},
3233

3334
description: {
35+
fillable: true,
3436
validation: {
3537
rule: schema.string(),
3638
message: {
@@ -43,6 +45,7 @@ export default {
4345
},
4446

4547
url: {
48+
fillable: true,
4649
validation: {
4750
rule: schema.string(),
4851
message: {
@@ -55,6 +58,7 @@ export default {
5558
},
5659

5760
status: {
61+
fillable: true,
5862
validation: {
5963
rule: schema.string(),
6064
message: {
@@ -63,7 +67,7 @@ export default {
6367
},
6468
},
6569

66-
factory: () => collect(['active', 'inactive']).random(),
70+
factory: () => collect(['active', 'inactive']).random().toString(),
6771
},
6872
},
6973
} satisfies Model

app/Models/Release.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export default {
3333
// },
3434

3535
version: {
36+
fillable: true,
3637
unique: true,
3738
validation: {
3839
rule: schema.string().maxLength(255),

app/Models/Subscriber.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export default {
1818

1919
attributes: {
2020
subscribed: {
21+
fillable: true,
2122
validation: {
2223
rule: schema.boolean(),
2324
message: {

app/Models/Team.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default {
2121

2222
attributes: {
2323
name: {
24+
fillable: true,
2425
validation: {
2526
rule: schema.string(),
2627
message: {
@@ -33,6 +34,7 @@ export default {
3334
},
3435

3536
companyName: {
37+
fillable: true,
3638
validation: {
3739
rule: schema.string(),
3840
message: {
@@ -45,6 +47,7 @@ export default {
4547
},
4648

4749
email: {
50+
fillable: true,
4851
validation: {
4952
rule: schema.string().email(),
5053
message: {
@@ -57,6 +60,7 @@ export default {
5760
},
5861

5962
billingEmail: {
63+
fillable: true,
6064
validation: {
6165
rule: schema.string().email(),
6266
message: {
@@ -69,6 +73,7 @@ export default {
6973
},
7074

7175
status: {
76+
fillable: true,
7277
validation: {
7378
rule: schema.string(),
7479
message: {
@@ -77,10 +82,11 @@ export default {
7782
},
7883
},
7984

80-
factory: () => collect(['deployed', 'inactive']).random(),
85+
factory: () => collect(['deployed', 'inactive']).random().toString(),
8186
},
8287

8388
description: {
89+
fillable: true,
8490
validation: {
8591
rule: schema.string(),
8692
message: {
@@ -93,6 +99,7 @@ export default {
9399
},
94100

95101
path: {
102+
fillable: true,
96103
validation: {
97104
rule: schema.string(),
98105
message: {
@@ -105,6 +112,7 @@ export default {
105112
},
106113

107114
isPersonal: {
115+
fillable: true,
108116
validation: {
109117
rule: schema.boolean(),
110118
message: {

storage/framework/core/database/src/seeder.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ async function seedModel(name: string, model?: Model) {
3232

3333
const otherRelations = await fetchOtherModelRelations(modelName)
3434

35-
console.log(otherRelations)
36-
3735
for (let i = 0; i < seedCount; i++) {
3836
const record: any = {}
3937

@@ -51,12 +49,11 @@ async function seedModel(name: string, model?: Model) {
5149
for (let j = 0; j < otherRelations.length; j++) {
5250
const relationElement = otherRelations[j] as RelationConfig
5351

54-
52+
5553
if (relationElement.relationship === 'belongsToMany') {
5654
await seedPivotRelation(relationElement)
5755
}
58-
59-
// record[relationElement?.foreignKey] = await seedModelRelation(relationElement?.relationModel as string)
56+
record[relationElement?.foreignKey] = await seedModelRelation(relationElement?.relationModel as string)
6057
}
6158
}
6259

storage/framework/core/orm/src/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ export async function getRelations(model: Model, modelName: string): Promise<Rel
9191
foreignKey: relationInstance.foreignKey || `${formattedModelName}_id`,
9292
modelKey: `${formattedModelRelationName}_id`,
9393
relationName: relationInstance.relationName || '',
94+
relationModel: modelName,
9495
throughModel: relationInstance.through || '',
9596
throughForeignKey: relationInstance.throughForeignKey || '',
9697
pivotTable:

storage/framework/database/models/AccessToken.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default {
2121

2222
attributes: {
2323
name: {
24+
fillable: true,
2425
validation: {
2526
rule: schema.string(),
2627
message: {
@@ -33,6 +34,7 @@ export default {
3334
},
3435

3536
token: {
37+
fillable: true,
3638
unique: true,
3739
validation: {
3840
rule: schema.string().maxLength(512),
@@ -47,6 +49,7 @@ export default {
4749
},
4850

4951
plainTextToken: {
52+
fillable: true,
5053
validation: {
5154
rule: schema.string().maxLength(512),
5255
message: {
@@ -60,6 +63,7 @@ export default {
6063
},
6164

6265
abilities: {
66+
fillable: true,
6367
validation: {
6468
rule: schema.enum(['read', 'write', 'admin', 'read|write', 'read|admin', 'write|admin', 'read|write|admin']),
6569
message: {
@@ -71,7 +75,7 @@ export default {
7175
},
7276

7377
factory: () =>
74-
collect(['read', 'write', 'admin', 'read|write', 'read|admin', 'write|admin', 'read|write|admin']).random(),
78+
collect(['read', 'write', 'admin', 'read|write', 'read|admin', 'write|admin', 'read|write|admin']).random().toString(),
7579
},
7680
},
7781
} satisfies Model

0 commit comments

Comments
 (0)