Skip to content

Commit da25570

Browse files
chore: wip
1 parent 9dedcc1 commit da25570

18 files changed

+9
-38
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,29 @@ function generateCustomAccessors(model: Model): { customGetterVar: string, loopS
3636
return { customGetterVar, loopString }
3737
}
3838

39-
function generateCustomSetters(model: Model): { output: string, loopString: string } {
39+
function generateCustomSetters(model: Model): { customSetterVar: string, loopString: string } {
4040
let output = ''
4141
let loopString = ''
42+
let customSetterVar = ''
4243

4344
if (model.set) {
45+
customSetterVar += ` const customSetter = { \n`
4446
for (const [methodName, getter] of Object.entries(model.set)) {
4547
const getterStr = getter.toString()
4648
output += removeAttrString(`${methodName}: ${getterStr}, \n`)
49+
50+
customSetterVar += output
4751
}
4852

53+
customSetterVar += '}'
54+
4955
loopString += `
5056
for (const [key, fn] of Object.entries(customSetter)) {
5157
model[key] = await fn()
5258
}`
5359
}
5460

55-
return { output, loopString }
61+
return { customSetterVar, loopString }
5662
}
5763

5864
function removeAttrString(getterFn: string): string {
@@ -956,9 +962,7 @@ export async function generateModelString(
956962
}
957963
958964
async mapCustomSetters(model: ${modelName}JsonResponse): Promise<void> {
959-
const customSetter = {
960-
${setterOutput.output}
961-
}
965+
${setterOutput.customSetterVar}
962966
963967
${setterOutput.loopString}
964968
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@ export class AccessTokenModel {
100100
}
101101

102102
async mapCustomSetters(model: AccessTokenJsonResponse): Promise<void> {
103-
const customSetter = {
104103

105-
}
106104
}
107105

108106
get team_id(): number | undefined {

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ export class ActivityModel {
9999
}
100100

101101
async mapCustomSetters(model: ActivityJsonResponse): Promise<void> {
102-
const customSetter = {
103102

104-
}
105103
}
106104

107105
get id(): number | undefined {

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,7 @@ export class DeploymentModel {
105105
}
106106

107107
async mapCustomSetters(model: DeploymentJsonResponse): Promise<void> {
108-
const customSetter = {
109108

110-
}
111109
}
112110

113111
get user_id(): number | undefined {

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ export class ErrorModel {
9696
}
9797

9898
async mapCustomSetters(model: ErrorJsonResponse): Promise<void> {
99-
const customSetter = {
10099

101-
}
102100
}
103101

104102
get id(): number | undefined {

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ export class FailedJobModel {
9696
}
9797

9898
async mapCustomSetters(model: FailedJobJsonResponse): Promise<void> {
99-
const customSetter = {
10099

101-
}
102100
}
103101

104102
get id(): number | undefined {

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ export class JobModel {
9696
}
9797

9898
async mapCustomSetters(model: JobJsonResponse): Promise<void> {
99-
const customSetter = {
10099

101-
}
102100
}
103101

104102
get id(): number | undefined {

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,7 @@ export class PaymentMethodModel {
108108
}
109109

110110
async mapCustomSetters(model: PaymentMethodJsonResponse): Promise<void> {
111-
const customSetter = {
112111

113-
}
114112
}
115113

116114
get user_id(): number | undefined {

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ export class PostModel {
9898
}
9999

100100
async mapCustomSetters(model: PostJsonResponse): Promise<void> {
101-
const customSetter = {
102101

103-
}
104102
}
105103

106104
get user_id(): number | undefined {

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@ export class ProductModel {
100100
}
101101

102102
async mapCustomSetters(model: ProductJsonResponse): Promise<void> {
103-
const customSetter = {
104103

105-
}
106104
}
107105

108106
get id(): number | undefined {

0 commit comments

Comments
 (0)