Skip to content

Commit ff85b34

Browse files
chore: wip
1 parent 9036533 commit ff85b34

20 files changed

+1077
-1021
lines changed

storage/framework/actions/src/UserShowOrmAction.ts

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

13-
const result = await User.with(['posts']).get()
13+
const result = await User.with(['posts']).find(1)
1414

1515
return response.json(result)
1616
},

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,9 @@ export async function generateModelString(
969969
970970
if (!model)
971971
return undefined
972+
973+
if (model)
974+
await this.loadRelations(model)
972975
973976
const data = new ${modelName}Model(model as ${modelName}Type)
974977

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ export class AccessTokenModel {
208208
if (!model)
209209
return undefined
210210

211+
if (model)
212+
await this.loadRelations(model)
213+
211214
const data = new AccessTokenModel(model as AccessTokenType)
212215

213216
cache.getOrSet(`accesstoken:${id}`, JSON.stringify(model))

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ export class ActivityModel {
223223
if (!model)
224224
return undefined
225225

226+
if (model)
227+
await this.loadRelations(model)
228+
226229
const data = new ActivityModel(model as ActivityType)
227230

228231
cache.getOrSet(`activity:${id}`, JSON.stringify(model))

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ export class DeploymentModel {
245245
if (!model)
246246
return undefined
247247

248+
if (model)
249+
await this.loadRelations(model)
250+
248251
const data = new DeploymentModel(model as DeploymentType)
249252

250253
cache.getOrSet(`deployment:${id}`, JSON.stringify(model))

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ export class ErrorModel {
204204
if (!model)
205205
return undefined
206206

207+
if (model)
208+
await this.loadRelations(model)
209+
207210
const data = new ErrorModel(model as ErrorType)
208211

209212
cache.getOrSet(`error:${id}`, JSON.stringify(model))

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ export class FailedJobModel {
204204
if (!model)
205205
return undefined
206206

207+
if (model)
208+
await this.loadRelations(model)
209+
207210
const data = new FailedJobModel(model as FailedJobType)
208211

209212
cache.getOrSet(`failedjob:${id}`, JSON.stringify(model))

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ export class JobModel {
204204
if (!model)
205205
return undefined
206206

207+
if (model)
208+
await this.loadRelations(model)
209+
207210
const data = new JobModel(model as JobType)
208211

209212
cache.getOrSet(`job:${id}`, JSON.stringify(model))

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,9 @@ export class PaymentMethodModel {
254254
if (!model)
255255
return undefined
256256

257+
if (model)
258+
await this.loadRelations(model)
259+
257260
const data = new PaymentMethodModel(model as PaymentMethodType)
258261

259262
cache.getOrSet(`paymentmethod:${id}`, JSON.stringify(model))

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ export class PostModel {
190190
if (!model)
191191
return undefined
192192

193+
if (model)
194+
await this.loadRelations(model)
195+
193196
const data = new PostModel(model as PostType)
194197

195198
cache.getOrSet(`post:${id}`, JSON.stringify(model))

0 commit comments

Comments
 (0)