File tree Expand file tree Collapse file tree 4 files changed +37
-2
lines changed Expand file tree Collapse file tree 4 files changed +37
-2
lines changed Original file line number Diff line number Diff line change 1
1
export { default as AccessToken } from '../../../orm/src/models/AccessToken'
2
+
2
3
export { default as Deployment } from '../../../orm/src/models/Deployment'
4
+
3
5
export { default as Error } from '../../../orm/src/models/Error'
6
+
4
7
export { default as FailedJob } from '../../../orm/src/models/FailedJob'
8
+
5
9
export { default as Job } from '../../../orm/src/models/Job'
10
+
6
11
export { default as PaymentMethod } from '../../../orm/src/models/PaymentMethod'
12
+
7
13
export { default as Post } from '../../../orm/src/models/Post'
14
+
8
15
export { default as Product } from '../../../orm/src/models/Product'
16
+
9
17
export { default as Project } from '../../../orm/src/models/Project'
18
+
10
19
export { default as Release } from '../../../orm/src/models/Release'
20
+
11
21
export { default as Subscriber } from '../../../orm/src/models/Subscriber'
22
+
12
23
export { default as SubscriberEmail } from '../../../orm/src/models/SubscriberEmail'
24
+
13
25
export { default as Subscription } from '../../../orm/src/models/Subscription'
26
+
14
27
export { default as Team } from '../../../orm/src/models/Team'
28
+
15
29
export { default as Transaction } from '../../../orm/src/models/Transaction'
30
+
16
31
export { default as User } from '../../../orm/src/models/User'
Original file line number Diff line number Diff line change @@ -2575,6 +2575,8 @@ export async function generateModelFiles(modelStringFile?: string): Promise<void
2575
2575
await generateApiRoutes ( coreModelFiles )
2576
2576
log . success ( 'Generated API Routes' )
2577
2577
2578
+ await writeModelOrmImports ( [ ...modelFiles , ...coreModelFiles ] )
2579
+
2578
2580
for ( const modelFile of modelFiles ) {
2579
2581
if ( modelStringFile && modelStringFile !== modelFile )
2580
2582
continue
@@ -2628,6 +2630,24 @@ export async function generateModelFiles(modelStringFile?: string): Promise<void
2628
2630
}
2629
2631
}
2630
2632
2633
+ async function writeModelOrmImports ( modelFiles : string [ ] ) : Promise < void > {
2634
+ let ormImportString = ``
2635
+ for ( const modelFile of modelFiles ) {
2636
+ const model = ( await import ( modelFile ) ) . default as Model
2637
+
2638
+ const modelName = getModelName ( model , modelFile )
2639
+
2640
+ ormImportString += `export { default as ${ modelName } } from '../../../orm/src/models/${ modelName } '\n\n`
2641
+ }
2642
+
2643
+ const file = Bun . file ( path . frameworkPath ( `core/orm/src/models.ts` ) )
2644
+ const writer = file . writer ( )
2645
+
2646
+ writer . write ( ormImportString )
2647
+
2648
+ await writer . end ( )
2649
+ }
2650
+
2631
2651
export async function extractAttributesFromModel ( filePath : string ) : Promise < Attributes > {
2632
2652
// Read the TypeScript file
2633
2653
const content = fs . readFileSync ( filePath , 'utf8' )
Original file line number Diff line number Diff line change @@ -199,7 +199,7 @@ export class Router implements RouterInterface {
199
199
200
200
const prefix = options . prefix || '/'
201
201
const formattedPrefix = prefix . startsWith ( '/' ) ? prefix : `/${ prefix } `
202
-
202
+
203
203
if ( options . prefix ) {
204
204
r . path = formattedPrefix + r . uri
205
205
r . uri = formattedPrefix + r . uri
Original file line number Diff line number Diff line change 1
1
import type { JobOptions } from '@stacksjs/types'
2
2
import { err , type Err , ok , type Ok } from '@stacksjs/error-handling'
3
+ import { log } from '@stacksjs/logging'
3
4
import { path } from '@stacksjs/path'
4
5
import { fs , globSync } from '@stacksjs/storage'
5
6
import { snakeCase } from '@stacksjs/strings'
6
7
import { Every } from '@stacksjs/types'
7
- import { log } from '@stacksjs/logging'
8
8
9
9
interface JobSchedule {
10
10
jobName : string
You can’t perform that action at this time.
0 commit comments