Skip to content

Commit 2871d2e

Browse files
committed
chore: wip
1 parent 320fd83 commit 2871d2e

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

app/Models/Subscriber.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default {
1818
// relationships
1919
belongsTo: 'User',
2020

21-
fields: {
21+
attributes: {
2222
subscribed: {
2323
validator: {
2424
rule: schema.boolean(),

app/Models/User.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default {
3737
// useUuid: true, // defaults to false
3838
},
3939

40-
fields: {
40+
attributes: {
4141
name: {
4242
validator: {
4343
rule: schema.string().minLength(3).maxLength(255),

config/database.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ export default {
2222
secret: env.AWS_SECRET_ACCESS_KEY || '',
2323
region: env.AWS_DEFAULT_REGION || 'us-east-1',
2424
prefix: env.DB_DATABASE || 'stacks',
25-
endpoint: '',
25+
endpoint: 'http://localhost',
26+
port: env.DB_PORT || 8000,
2627
},
2728

2829
mysql: {

storage/framework/core/server/src/config.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ports } from '@stacksjs/config'
22

33
interface ServerOptions {
4-
type?: 'frontend' | 'backend' | 'api' | 'library' | 'desktop' | 'docs' | 'email' | 'admin' | 'system-tray'
4+
type?: 'frontend' | 'backend' | 'api' | 'library' | 'desktop' | 'docs' | 'email' | 'admin' | 'system-tray' | 'database'
55
host?: string
66
port?: number
77
open?: boolean
@@ -58,9 +58,14 @@ export function config(options: ServerOptions) {
5858
host: 'localhost',
5959
port: ports.systemTray,
6060
},
61+
62+
'database': {
63+
host: 'localhost',
64+
port: ports.database,
65+
}
6166
}
6267

63-
if (options.type && ['frontend', 'api', 'library', 'desktop', 'docs', 'example', 'dashboard', 'system-tray'].includes(options.type)) {
68+
if (options.type && ['frontend', 'api', 'library', 'desktop', 'docs', 'example', 'dashboard', 'system-tray', 'database'].includes(options.type)) {
6469
return {
6570
host: serversMap[options.type].host,
6671
port: serversMap[options.type].port,

storage/framework/core/types/src/model.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export interface ModelOptions extends Base {
5858
useApi?: boolean | ApiOptions
5959
}
6060

61-
fields: Fields
61+
attributes: Attributes
6262

6363
// relationships
6464
hasOne: string // hasOne: 'Post'
@@ -74,13 +74,6 @@ export interface ModelOptions extends Base {
7474
using: string
7575
}
7676

77-
attributes: {
78-
[key: string]: {
79-
get: (value: any) => any
80-
set: (value: any) => any
81-
}
82-
}
83-
8477
get: {
8578
[key: string]: (value: any) => any
8679
}
@@ -90,7 +83,7 @@ export interface ModelOptions extends Base {
9083
}
9184
}
9285

93-
export interface FieldOptions {
86+
export interface Attribute {
9487
default?: string | number | boolean | Date
9588
unique?: boolean
9689
required?: boolean
@@ -102,8 +95,8 @@ export interface FieldOptions {
10295
// validation?: String | Number | Boolean | Date
10396
}
10497

105-
export interface Fields {
106-
[key: string]: FieldOptions
98+
export interface Attributes {
99+
[key: string]: Attribute
107100
}
108101

109102
export type Model = Partial<ModelOptions>

storage/framework/core/types/src/ports.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ export interface Ports {
1616
inspect: number
1717
api: number // the bun server
1818
systemTray: number
19+
database: number // i.e. DynamoDB local
1920
}

0 commit comments

Comments
 (0)