Skip to content

Commit 4692a45

Browse files
chore: wip
1 parent 467acb8 commit 4692a45

21 files changed

+58
-59
lines changed

storage/framework/actions/src/UserShowOrmAction.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ export default new Action({
1010
// async handle(request: UserRequestType) {
1111
// const id = request.getParam('id')
1212

13-
const user = await User.whereDoesntHave('posts', (query) => {
14-
query.where('job_title', 'Regional Brand Executive')
15-
}).first()
13+
const user = User.where('job_title')
1614

1715
// user?.update({ job_title: 'Senior Software Engineer' })
1816
// user?.delete()

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,7 +1705,7 @@ export async function generateModelString(
17051705
.execute()
17061706
}
17071707
1708-
applyWhere(instance: ${modelName}Model, column: string, ...args: any[]): ${modelName}Model {
1708+
applyWhere(instance: ${modelName}Model, column: keyof ${formattedTableName}Table, ...args: any[]): ${modelName}Model {
17091709
const [operatorOrValue, value] = args
17101710
const operator = value === undefined ? '=' : operatorOrValue
17111711
const actualValue = value === undefined ? operatorOrValue : value
@@ -1717,11 +1717,11 @@ export async function generateModelString(
17171717
return instance
17181718
}
17191719
1720-
where(column: string, ...args: any[]): ${modelName}Model {
1720+
where(column: keyof ${formattedTableName}Table, ...args: any[]): ${modelName}Model {
17211721
return this.applyWhere(this, column, ...args)
17221722
}
17231723
1724-
static where(column: string, ...args: any[]): ${modelName}Model {
1724+
static where(column: keyof ${formattedTableName}Table, ...args: any[]): ${modelName}Model {
17251725
const instance = new ${modelName}Model(null)
17261726
17271727
return instance.applyWhere(instance, column, ...args)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ export class AccessTokenModel {
910910
.execute()
911911
}
912912

913-
applyWhere(instance: AccessTokenModel, column: string, ...args: any[]): AccessTokenModel {
913+
applyWhere(instance: AccessTokenModel, column: keyof PersonalAccessTokensTable, ...args: any[]): AccessTokenModel {
914914
const [operatorOrValue, value] = args
915915
const operator = value === undefined ? '=' : operatorOrValue
916916
const actualValue = value === undefined ? operatorOrValue : value
@@ -922,11 +922,11 @@ export class AccessTokenModel {
922922
return instance
923923
}
924924

925-
where(column: string, ...args: any[]): AccessTokenModel {
925+
where(column: keyof PersonalAccessTokensTable, ...args: any[]): AccessTokenModel {
926926
return this.applyWhere(this, column, ...args)
927927
}
928928

929-
static where(column: string, ...args: any[]): AccessTokenModel {
929+
static where(column: keyof PersonalAccessTokensTable, ...args: any[]): AccessTokenModel {
930930
const instance = new AccessTokenModel(null)
931931

932932
return instance.applyWhere(instance, column, ...args)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ export class ActivityModel {
944944
.execute()
945945
}
946946

947-
applyWhere(instance: ActivityModel, column: string, ...args: any[]): ActivityModel {
947+
applyWhere(instance: ActivityModel, column: keyof ActivitiesTable, ...args: any[]): ActivityModel {
948948
const [operatorOrValue, value] = args
949949
const operator = value === undefined ? '=' : operatorOrValue
950950
const actualValue = value === undefined ? operatorOrValue : value
@@ -956,11 +956,11 @@ export class ActivityModel {
956956
return instance
957957
}
958958

959-
where(column: string, ...args: any[]): ActivityModel {
959+
where(column: keyof ActivitiesTable, ...args: any[]): ActivityModel {
960960
return this.applyWhere(this, column, ...args)
961961
}
962962

963-
static where(column: string, ...args: any[]): ActivityModel {
963+
static where(column: keyof ActivitiesTable, ...args: any[]): ActivityModel {
964964
const instance = new ActivityModel(null)
965965

966966
return instance.applyWhere(instance, column, ...args)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ export class DeploymentModel {
951951
.execute()
952952
}
953953

954-
applyWhere(instance: DeploymentModel, column: string, ...args: any[]): DeploymentModel {
954+
applyWhere(instance: DeploymentModel, column: keyof DeploymentsTable, ...args: any[]): DeploymentModel {
955955
const [operatorOrValue, value] = args
956956
const operator = value === undefined ? '=' : operatorOrValue
957957
const actualValue = value === undefined ? operatorOrValue : value
@@ -963,11 +963,11 @@ export class DeploymentModel {
963963
return instance
964964
}
965965

966-
where(column: string, ...args: any[]): DeploymentModel {
966+
where(column: keyof DeploymentsTable, ...args: any[]): DeploymentModel {
967967
return this.applyWhere(this, column, ...args)
968968
}
969969

970-
static where(column: string, ...args: any[]): DeploymentModel {
970+
static where(column: keyof DeploymentsTable, ...args: any[]): DeploymentModel {
971971
const instance = new DeploymentModel(null)
972972

973973
return instance.applyWhere(instance, column, ...args)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ export class ErrorModel {
906906
.execute()
907907
}
908908

909-
applyWhere(instance: ErrorModel, column: string, ...args: any[]): ErrorModel {
909+
applyWhere(instance: ErrorModel, column: keyof ErrorsTable, ...args: any[]): ErrorModel {
910910
const [operatorOrValue, value] = args
911911
const operator = value === undefined ? '=' : operatorOrValue
912912
const actualValue = value === undefined ? operatorOrValue : value
@@ -918,11 +918,11 @@ export class ErrorModel {
918918
return instance
919919
}
920920

921-
where(column: string, ...args: any[]): ErrorModel {
921+
where(column: keyof ErrorsTable, ...args: any[]): ErrorModel {
922922
return this.applyWhere(this, column, ...args)
923923
}
924924

925-
static where(column: string, ...args: any[]): ErrorModel {
925+
static where(column: keyof ErrorsTable, ...args: any[]): ErrorModel {
926926
const instance = new ErrorModel(null)
927927

928928
return instance.applyWhere(instance, column, ...args)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ export class FailedJobModel {
906906
.execute()
907907
}
908908

909-
applyWhere(instance: FailedJobModel, column: string, ...args: any[]): FailedJobModel {
909+
applyWhere(instance: FailedJobModel, column: keyof FailedJobsTable, ...args: any[]): FailedJobModel {
910910
const [operatorOrValue, value] = args
911911
const operator = value === undefined ? '=' : operatorOrValue
912912
const actualValue = value === undefined ? operatorOrValue : value
@@ -918,11 +918,11 @@ export class FailedJobModel {
918918
return instance
919919
}
920920

921-
where(column: string, ...args: any[]): FailedJobModel {
921+
where(column: keyof FailedJobsTable, ...args: any[]): FailedJobModel {
922922
return this.applyWhere(this, column, ...args)
923923
}
924924

925-
static where(column: string, ...args: any[]): FailedJobModel {
925+
static where(column: keyof FailedJobsTable, ...args: any[]): FailedJobModel {
926926
const instance = new FailedJobModel(null)
927927

928928
return instance.applyWhere(instance, column, ...args)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ export class JobModel {
906906
.execute()
907907
}
908908

909-
applyWhere(instance: JobModel, column: string, ...args: any[]): JobModel {
909+
applyWhere(instance: JobModel, column: keyof JobsTable, ...args: any[]): JobModel {
910910
const [operatorOrValue, value] = args
911911
const operator = value === undefined ? '=' : operatorOrValue
912912
const actualValue = value === undefined ? operatorOrValue : value
@@ -918,11 +918,11 @@ export class JobModel {
918918
return instance
919919
}
920920

921-
where(column: string, ...args: any[]): JobModel {
921+
where(column: keyof JobsTable, ...args: any[]): JobModel {
922922
return this.applyWhere(this, column, ...args)
923923
}
924924

925-
static where(column: string, ...args: any[]): JobModel {
925+
static where(column: keyof JobsTable, ...args: any[]): JobModel {
926926
const instance = new JobModel(null)
927927

928928
return instance.applyWhere(instance, column, ...args)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ export class PaymentMethodModel {
958958
.execute()
959959
}
960960

961-
applyWhere(instance: PaymentMethodModel, column: string, ...args: any[]): PaymentMethodModel {
961+
applyWhere(instance: PaymentMethodModel, column: keyof PaymentMethodsTable, ...args: any[]): PaymentMethodModel {
962962
const [operatorOrValue, value] = args
963963
const operator = value === undefined ? '=' : operatorOrValue
964964
const actualValue = value === undefined ? operatorOrValue : value
@@ -970,11 +970,11 @@ export class PaymentMethodModel {
970970
return instance
971971
}
972972

973-
where(column: string, ...args: any[]): PaymentMethodModel {
973+
where(column: keyof PaymentMethodsTable, ...args: any[]): PaymentMethodModel {
974974
return this.applyWhere(this, column, ...args)
975975
}
976976

977-
static where(column: string, ...args: any[]): PaymentMethodModel {
977+
static where(column: keyof PaymentMethodsTable, ...args: any[]): PaymentMethodModel {
978978
const instance = new PaymentMethodModel(null)
979979

980980
return instance.applyWhere(instance, column, ...args)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ export class PostModel {
892892
.execute()
893893
}
894894

895-
applyWhere(instance: PostModel, column: string, ...args: any[]): PostModel {
895+
applyWhere(instance: PostModel, column: keyof PostsTable, ...args: any[]): PostModel {
896896
const [operatorOrValue, value] = args
897897
const operator = value === undefined ? '=' : operatorOrValue
898898
const actualValue = value === undefined ? operatorOrValue : value
@@ -904,11 +904,11 @@ export class PostModel {
904904
return instance
905905
}
906906

907-
where(column: string, ...args: any[]): PostModel {
907+
where(column: keyof PostsTable, ...args: any[]): PostModel {
908908
return this.applyWhere(this, column, ...args)
909909
}
910910

911-
static where(column: string, ...args: any[]): PostModel {
911+
static where(column: keyof PostsTable, ...args: any[]): PostModel {
912912
const instance = new PostModel(null)
913913

914914
return instance.applyWhere(instance, column, ...args)

0 commit comments

Comments
 (0)