Skip to content

Commit c465614

Browse files
chore: wip
1 parent fc9f1fc commit c465614

34 files changed

+34
-306
lines changed

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,18 +1216,10 @@ export async function generateModelString(
12161216
return models.map((modelItem: UserJsonResponse) => this.parseResult(new ${modelName}Model(modelItem)))
12171217
}
12181218
1219-
skip(count: number): ${modelName}Model {
1220-
this.selectFromQuery = this.selectFromQuery.offset(count)
1221-
1222-
return this
1223-
}
1224-
12251219
static skip(count: number): ${modelName}Model {
12261220
const instance = new ${modelName}Model(undefined)
12271221
1228-
instance.selectFromQuery = instance.selectFromQuery.offset(count)
1229-
1230-
return instance
1222+
return instance.applySkip(count)
12311223
}
12321224
12331225
async applyChunk(size: number, callback: (models: ${modelName}Model[]) => Promise<void>): Promise<void> {

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -440,18 +440,10 @@ export class AccessTokenModel extends BaseOrm<AccessTokenModel, PersonalAccessTo
440440
return models.map((modelItem: UserJsonResponse) => this.parseResult(new AccessTokenModel(modelItem)))
441441
}
442442

443-
skip(count: number): AccessTokenModel {
444-
this.selectFromQuery = this.selectFromQuery.offset(count)
445-
446-
return this
447-
}
448-
449443
static skip(count: number): AccessTokenModel {
450444
const instance = new AccessTokenModel(undefined)
451445

452-
instance.selectFromQuery = instance.selectFromQuery.offset(count)
453-
454-
return instance
446+
return instance.applySkip(count)
455447
}
456448

457449
async applyChunk(size: number, callback: (models: AccessTokenModel[]) => Promise<void>): Promise<void> {

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -480,18 +480,10 @@ export class CouponModel extends BaseOrm<CouponModel, CouponsTable, CouponJsonRe
480480
return models.map((modelItem: UserJsonResponse) => this.parseResult(new CouponModel(modelItem)))
481481
}
482482

483-
skip(count: number): CouponModel {
484-
this.selectFromQuery = this.selectFromQuery.offset(count)
485-
486-
return this
487-
}
488-
489483
static skip(count: number): CouponModel {
490484
const instance = new CouponModel(undefined)
491485

492-
instance.selectFromQuery = instance.selectFromQuery.offset(count)
493-
494-
return instance
486+
return instance.applySkip(count)
495487
}
496488

497489
async applyChunk(size: number, callback: (models: CouponModel[]) => Promise<void>): Promise<void> {

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -425,18 +425,10 @@ export class CustomerModel extends BaseOrm<CustomerModel, CustomersTable, Custom
425425
return models.map((modelItem: UserJsonResponse) => this.parseResult(new CustomerModel(modelItem)))
426426
}
427427

428-
skip(count: number): CustomerModel {
429-
this.selectFromQuery = this.selectFromQuery.offset(count)
430-
431-
return this
432-
}
433-
434428
static skip(count: number): CustomerModel {
435429
const instance = new CustomerModel(undefined)
436430

437-
instance.selectFromQuery = instance.selectFromQuery.offset(count)
438-
439-
return instance
431+
return instance.applySkip(count)
440432
}
441433

442434
async applyChunk(size: number, callback: (models: CustomerModel[]) => Promise<void>): Promise<void> {

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -410,18 +410,10 @@ export class DeploymentModel extends BaseOrm<DeploymentModel, DeploymentsTable,
410410
return models.map((modelItem: UserJsonResponse) => this.parseResult(new DeploymentModel(modelItem)))
411411
}
412412

413-
skip(count: number): DeploymentModel {
414-
this.selectFromQuery = this.selectFromQuery.offset(count)
415-
416-
return this
417-
}
418-
419413
static skip(count: number): DeploymentModel {
420414
const instance = new DeploymentModel(undefined)
421415

422-
instance.selectFromQuery = instance.selectFromQuery.offset(count)
423-
424-
return instance
416+
return instance.applySkip(count)
425417
}
426418

427419
async applyChunk(size: number, callback: (models: DeploymentModel[]) => Promise<void>): Promise<void> {

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -370,18 +370,10 @@ export class ErrorModel extends BaseOrm<ErrorModel, ErrorsTable, ErrorJsonRespon
370370
return models.map((modelItem: UserJsonResponse) => this.parseResult(new ErrorModel(modelItem)))
371371
}
372372

373-
skip(count: number): ErrorModel {
374-
this.selectFromQuery = this.selectFromQuery.offset(count)
375-
376-
return this
377-
}
378-
379373
static skip(count: number): ErrorModel {
380374
const instance = new ErrorModel(undefined)
381375

382-
instance.selectFromQuery = instance.selectFromQuery.offset(count)
383-
384-
return instance
376+
return instance.applySkip(count)
385377
}
386378

387379
async applyChunk(size: number, callback: (models: ErrorModel[]) => Promise<void>): Promise<void> {

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -370,18 +370,10 @@ export class FailedJobModel extends BaseOrm<FailedJobModel, FailedJobsTable, Fai
370370
return models.map((modelItem: UserJsonResponse) => this.parseResult(new FailedJobModel(modelItem)))
371371
}
372372

373-
skip(count: number): FailedJobModel {
374-
this.selectFromQuery = this.selectFromQuery.offset(count)
375-
376-
return this
377-
}
378-
379373
static skip(count: number): FailedJobModel {
380374
const instance = new FailedJobModel(undefined)
381375

382-
instance.selectFromQuery = instance.selectFromQuery.offset(count)
383-
384-
return instance
376+
return instance.applySkip(count)
385377
}
386378

387379
async applyChunk(size: number, callback: (models: FailedJobModel[]) => Promise<void>): Promise<void> {

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -489,18 +489,10 @@ export class GiftCardModel extends BaseOrm<GiftCardModel, GiftCardsTable, GiftCa
489489
return models.map((modelItem: UserJsonResponse) => this.parseResult(new GiftCardModel(modelItem)))
490490
}
491491

492-
skip(count: number): GiftCardModel {
493-
this.selectFromQuery = this.selectFromQuery.offset(count)
494-
495-
return this
496-
}
497-
498492
static skip(count: number): GiftCardModel {
499493
const instance = new GiftCardModel(undefined)
500494

501-
instance.selectFromQuery = instance.selectFromQuery.offset(count)
502-
503-
return instance
495+
return instance.applySkip(count)
504496
}
505497

506498
async applyChunk(size: number, callback: (models: GiftCardModel[]) => Promise<void>): Promise<void> {

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -370,18 +370,10 @@ export class JobModel extends BaseOrm<JobModel, JobsTable, JobJsonResponse> {
370370
return models.map((modelItem: UserJsonResponse) => this.parseResult(new JobModel(modelItem)))
371371
}
372372

373-
skip(count: number): JobModel {
374-
this.selectFromQuery = this.selectFromQuery.offset(count)
375-
376-
return this
377-
}
378-
379373
static skip(count: number): JobModel {
380374
const instance = new JobModel(undefined)
381375

382-
instance.selectFromQuery = instance.selectFromQuery.offset(count)
383-
384-
return instance
376+
return instance.applySkip(count)
385377
}
386378

387379
async applyChunk(size: number, callback: (models: JobModel[]) => Promise<void>): Promise<void> {

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -399,18 +399,10 @@ export class LoyaltyPointModel extends BaseOrm<LoyaltyPointModel, LoyaltyPointsT
399399
return models.map((modelItem: UserJsonResponse) => this.parseResult(new LoyaltyPointModel(modelItem)))
400400
}
401401

402-
skip(count: number): LoyaltyPointModel {
403-
this.selectFromQuery = this.selectFromQuery.offset(count)
404-
405-
return this
406-
}
407-
408402
static skip(count: number): LoyaltyPointModel {
409403
const instance = new LoyaltyPointModel(undefined)
410404

411-
instance.selectFromQuery = instance.selectFromQuery.offset(count)
412-
413-
return instance
405+
return instance.applySkip(count)
414406
}
415407

416408
async applyChunk(size: number, callback: (models: LoyaltyPointModel[]) => Promise<void>): Promise<void> {

0 commit comments

Comments
 (0)