Skip to content

Commit 38f3fdf

Browse files
chore: wip
1 parent b7843c3 commit 38f3fdf

34 files changed

+816
-0
lines changed

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

+24
Original file line numberDiff line numberDiff line change
@@ -1139,12 +1139,36 @@ export async function generateModelString(
11391139
return instance.applyTake(count)
11401140
}
11411141
1142+
static where<V = string>(column: keyof ${formattedTableName}Table, ...args: [V] | [Operator, V]): ${modelName}Model {
1143+
const instance = new ${modelName}Model(undefined)
1144+
1145+
return instance.applyWhere<V>(column, ...args)
1146+
}
1147+
11421148
static whereLike(column: keyof ${formattedTableName}Table, value: string): ${modelName}Model {
11431149
const instance = new ${modelName}Model(undefined)
11441150
11451151
return instance.applyWhereLike(column, value)
11461152
}
11471153
1154+
static orderBy(column: keyof ${formattedTableName}Table, order: 'asc' | 'desc'): ${modelName}Model {
1155+
const instance = new ${modelName}Model(undefined)
1156+
1157+
return instance.applyOrderBy(column, order)
1158+
}
1159+
1160+
static orderByAsc(column: keyof ${formattedTableName}Table): ${modelName}Model {
1161+
const instance = new ${modelName}Model(undefined)
1162+
1163+
return instance.applyOrderByAsc(column)
1164+
}
1165+
1166+
static orderByDesc(column: keyof ${formattedTableName}Table): ${modelName}Model {
1167+
const instance = new ${modelName}Model(undefined)
1168+
1169+
return instance.applyOrderByDesc(column)
1170+
}
1171+
11481172
static async max(field: keyof ${formattedTableName}Table): Promise<number> {
11491173
const instance = new ${modelName}Model(undefined)
11501174

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

+24
Original file line numberDiff line numberDiff line change
@@ -354,12 +354,36 @@ export class AccessTokenModel extends BaseOrm<AccessTokenModel, PersonalAccessTo
354354
return instance.applyTake(count)
355355
}
356356

357+
static where<V = string>(column: keyof PersonalAccessTokensTable, ...args: [V] | [Operator, V]): AccessTokenModel {
358+
const instance = new AccessTokenModel(undefined)
359+
360+
return instance.applyWhere<V>(column, ...args)
361+
}
362+
357363
static whereLike(column: keyof PersonalAccessTokensTable, value: string): AccessTokenModel {
358364
const instance = new AccessTokenModel(undefined)
359365

360366
return instance.applyWhereLike(column, value)
361367
}
362368

369+
static orderBy(column: keyof PersonalAccessTokensTable, order: 'asc' | 'desc'): AccessTokenModel {
370+
const instance = new AccessTokenModel(undefined)
371+
372+
return instance.applyOrderBy(column, order)
373+
}
374+
375+
static orderByAsc(column: keyof PersonalAccessTokensTable): AccessTokenModel {
376+
const instance = new AccessTokenModel(undefined)
377+
378+
return instance.applyOrderByAsc(column)
379+
}
380+
381+
static orderByDesc(column: keyof PersonalAccessTokensTable): AccessTokenModel {
382+
const instance = new AccessTokenModel(undefined)
383+
384+
return instance.applyOrderByDesc(column)
385+
}
386+
363387
static async max(field: keyof PersonalAccessTokensTable): Promise<number> {
364388
const instance = new AccessTokenModel(undefined)
365389

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

+24
Original file line numberDiff line numberDiff line change
@@ -396,12 +396,36 @@ export class CouponModel extends BaseOrm<CouponModel, CouponsTable, CouponJsonRe
396396
return instance.applyTake(count)
397397
}
398398

399+
static where<V = string>(column: keyof CouponsTable, ...args: [V] | [Operator, V]): CouponModel {
400+
const instance = new CouponModel(undefined)
401+
402+
return instance.applyWhere<V>(column, ...args)
403+
}
404+
399405
static whereLike(column: keyof CouponsTable, value: string): CouponModel {
400406
const instance = new CouponModel(undefined)
401407

402408
return instance.applyWhereLike(column, value)
403409
}
404410

411+
static orderBy(column: keyof CouponsTable, order: 'asc' | 'desc'): CouponModel {
412+
const instance = new CouponModel(undefined)
413+
414+
return instance.applyOrderBy(column, order)
415+
}
416+
417+
static orderByAsc(column: keyof CouponsTable): CouponModel {
418+
const instance = new CouponModel(undefined)
419+
420+
return instance.applyOrderByAsc(column)
421+
}
422+
423+
static orderByDesc(column: keyof CouponsTable): CouponModel {
424+
const instance = new CouponModel(undefined)
425+
426+
return instance.applyOrderByDesc(column)
427+
}
428+
405429
static async max(field: keyof CouponsTable): Promise<number> {
406430
const instance = new CouponModel(undefined)
407431

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

+24
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,36 @@ export class CustomerModel extends BaseOrm<CustomerModel, CustomersTable, Custom
341341
return instance.applyTake(count)
342342
}
343343

344+
static where<V = string>(column: keyof CustomersTable, ...args: [V] | [Operator, V]): CustomerModel {
345+
const instance = new CustomerModel(undefined)
346+
347+
return instance.applyWhere<V>(column, ...args)
348+
}
349+
344350
static whereLike(column: keyof CustomersTable, value: string): CustomerModel {
345351
const instance = new CustomerModel(undefined)
346352

347353
return instance.applyWhereLike(column, value)
348354
}
349355

356+
static orderBy(column: keyof CustomersTable, order: 'asc' | 'desc'): CustomerModel {
357+
const instance = new CustomerModel(undefined)
358+
359+
return instance.applyOrderBy(column, order)
360+
}
361+
362+
static orderByAsc(column: keyof CustomersTable): CustomerModel {
363+
const instance = new CustomerModel(undefined)
364+
365+
return instance.applyOrderByAsc(column)
366+
}
367+
368+
static orderByDesc(column: keyof CustomersTable): CustomerModel {
369+
const instance = new CustomerModel(undefined)
370+
371+
return instance.applyOrderByDesc(column)
372+
}
373+
350374
static async max(field: keyof CustomersTable): Promise<number> {
351375
const instance = new CustomerModel(undefined)
352376

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

+24
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,36 @@ export class DeploymentModel extends BaseOrm<DeploymentModel, DeploymentsTable,
326326
return instance.applyTake(count)
327327
}
328328

329+
static where<V = string>(column: keyof DeploymentsTable, ...args: [V] | [Operator, V]): DeploymentModel {
330+
const instance = new DeploymentModel(undefined)
331+
332+
return instance.applyWhere<V>(column, ...args)
333+
}
334+
329335
static whereLike(column: keyof DeploymentsTable, value: string): DeploymentModel {
330336
const instance = new DeploymentModel(undefined)
331337

332338
return instance.applyWhereLike(column, value)
333339
}
334340

341+
static orderBy(column: keyof DeploymentsTable, order: 'asc' | 'desc'): DeploymentModel {
342+
const instance = new DeploymentModel(undefined)
343+
344+
return instance.applyOrderBy(column, order)
345+
}
346+
347+
static orderByAsc(column: keyof DeploymentsTable): DeploymentModel {
348+
const instance = new DeploymentModel(undefined)
349+
350+
return instance.applyOrderByAsc(column)
351+
}
352+
353+
static orderByDesc(column: keyof DeploymentsTable): DeploymentModel {
354+
const instance = new DeploymentModel(undefined)
355+
356+
return instance.applyOrderByDesc(column)
357+
}
358+
335359
static async max(field: keyof DeploymentsTable): Promise<number> {
336360
const instance = new DeploymentModel(undefined)
337361

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

+24
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,36 @@ export class ErrorModel extends BaseOrm<ErrorModel, ErrorsTable, ErrorJsonRespon
287287
return instance.applyTake(count)
288288
}
289289

290+
static where<V = string>(column: keyof ErrorsTable, ...args: [V] | [Operator, V]): ErrorModel {
291+
const instance = new ErrorModel(undefined)
292+
293+
return instance.applyWhere<V>(column, ...args)
294+
}
295+
290296
static whereLike(column: keyof ErrorsTable, value: string): ErrorModel {
291297
const instance = new ErrorModel(undefined)
292298

293299
return instance.applyWhereLike(column, value)
294300
}
295301

302+
static orderBy(column: keyof ErrorsTable, order: 'asc' | 'desc'): ErrorModel {
303+
const instance = new ErrorModel(undefined)
304+
305+
return instance.applyOrderBy(column, order)
306+
}
307+
308+
static orderByAsc(column: keyof ErrorsTable): ErrorModel {
309+
const instance = new ErrorModel(undefined)
310+
311+
return instance.applyOrderByAsc(column)
312+
}
313+
314+
static orderByDesc(column: keyof ErrorsTable): ErrorModel {
315+
const instance = new ErrorModel(undefined)
316+
317+
return instance.applyOrderByDesc(column)
318+
}
319+
296320
static async max(field: keyof ErrorsTable): Promise<number> {
297321
const instance = new ErrorModel(undefined)
298322

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

+24
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,36 @@ export class FailedJobModel extends BaseOrm<FailedJobModel, FailedJobsTable, Fai
287287
return instance.applyTake(count)
288288
}
289289

290+
static where<V = string>(column: keyof FailedJobsTable, ...args: [V] | [Operator, V]): FailedJobModel {
291+
const instance = new FailedJobModel(undefined)
292+
293+
return instance.applyWhere<V>(column, ...args)
294+
}
295+
290296
static whereLike(column: keyof FailedJobsTable, value: string): FailedJobModel {
291297
const instance = new FailedJobModel(undefined)
292298

293299
return instance.applyWhereLike(column, value)
294300
}
295301

302+
static orderBy(column: keyof FailedJobsTable, order: 'asc' | 'desc'): FailedJobModel {
303+
const instance = new FailedJobModel(undefined)
304+
305+
return instance.applyOrderBy(column, order)
306+
}
307+
308+
static orderByAsc(column: keyof FailedJobsTable): FailedJobModel {
309+
const instance = new FailedJobModel(undefined)
310+
311+
return instance.applyOrderByAsc(column)
312+
}
313+
314+
static orderByDesc(column: keyof FailedJobsTable): FailedJobModel {
315+
const instance = new FailedJobModel(undefined)
316+
317+
return instance.applyOrderByDesc(column)
318+
}
319+
296320
static async max(field: keyof FailedJobsTable): Promise<number> {
297321
const instance = new FailedJobModel(undefined)
298322

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

+24
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,36 @@ export class GiftCardModel extends BaseOrm<GiftCardModel, GiftCardsTable, GiftCa
405405
return instance.applyTake(count)
406406
}
407407

408+
static where<V = string>(column: keyof GiftCardsTable, ...args: [V] | [Operator, V]): GiftCardModel {
409+
const instance = new GiftCardModel(undefined)
410+
411+
return instance.applyWhere<V>(column, ...args)
412+
}
413+
408414
static whereLike(column: keyof GiftCardsTable, value: string): GiftCardModel {
409415
const instance = new GiftCardModel(undefined)
410416

411417
return instance.applyWhereLike(column, value)
412418
}
413419

420+
static orderBy(column: keyof GiftCardsTable, order: 'asc' | 'desc'): GiftCardModel {
421+
const instance = new GiftCardModel(undefined)
422+
423+
return instance.applyOrderBy(column, order)
424+
}
425+
426+
static orderByAsc(column: keyof GiftCardsTable): GiftCardModel {
427+
const instance = new GiftCardModel(undefined)
428+
429+
return instance.applyOrderByAsc(column)
430+
}
431+
432+
static orderByDesc(column: keyof GiftCardsTable): GiftCardModel {
433+
const instance = new GiftCardModel(undefined)
434+
435+
return instance.applyOrderByDesc(column)
436+
}
437+
414438
static async max(field: keyof GiftCardsTable): Promise<number> {
415439
const instance = new GiftCardModel(undefined)
416440

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

+24
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,36 @@ export class JobModel extends BaseOrm<JobModel, JobsTable, JobJsonResponse> {
287287
return instance.applyTake(count)
288288
}
289289

290+
static where<V = string>(column: keyof JobsTable, ...args: [V] | [Operator, V]): JobModel {
291+
const instance = new JobModel(undefined)
292+
293+
return instance.applyWhere<V>(column, ...args)
294+
}
295+
290296
static whereLike(column: keyof JobsTable, value: string): JobModel {
291297
const instance = new JobModel(undefined)
292298

293299
return instance.applyWhereLike(column, value)
294300
}
295301

302+
static orderBy(column: keyof JobsTable, order: 'asc' | 'desc'): JobModel {
303+
const instance = new JobModel(undefined)
304+
305+
return instance.applyOrderBy(column, order)
306+
}
307+
308+
static orderByAsc(column: keyof JobsTable): JobModel {
309+
const instance = new JobModel(undefined)
310+
311+
return instance.applyOrderByAsc(column)
312+
}
313+
314+
static orderByDesc(column: keyof JobsTable): JobModel {
315+
const instance = new JobModel(undefined)
316+
317+
return instance.applyOrderByDesc(column)
318+
}
319+
296320
static async max(field: keyof JobsTable): Promise<number> {
297321
const instance = new JobModel(undefined)
298322

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

+24
Original file line numberDiff line numberDiff line change
@@ -316,12 +316,36 @@ export class LoyaltyPointModel extends BaseOrm<LoyaltyPointModel, LoyaltyPointsT
316316
return instance.applyTake(count)
317317
}
318318

319+
static where<V = string>(column: keyof LoyaltyPointsTable, ...args: [V] | [Operator, V]): LoyaltyPointModel {
320+
const instance = new LoyaltyPointModel(undefined)
321+
322+
return instance.applyWhere<V>(column, ...args)
323+
}
324+
319325
static whereLike(column: keyof LoyaltyPointsTable, value: string): LoyaltyPointModel {
320326
const instance = new LoyaltyPointModel(undefined)
321327

322328
return instance.applyWhereLike(column, value)
323329
}
324330

331+
static orderBy(column: keyof LoyaltyPointsTable, order: 'asc' | 'desc'): LoyaltyPointModel {
332+
const instance = new LoyaltyPointModel(undefined)
333+
334+
return instance.applyOrderBy(column, order)
335+
}
336+
337+
static orderByAsc(column: keyof LoyaltyPointsTable): LoyaltyPointModel {
338+
const instance = new LoyaltyPointModel(undefined)
339+
340+
return instance.applyOrderByAsc(column)
341+
}
342+
343+
static orderByDesc(column: keyof LoyaltyPointsTable): LoyaltyPointModel {
344+
const instance = new LoyaltyPointModel(undefined)
345+
346+
return instance.applyOrderByDesc(column)
347+
}
348+
325349
static async max(field: keyof LoyaltyPointsTable): Promise<number> {
326350
const instance = new LoyaltyPointModel(undefined)
327351

0 commit comments

Comments
 (0)