Skip to content

Commit cd4ccd1

Browse files
chore: wip
1 parent e4d9963 commit cd4ccd1

File tree

17 files changed

+50
-50
lines changed

17 files changed

+50
-50
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -728,8 +728,8 @@ export async function generateModelString(
728728
}
729729
730730
export class ${modelName}Model {
731-
private hidden = ${hidden}
732-
private fillable = ${fillable}
731+
private readonly hidden: Array<keyof ${modelName}JsonResponse> = ${hidden}
732+
private readonly fillable: Array<keyof ${modelName}JsonResponse> = ${fillable}
733733
private softDeletes = ${useSoftDeletes}
734734
protected selectFromQuery: any
735735
protected withRelations: string[]
@@ -744,7 +744,7 @@ export async function generateModelString(
744744
745745
Object.keys(${formattedModelName}).forEach(key => {
746746
if (!(key in this)) {
747-
this.customColumns[key] = (user as ${modelName}JsonResponse)[key]
747+
this.customColumns[key] = (${formattedModelName} as ${modelName}JsonResponse)[key]
748748
}
749749
})
750750
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ interface QueryOptions {
5050
}
5151

5252
export class AccessTokenModel {
53-
private hidden = []
54-
private fillable = ['name', 'token', 'plain_text_token', 'abilities', 'uuid', 'team_id']
53+
private readonly hidden: Array<keyof AccessTokenJsonResponse> = []
54+
private readonly fillable: Array<keyof AccessTokenJsonResponse> = ['name', 'token', 'plain_text_token', 'abilities', 'uuid', 'team_id']
5555
private softDeletes = false
5656
protected selectFromQuery: any
5757
protected withRelations: string[]
@@ -86,7 +86,7 @@ export class AccessTokenModel {
8686

8787
Object.keys(accesstoken).forEach((key) => {
8888
if (!(key in this)) {
89-
this.customColumns[key] = (user as AccessTokenJsonResponse)[key]
89+
this.customColumns[key] = (accesstoken as AccessTokenJsonResponse)[key]
9090
}
9191
})
9292
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ interface QueryOptions {
5555
}
5656

5757
export class DeploymentModel {
58-
private hidden = []
59-
private fillable = ['commit_sha', 'commit_message', 'branch', 'status', 'execution_time', 'deploy_script', 'terminal_output', 'uuid', 'user_id']
58+
private readonly hidden: Array<keyof DeploymentJsonResponse> = []
59+
private readonly fillable: Array<keyof DeploymentJsonResponse> = ['commit_sha', 'commit_message', 'branch', 'status', 'execution_time', 'deploy_script', 'terminal_output', 'uuid', 'user_id']
6060
private softDeletes = false
6161
protected selectFromQuery: any
6262
protected withRelations: string[]
@@ -99,7 +99,7 @@ export class DeploymentModel {
9999

100100
Object.keys(deployment).forEach((key) => {
101101
if (!(key in this)) {
102-
this.customColumns[key] = (user as DeploymentJsonResponse)[key]
102+
this.customColumns[key] = (deployment as DeploymentJsonResponse)[key]
103103
}
104104
})
105105
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ interface QueryOptions {
4646
}
4747

4848
export class ErrorModel {
49-
private hidden = []
50-
private fillable = ['type', 'message', 'stack', 'status', 'additional_info', 'uuid']
49+
private readonly hidden: Array<keyof ErrorJsonResponse> = []
50+
private readonly fillable: Array<keyof ErrorJsonResponse> = ['type', 'message', 'stack', 'status', 'additional_info', 'uuid']
5151
private softDeletes = false
5252
protected selectFromQuery: any
5353
protected withRelations: string[]
@@ -80,7 +80,7 @@ export class ErrorModel {
8080

8181
Object.keys(error).forEach((key) => {
8282
if (!(key in this)) {
83-
this.customColumns[key] = (user as ErrorJsonResponse)[key]
83+
this.customColumns[key] = (error as ErrorJsonResponse)[key]
8484
}
8585
})
8686
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ interface QueryOptions {
4646
}
4747

4848
export class FailedJobModel {
49-
private hidden = []
50-
private fillable = ['connection', 'queue', 'payload', 'exception', 'failed_at', 'uuid']
49+
private readonly hidden: Array<keyof FailedJobJsonResponse> = []
50+
private readonly fillable: Array<keyof FailedJobJsonResponse> = ['connection', 'queue', 'payload', 'exception', 'failed_at', 'uuid']
5151
private softDeletes = false
5252
protected selectFromQuery: any
5353
protected withRelations: string[]
@@ -80,7 +80,7 @@ export class FailedJobModel {
8080

8181
Object.keys(failedjob).forEach((key) => {
8282
if (!(key in this)) {
83-
this.customColumns[key] = (user as FailedJobJsonResponse)[key]
83+
this.customColumns[key] = (failedjob as FailedJobJsonResponse)[key]
8484
}
8585
})
8686
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ interface QueryOptions {
4646
}
4747

4848
export class JobModel {
49-
private hidden = []
50-
private fillable = ['queue', 'payload', 'attempts', 'available_at', 'reserved_at', 'uuid']
49+
private readonly hidden: Array<keyof JobJsonResponse> = []
50+
private readonly fillable: Array<keyof JobJsonResponse> = ['queue', 'payload', 'attempts', 'available_at', 'reserved_at', 'uuid']
5151
private softDeletes = false
5252
protected selectFromQuery: any
5353
protected withRelations: string[]
@@ -80,7 +80,7 @@ export class JobModel {
8080

8181
Object.keys(job).forEach((key) => {
8282
if (!(key in this)) {
83-
this.customColumns[key] = (user as JobJsonResponse)[key]
83+
this.customColumns[key] = (job as JobJsonResponse)[key]
8484
}
8585
})
8686
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ interface QueryOptions {
5959
}
6060

6161
export class PaymentMethodModel {
62-
private hidden = []
63-
private fillable = ['type', 'last_four', 'brand', 'exp_month', 'exp_year', 'is_default', 'provider_id', 'uuid', 'user_id']
62+
private readonly hidden: Array<keyof PaymentMethodJsonResponse> = []
63+
private readonly fillable: Array<keyof PaymentMethodJsonResponse> = ['type', 'last_four', 'brand', 'exp_month', 'exp_year', 'is_default', 'provider_id', 'uuid', 'user_id']
6464
private softDeletes = false
6565
protected selectFromQuery: any
6666
protected withRelations: string[]
@@ -105,7 +105,7 @@ export class PaymentMethodModel {
105105

106106
Object.keys(paymentmethod).forEach((key) => {
107107
if (!(key in this)) {
108-
this.customColumns[key] = (user as PaymentMethodJsonResponse)[key]
108+
this.customColumns[key] = (paymentmethod as PaymentMethodJsonResponse)[key]
109109
}
110110
})
111111
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ interface QueryOptions {
4848
}
4949

5050
export class PostModel {
51-
private hidden = []
52-
private fillable = ['title', 'body', 'uuid', 'user_id']
51+
private readonly hidden: Array<keyof PostJsonResponse> = []
52+
private readonly fillable: Array<keyof PostJsonResponse> = ['title', 'body', 'uuid', 'user_id']
5353
private softDeletes = false
5454
protected selectFromQuery: any
5555
protected withRelations: string[]
@@ -80,7 +80,7 @@ export class PostModel {
8080

8181
Object.keys(post).forEach((key) => {
8282
if (!(key in this)) {
83-
this.customColumns[key] = (user as PostJsonResponse)[key]
83+
this.customColumns[key] = (post as PostJsonResponse)[key]
8484
}
8585
})
8686
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ interface QueryOptions {
5050
}
5151

5252
export class ProductModel {
53-
private hidden = []
54-
private fillable = ['name', 'description', 'key', 'unit_price', 'status', 'image', 'provider_id', 'uuid']
53+
private readonly hidden: Array<keyof ProductJsonResponse> = []
54+
private readonly fillable: Array<keyof ProductJsonResponse> = ['name', 'description', 'key', 'unit_price', 'status', 'image', 'provider_id', 'uuid']
5555
private softDeletes = false
5656
protected selectFromQuery: any
5757
protected withRelations: string[]
@@ -90,7 +90,7 @@ export class ProductModel {
9090

9191
Object.keys(product).forEach((key) => {
9292
if (!(key in this)) {
93-
this.customColumns[key] = (user as ProductJsonResponse)[key]
93+
this.customColumns[key] = (product as ProductJsonResponse)[key]
9494
}
9595
})
9696
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ interface QueryOptions {
4545
}
4646

4747
export class ProjectModel {
48-
private hidden = []
49-
private fillable = ['name', 'description', 'url', 'status', 'uuid']
48+
private readonly hidden: Array<keyof ProjectJsonResponse> = []
49+
private readonly fillable: Array<keyof ProjectJsonResponse> = ['name', 'description', 'url', 'status', 'uuid']
5050
private softDeletes = false
5151
protected selectFromQuery: any
5252
protected withRelations: string[]
@@ -77,7 +77,7 @@ export class ProjectModel {
7777

7878
Object.keys(project).forEach((key) => {
7979
if (!(key in this)) {
80-
this.customColumns[key] = (user as ProjectJsonResponse)[key]
80+
this.customColumns[key] = (project as ProjectJsonResponse)[key]
8181
}
8282
})
8383
}

0 commit comments

Comments
 (0)