-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d20ddd
commit b690b8c
Showing
3 changed files
with
192 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { faker } from '@stacksjs/faker' | ||
import type { Model } from '@stacksjs/types' | ||
import { schema } from '@stacksjs/validation' | ||
|
||
export default { | ||
name: 'AccessToken', // defaults to the sanitized file name | ||
table: 'access_tokens', // defaults to the lowercase, plural name of the model | ||
primaryKey: 'id', // defaults to `id` | ||
autoIncrement: true, // defaults to true | ||
|
||
hasOne: ['Team'], | ||
|
||
traits: { | ||
useTimestamps: true, // defaults to true | ||
useSeeder: { | ||
// defaults to a count of 10 | ||
count: 10, | ||
}, | ||
}, | ||
|
||
attributes: { | ||
name: { | ||
validator: { | ||
rule: schema.string(), | ||
message: '`name` must be a string', | ||
}, | ||
|
||
factory: () => faker.lorem.sentence({ min: 3, max: 6 }), | ||
}, | ||
|
||
token: { | ||
unique: true, | ||
validator: { | ||
rule: schema.string(), | ||
message: '`token` must be a string', | ||
}, | ||
|
||
factory: () => faker.random.uuid(), | ||
}, | ||
}, | ||
} satisfies Model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { faker } from '@stacksjs/faker' | ||
import type { Model } from '@stacksjs/types' | ||
import { schema } from '@stacksjs/validation' | ||
|
||
export default { | ||
name: 'Project', // defaults to the sanitized file name | ||
table: 'projects', // defaults to the lowercase, plural name of the model | ||
primaryKey: 'id', // defaults to `id` | ||
autoIncrement: true, // defaults to true | ||
|
||
traits: { | ||
useTimestamps: true, // defaults to true | ||
useSeeder: { | ||
// defaults to a count of 10 | ||
count: 10, | ||
}, | ||
}, | ||
|
||
attributes: { | ||
name: { | ||
validator: { | ||
rule: schema.string(), | ||
message: '`name` must be a string', | ||
}, | ||
|
||
factory: () => faker.lorem.sentence({ min: 3, max: 6 }), | ||
}, | ||
|
||
description: { | ||
validator: { | ||
rule: schema.string(), | ||
message: '`description` must be a string', | ||
}, | ||
|
||
factory: () => faker.lorem.sentence({ min: 10, max: 10 }), | ||
}, | ||
|
||
url: { | ||
validator: { | ||
rule: schema.string(), | ||
message: '`url` must be a string', | ||
}, | ||
|
||
factory: () => faker.internet.url(), | ||
}, | ||
|
||
status: { | ||
validator: { | ||
rule: schema.string(), | ||
message: '`status` must be a string', | ||
}, | ||
|
||
factory: () => faker.random.arrayElement(['active', 'inactive']), | ||
}, | ||
}, | ||
} satisfies Model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import { faker } from '@stacksjs/faker' | ||
import type { Model } from '@stacksjs/types' | ||
import { schema } from '@stacksjs/validation' | ||
|
||
export default { | ||
name: 'Team', // defaults to the sanitized file name | ||
table: 'teams', // defaults to the lowercase, plural name of the model | ||
primaryKey: 'id', // defaults to `id` | ||
autoIncrement: true, // defaults to true | ||
|
||
traits: { | ||
useTimestamps: true, // defaults to true | ||
useSeeder: { | ||
// defaults to a count of 10 | ||
count: 10, | ||
}, | ||
}, | ||
|
||
attributes: { | ||
name: { | ||
validator: { | ||
rule: schema.string(), | ||
message: '`name` must be a string', | ||
}, | ||
|
||
factory: () => faker.lorem.sentence({ min: 3, max: 6 }), | ||
}, | ||
|
||
companyName: { | ||
validator: { | ||
rule: schema.string(), | ||
message: '`companyName` must be a string', | ||
}, | ||
|
||
factory: () => faker.company.companyName(), | ||
}, | ||
|
||
email: { | ||
validator: { | ||
rule: schema.string().email(), | ||
message: '`email` must be a string', | ||
}, | ||
|
||
factory: () => faker.internet.email(), | ||
}, | ||
|
||
billingEmail: { | ||
validator: { | ||
rule: schema.string().email(), | ||
message: '`billingEmail` must be a string', | ||
}, | ||
|
||
factory: () => faker.internet.email(), | ||
}, | ||
|
||
status: { | ||
validator: { | ||
rule: schema.string(), | ||
message: '`status` must be a string', | ||
}, | ||
|
||
factory: () => faker.random.arrayElement(['deployed', 'inactive']), | ||
}, | ||
|
||
description: { | ||
validator: { | ||
rule: schema.string(), | ||
message: '`description` must be a string', | ||
}, | ||
|
||
factory: () => faker.lorem.sentence({ min: 10, max: 30 }), | ||
}, | ||
|
||
path: { | ||
validator: { | ||
rule: schema.string(), | ||
message: '`path` must be a string', | ||
}, | ||
|
||
factory: () => | ||
faker.random.arrayElement([ | ||
`/Users/chrisbreuer/Code/${faker.lorem.words().toLowerCase().replace(/\s+/g, '-')}`, | ||
]), | ||
}, | ||
|
||
isPersonal: { | ||
validator: { | ||
rule: schema.boolean(), | ||
message: '`isPersonal` must be a boolean', | ||
}, | ||
|
||
factory: () => faker.random.boolean(), | ||
}, | ||
}, | ||
} satisfies Model |