Skip to content

Commit bbccdc8

Browse files
chore: wip
1 parent e3e0da4 commit bbccdc8

19 files changed

+62
-57
lines changed

storage/framework/actions/src/UserShowOrmAction.ts

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

13-
const result = await User.find(1)
13+
const result = await User.create({
14+
job_title: 'dev',
15+
name: 'Glenn',
16+
password: '123456',
17+
email: 'gtorregosa@gmail.com',
18+
})
1419

1520
return response.json(result)
1621
},

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function generateCustomSetters(model: Model): { output: string, loopString: stri
4141

4242
loopString += `
4343
for (const [key, fn] of Object.entries(customSetter)) {
44-
model[key] = fn()
44+
model[key] = await fn()
4545
}`
4646
}
4747

@@ -952,7 +952,7 @@ export async function generateModelString(
952952
}
953953
}
954954
955-
mapCustomSetters(model: ${modelName}JsonResponse): void {
955+
async mapCustomSetters(model: ${modelName}JsonResponse): Promise<void> {
956956
const customSetter = {
957957
${setterOutput.output}
958958
}
@@ -1647,13 +1647,13 @@ export async function generateModelString(
16471647
}
16481648
16491649
async create(new${modelName}: New${modelName}): Promise<${modelName}Model> {
1650-
return await this.create(new${modelName})
1650+
return await this.applyCreate(new${modelName})
16511651
}
16521652
16531653
static async create(new${modelName}: New${modelName}): Promise<${modelName}Model> {
16541654
const instance = new ${modelName}Model(null)
16551655
1656-
return await instance.create(new${modelName})
1656+
return await instance.applyCreate(new${modelName})
16571657
}
16581658
16591659
static async createMany(new${modelName}: New${modelName}[]): Promise<void> {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export class AccessTokenModel {
107107
}
108108
}
109109

110-
mapCustomSetters(model: AccessTokenJsonResponse): void {
110+
async mapCustomSetters(model: AccessTokenJsonResponse): Promise<void> {
111111
const customSetter = {
112112

113113
}
@@ -853,13 +853,13 @@ export class AccessTokenModel {
853853
}
854854

855855
async create(newAccessToken: NewAccessToken): Promise<AccessTokenModel> {
856-
return await this.create(newAccessToken)
856+
return await this.applyCreate(newAccessToken)
857857
}
858858

859859
static async create(newAccessToken: NewAccessToken): Promise<AccessTokenModel> {
860860
const instance = new AccessTokenModel(null)
861861

862-
return await instance.create(newAccessToken)
862+
return await instance.applyCreate(newAccessToken)
863863
}
864864

865865
static async createMany(newAccessToken: NewAccessToken[]): Promise<void> {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export class ActivityModel {
106106
}
107107
}
108108

109-
mapCustomSetters(model: ActivityJsonResponse): void {
109+
async mapCustomSetters(model: ActivityJsonResponse): Promise<void> {
110110
const customSetter = {
111111

112112
}
@@ -876,13 +876,13 @@ export class ActivityModel {
876876
}
877877

878878
async create(newActivity: NewActivity): Promise<ActivityModel> {
879-
return await this.create(newActivity)
879+
return await this.applyCreate(newActivity)
880880
}
881881

882882
static async create(newActivity: NewActivity): Promise<ActivityModel> {
883883
const instance = new ActivityModel(null)
884884

885-
return await instance.create(newActivity)
885+
return await instance.applyCreate(newActivity)
886886
}
887887

888888
static async createMany(newActivity: NewActivity[]): Promise<void> {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export class DeploymentModel {
112112
}
113113
}
114114

115-
mapCustomSetters(model: DeploymentJsonResponse): void {
115+
async mapCustomSetters(model: DeploymentJsonResponse): Promise<void> {
116116
const customSetter = {
117117

118118
}
@@ -892,13 +892,13 @@ export class DeploymentModel {
892892
}
893893

894894
async create(newDeployment: NewDeployment): Promise<DeploymentModel> {
895-
return await this.create(newDeployment)
895+
return await this.applyCreate(newDeployment)
896896
}
897897

898898
static async create(newDeployment: NewDeployment): Promise<DeploymentModel> {
899899
const instance = new DeploymentModel(null)
900900

901-
return await instance.create(newDeployment)
901+
return await instance.applyCreate(newDeployment)
902902
}
903903

904904
static async createMany(newDeployment: NewDeployment[]): Promise<void> {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class ErrorModel {
103103
}
104104
}
105105

106-
mapCustomSetters(model: ErrorJsonResponse): void {
106+
async mapCustomSetters(model: ErrorJsonResponse): Promise<void> {
107107
const customSetter = {
108108

109109
}
@@ -849,13 +849,13 @@ export class ErrorModel {
849849
}
850850

851851
async create(newError: NewError): Promise<ErrorModel> {
852-
return await this.create(newError)
852+
return await this.applyCreate(newError)
853853
}
854854

855855
static async create(newError: NewError): Promise<ErrorModel> {
856856
const instance = new ErrorModel(null)
857857

858-
return await instance.create(newError)
858+
return await instance.applyCreate(newError)
859859
}
860860

861861
static async createMany(newError: NewError[]): Promise<void> {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class FailedJobModel {
103103
}
104104
}
105105

106-
mapCustomSetters(model: FailedJobJsonResponse): void {
106+
async mapCustomSetters(model: FailedJobJsonResponse): Promise<void> {
107107
const customSetter = {
108108

109109
}
@@ -849,13 +849,13 @@ export class FailedJobModel {
849849
}
850850

851851
async create(newFailedJob: NewFailedJob): Promise<FailedJobModel> {
852-
return await this.create(newFailedJob)
852+
return await this.applyCreate(newFailedJob)
853853
}
854854

855855
static async create(newFailedJob: NewFailedJob): Promise<FailedJobModel> {
856856
const instance = new FailedJobModel(null)
857857

858-
return await instance.create(newFailedJob)
858+
return await instance.applyCreate(newFailedJob)
859859
}
860860

861861
static async createMany(newFailedJob: NewFailedJob[]): Promise<void> {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class JobModel {
103103
}
104104
}
105105

106-
mapCustomSetters(model: JobJsonResponse): void {
106+
async mapCustomSetters(model: JobJsonResponse): Promise<void> {
107107
const customSetter = {
108108

109109
}
@@ -849,13 +849,13 @@ export class JobModel {
849849
}
850850

851851
async create(newJob: NewJob): Promise<JobModel> {
852-
return await this.create(newJob)
852+
return await this.applyCreate(newJob)
853853
}
854854

855855
static async create(newJob: NewJob): Promise<JobModel> {
856856
const instance = new JobModel(null)
857857

858-
return await instance.create(newJob)
858+
return await instance.applyCreate(newJob)
859859
}
860860

861861
static async createMany(newJob: NewJob[]): Promise<void> {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export class PaymentMethodModel {
115115
}
116116
}
117117

118-
mapCustomSetters(model: PaymentMethodJsonResponse): void {
118+
async mapCustomSetters(model: PaymentMethodJsonResponse): Promise<void> {
119119
const customSetter = {
120120

121121
}
@@ -899,13 +899,13 @@ export class PaymentMethodModel {
899899
}
900900

901901
async create(newPaymentMethod: NewPaymentMethod): Promise<PaymentMethodModel> {
902-
return await this.create(newPaymentMethod)
902+
return await this.applyCreate(newPaymentMethod)
903903
}
904904

905905
static async create(newPaymentMethod: NewPaymentMethod): Promise<PaymentMethodModel> {
906906
const instance = new PaymentMethodModel(null)
907907

908-
return await instance.create(newPaymentMethod)
908+
return await instance.applyCreate(newPaymentMethod)
909909
}
910910

911911
static async createMany(newPaymentMethod: NewPaymentMethod[]): Promise<void> {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class PostModel {
105105
}
106106
}
107107

108-
mapCustomSetters(model: PostJsonResponse): void {
108+
async mapCustomSetters(model: PostJsonResponse): Promise<void> {
109109
const customSetter = {
110110

111111
}
@@ -835,13 +835,13 @@ export class PostModel {
835835
}
836836

837837
async create(newPost: NewPost): Promise<PostModel> {
838-
return await this.create(newPost)
838+
return await this.applyCreate(newPost)
839839
}
840840

841841
static async create(newPost: NewPost): Promise<PostModel> {
842842
const instance = new PostModel(null)
843843

844-
return await instance.create(newPost)
844+
return await instance.applyCreate(newPost)
845845
}
846846

847847
static async createMany(newPost: NewPost[]): Promise<void> {

0 commit comments

Comments
 (0)