Skip to content

Commit a56c8ce

Browse files
chore: wip
1 parent ad9da6d commit a56c8ce

27 files changed

+2484
-1288
lines changed

app/Models/CourtHouse.ts

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
import type { Model } from '@stacksjs/types'
2+
import { schema } from '@stacksjs/validation'
3+
4+
export default {
5+
name: 'CourtHouse',
6+
table: 'court_houses',
7+
primaryKey: 'id',
8+
autoIncrement: true,
9+
10+
indexes: [
11+
{
12+
name: 'court_houses_name_index',
13+
columns: ['name'],
14+
},
15+
],
16+
17+
traits: {
18+
useUuid: true,
19+
useTimestamps: true,
20+
useSearch: {
21+
displayable: ['id', 'name', 'image'],
22+
searchable: ['name'],
23+
sortable: ['created_at', 'updated_at'],
24+
filterable: [],
25+
},
26+
27+
useSeeder: {
28+
count: 10,
29+
},
30+
31+
useApi: {
32+
uri: 'court-houses',
33+
routes: ['index', 'store', 'show'],
34+
},
35+
36+
observe: true,
37+
},
38+
39+
hasMany: ['Judge'],
40+
41+
attributes: {
42+
name: {
43+
required: true,
44+
order: 1,
45+
fillable: true,
46+
validation: {
47+
rule: schema.string().min(3).max(255),
48+
message: {
49+
min: 'Name must have a minimum of 3 characters',
50+
max: 'Name must have a maximum of 255 characters',
51+
},
52+
},
53+
factory: faker => faker.company.name(),
54+
},
55+
56+
image: {
57+
required: true,
58+
order: 2,
59+
fillable: true,
60+
validation: {
61+
rule: schema.string().url(),
62+
message: {
63+
url: 'Image URL must be a valid URL',
64+
},
65+
},
66+
factory: faker => faker.image.url(),
67+
},
68+
69+
address: {
70+
required: true,
71+
order: 3,
72+
fillable: true,
73+
validation: {
74+
rule: schema.string().min(5).max(255),
75+
message: {
76+
min: 'Address must have a minimum of 5 characters',
77+
max: 'Address must have a maximum of 255 characters',
78+
},
79+
},
80+
factory: faker => faker.location.streetAddress(),
81+
},
82+
83+
city: {
84+
required: true,
85+
order: 4,
86+
fillable: true,
87+
validation: {
88+
rule: schema.string().min(2).max(100),
89+
message: {
90+
min: 'City must have a minimum of 2 characters',
91+
max: 'City must have a maximum of 100 characters',
92+
},
93+
},
94+
factory: faker => faker.location.city(),
95+
},
96+
97+
state: {
98+
required: true,
99+
order: 5,
100+
fillable: true,
101+
validation: {
102+
rule: schema.string().min(2).max(2),
103+
message: {
104+
min: 'State must be 2 characters',
105+
max: 'State must be 2 characters',
106+
},
107+
},
108+
factory: faker => faker.location.state({ abbreviated: true }),
109+
},
110+
111+
zipCode: {
112+
required: true,
113+
order: 6,
114+
fillable: true,
115+
validation: {
116+
rule: schema.string().length(5),
117+
message: {
118+
length: 'Zip code must be 5 characters',
119+
},
120+
},
121+
factory: faker => faker.location.zipCode(),
122+
},
123+
},
124+
125+
dashboard: {
126+
highlight: true,
127+
},
128+
} satisfies Model

app/Models/Deployment.ts

Lines changed: 0 additions & 123 deletions
This file was deleted.

app/Models/Judge.ts

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import type { Model } from '@stacksjs/types'
2+
import { schema } from '@stacksjs/validation'
3+
4+
export default {
5+
name: 'Judge',
6+
table: 'judges',
7+
primaryKey: 'id',
8+
autoIncrement: true,
9+
10+
indexes: [
11+
{
12+
name: 'judges_name_index',
13+
columns: ['name'],
14+
},
15+
],
16+
17+
traits: {
18+
useUuid: true,
19+
useTimestamps: true,
20+
useSearch: {
21+
displayable: ['id', 'name', 'imageUrl'],
22+
searchable: ['name'],
23+
sortable: ['created_at', 'updated_at'],
24+
filterable: [],
25+
},
26+
27+
useSeeder: {
28+
count: 10,
29+
},
30+
31+
useApi: {
32+
uri: 'judges',
33+
routes: ['index', 'store', 'show'],
34+
},
35+
36+
observe: true,
37+
},
38+
39+
belongsTo: ['CourtHouse'],
40+
41+
attributes: {
42+
name: {
43+
required: true,
44+
order: 1,
45+
fillable: true,
46+
validation: {
47+
rule: schema.string().min(3).max(255),
48+
message: {
49+
min: 'Name must have a minimum of 3 characters',
50+
max: 'Name must have a maximum of 255 characters',
51+
},
52+
},
53+
factory: faker => faker.person.fullName(),
54+
},
55+
56+
imageUrl: {
57+
required: true,
58+
order: 2,
59+
fillable: true,
60+
validation: {
61+
rule: schema.string().url(),
62+
message: {
63+
url: 'Image URL must be a valid URL',
64+
},
65+
},
66+
factory: faker => faker.image.url(),
67+
},
68+
},
69+
70+
dashboard: {
71+
highlight: true,
72+
},
73+
} satisfies Model

0 commit comments

Comments
 (0)