Skip to content

Commit 0532da4

Browse files
chore: wip
1 parent 6f49dcc commit 0532da4

30 files changed

+59
-59
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ export async function generateModelString(
915915
${relationImports}
916916
917917
export interface ${formattedTableName}Table {
918-
id?: number
918+
id: number
919919
${fieldString}
920920
}
921921
@@ -962,7 +962,7 @@ export async function generateModelString(
962962
private hasSaved: boolean
963963
private customColumns: Record<string, unknown> = {}
964964
965-
constructor(${formattedModelName}: Partial<${modelName}Type> | null) {
965+
constructor(${formattedModelName}: ${modelName}JsonResponse | null) {
966966
if (${formattedModelName}) {
967967
968968
this.attributes = { ...${formattedModelName} }
@@ -1122,7 +1122,7 @@ export async function generateModelString(
11221122
}
11231123
11241124
async first(): Promise<${modelName}Model | undefined> {
1125-
let model: ${modelName}Model | undefined
1125+
let model: ${modelName}JsonResponse | undefined
11261126
11271127
if (this.hasSelect) {
11281128
model = await this.selectFromQuery.executeTakeFirst()

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Team from './Team'
1313
import User from './User'
1414

1515
export interface PersonalAccessTokensTable {
16-
id?: number
16+
id: number
1717
team_id?: number
1818
team?: TeamModel
1919
user_id?: number
@@ -78,7 +78,7 @@ export class AccessTokenModel {
7878
private hasSaved: boolean
7979
private customColumns: Record<string, unknown> = {}
8080

81-
constructor(accesstoken: Partial<AccessTokenType> | null) {
81+
constructor(accesstoken: AccessTokenJsonResponse | null) {
8282
if (accesstoken) {
8383
this.attributes = { ...accesstoken }
8484
this.originalAttributes = { ...accesstoken }

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { DB, SubqueryBuilder } from '@stacksjs/orm'
1313
import Product from './Product'
1414

1515
export interface CouponsTable {
16-
id?: number
16+
id: number
1717
orders?: OrderModel[] | undefined
1818
product_id?: number
1919
product?: ProductModel
@@ -82,7 +82,7 @@ export class CouponModel {
8282
private hasSaved: boolean
8383
private customColumns: Record<string, unknown> = {}
8484

85-
constructor(coupon: Partial<CouponType> | null) {
85+
constructor(coupon: CouponJsonResponse | null) {
8686
if (coupon) {
8787
this.attributes = { ...coupon }
8888
this.originalAttributes = { ...coupon }

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { DB, SubqueryBuilder } from '@stacksjs/orm'
1313
import User from './User'
1414

1515
export interface CustomersTable {
16-
id?: number
16+
id: number
1717
orders?: OrderModel[] | undefined
1818
user_id?: number
1919
user?: UserModel
@@ -75,7 +75,7 @@ export class CustomerModel {
7575
private hasSaved: boolean
7676
private customColumns: Record<string, unknown> = {}
7777

78-
constructor(customer: Partial<CustomerType> | null) {
78+
constructor(customer: CustomerJsonResponse | null) {
7979
if (customer) {
8080
this.attributes = { ...customer }
8181
this.originalAttributes = { ...customer }

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { DB, SubqueryBuilder } from '@stacksjs/orm'
1010
import User from './User'
1111

1212
export interface DeploymentsTable {
13-
id?: number
13+
id: number
1414
user_id?: number
1515
user?: UserModel
1616
commit_sha?: string
@@ -71,7 +71,7 @@ export class DeploymentModel {
7171
private hasSaved: boolean
7272
private customColumns: Record<string, unknown> = {}
7373

74-
constructor(deployment: Partial<DeploymentType> | null) {
74+
constructor(deployment: DeploymentJsonResponse | null) {
7575
if (deployment) {
7676
this.attributes = { ...deployment }
7777
this.originalAttributes = { ...deployment }

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { HttpError, ModelNotFoundException } from '@stacksjs/error-handling'
66
import { DB, SubqueryBuilder } from '@stacksjs/orm'
77

88
export interface ErrorsTable {
9-
id?: number
9+
id: number
1010
type?: string
1111
message?: string
1212
stack?: string
@@ -62,7 +62,7 @@ export class ErrorModel {
6262
private hasSaved: boolean
6363
private customColumns: Record<string, unknown> = {}
6464

65-
constructor(error: Partial<ErrorType> | null) {
65+
constructor(error: ErrorJsonResponse | null) {
6666
if (error) {
6767
this.attributes = { ...error }
6868
this.originalAttributes = { ...error }

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { HttpError, ModelNotFoundException } from '@stacksjs/error-handling'
66
import { DB, SubqueryBuilder } from '@stacksjs/orm'
77

88
export interface FailedJobsTable {
9-
id?: number
9+
id: number
1010
connection?: string
1111
queue?: string
1212
payload?: string
@@ -62,7 +62,7 @@ export class FailedJobModel {
6262
private hasSaved: boolean
6363
private customColumns: Record<string, unknown> = {}
6464

65-
constructor(failedjob: Partial<FailedJobType> | null) {
65+
constructor(failedjob: FailedJobJsonResponse | null) {
6666
if (failedjob) {
6767
this.attributes = { ...failedjob }
6868
this.originalAttributes = { ...failedjob }

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { DB, SubqueryBuilder } from '@stacksjs/orm'
1313
import User from './User'
1414

1515
export interface GiftCardsTable {
16-
id?: number
16+
id: number
1717
orders?: OrderModel[] | undefined
1818
user_id?: number
1919
user?: UserModel
@@ -83,7 +83,7 @@ export class GiftCardModel {
8383
private hasSaved: boolean
8484
private customColumns: Record<string, unknown> = {}
8585

86-
constructor(giftcard: Partial<GiftCardType> | null) {
86+
constructor(giftcard: GiftCardJsonResponse | null) {
8787
if (giftcard) {
8888
this.attributes = { ...giftcard }
8989
this.originalAttributes = { ...giftcard }

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { HttpError, ModelNotFoundException } from '@stacksjs/error-handling'
66
import { DB, SubqueryBuilder } from '@stacksjs/orm'
77

88
export interface JobsTable {
9-
id?: number
9+
id: number
1010
queue?: string
1111
payload?: string
1212
attempts?: number
@@ -62,7 +62,7 @@ export class JobModel {
6262
private hasSaved: boolean
6363
private customColumns: Record<string, unknown> = {}
6464

65-
constructor(job: Partial<JobType> | null) {
65+
constructor(job: JobJsonResponse | null) {
6666
if (job) {
6767
this.attributes = { ...job }
6868
this.originalAttributes = { ...job }

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { dispatch } from '@stacksjs/events'
88
import { DB, SubqueryBuilder } from '@stacksjs/orm'
99

1010
export interface LoyaltyPointsTable {
11-
id?: number
11+
id: number
1212
wallet_id?: string
1313
points?: number
1414
source?: string
@@ -67,7 +67,7 @@ export class LoyaltyPointModel {
6767
private hasSaved: boolean
6868
private customColumns: Record<string, unknown> = {}
6969

70-
constructor(loyaltypoint: Partial<LoyaltyPointType> | null) {
70+
constructor(loyaltypoint: LoyaltyPointJsonResponse | null) {
7171
if (loyaltypoint) {
7272
this.attributes = { ...loyaltypoint }
7373
this.originalAttributes = { ...loyaltypoint }

0 commit comments

Comments
 (0)