Skip to content

Commit 23f5b1a

Browse files
chore: wip
1 parent e832b20 commit 23f5b1a

File tree

6 files changed

+16
-2
lines changed

6 files changed

+16
-2
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,9 @@ export async function generateModelString(
11751175
if (relationType === 'belongsType' && !relationCount) {
11761176
const relationName = camelCase(relation.relationName || formattedModelRelation)
11771177

1178-
fieldString += `${relationName}?: any\n`
1178+
declareFields += `public ${snakeCase(relationName)}: any\n`
1179+
constructorFields += `this.${snakeCase(relationName)} = ${formattedModelName}?.${snakeCase(relationName)}\n`
1180+
fieldString += `${snakeCase(relationName)}?: any\n`
11791181
relationString += `
11801182
model.${relationName} = await instance.${relationName}()\n
11811183
`

storage/framework/orm/src/models/Deployment.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export class DeploymentModel {
6161
protected updateFromQuery: any
6262
protected deleteFromQuery: any
6363
protected hasSelect: boolean
64+
public user: any
6465
public id: number
6566
public uuid: string | undefined
6667
public commit_sha: string | undefined
@@ -76,6 +77,7 @@ export class DeploymentModel {
7677
public user_id: number | undefined
7778

7879
constructor(deployment: Partial<DeploymentType> | null) {
80+
this.user = deployment?.user
7981
this.id = deployment?.id || 1
8082
this.uuid = deployment?.uuid
8183
this.commit_sha = deployment?.commit_sha

storage/framework/orm/src/models/PaymentMethod.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export class PaymentMethodModel {
6464
protected updateFromQuery: any
6565
protected deleteFromQuery: any
6666
protected hasSelect: boolean
67+
public user: any
6768
public id: number
6869
public uuid: string | undefined
6970
public type: string | undefined
@@ -80,6 +81,7 @@ export class PaymentMethodModel {
8081
public transaction_id: number | undefined
8182

8283
constructor(paymentmethod: Partial<PaymentMethodType> | null) {
84+
this.user = paymentmethod?.user
8385
this.id = paymentmethod?.id || 1
8486
this.uuid = paymentmethod?.uuid
8587
this.type = paymentmethod?.type

storage/framework/orm/src/models/Post.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export class PostModel {
5454
protected updateFromQuery: any
5555
protected deleteFromQuery: any
5656
protected hasSelect: boolean
57+
public user: any
5758
public id: number
5859
public title: string | undefined
5960
public body: string | undefined
@@ -63,6 +64,7 @@ export class PostModel {
6364
public user_id: number | undefined
6465

6566
constructor(post: Partial<PostType> | null) {
67+
this.user = post?.user
6668
this.id = post?.id || 1
6769
this.title = post?.title
6870
this.body = post?.body

storage/framework/orm/src/models/Subscription.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export class SubscriptionModel {
6464
protected updateFromQuery: any
6565
protected deleteFromQuery: any
6666
protected hasSelect: boolean
67+
public user: any
6768
public id: number
6869
public uuid: string | undefined
6970
public type: string | undefined
@@ -82,6 +83,7 @@ export class SubscriptionModel {
8283
public user_id: number | undefined
8384

8485
constructor(subscription: Partial<SubscriptionType> | null) {
86+
this.user = subscription?.user
8587
this.id = subscription?.id || 1
8688
this.uuid = subscription?.uuid
8789
this.type = subscription?.type

storage/framework/orm/src/models/Transaction.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import User from './User'
1111
export interface TransactionsTable {
1212
id?: number
1313
user?: any
14-
paymentMethod?: any
14+
payment_method?: any
1515
name?: string
1616
description?: string
1717
amount?: number
@@ -63,6 +63,8 @@ export class TransactionModel {
6363
protected updateFromQuery: any
6464
protected deleteFromQuery: any
6565
protected hasSelect: boolean
66+
public user: any
67+
public payment_method: any
6668
public id: number
6769
public uuid: string | undefined
6870
public name: string | undefined
@@ -77,6 +79,8 @@ export class TransactionModel {
7779
public paymentmethod_id: number | undefined
7880

7981
constructor(transaction: Partial<TransactionType> | null) {
82+
this.user = transaction?.user
83+
this.payment_method = transaction?.payment_method
8084
this.id = transaction?.id || 1
8185
this.uuid = transaction?.uuid
8286
this.name = transaction?.name

0 commit comments

Comments
 (0)