Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
glennmichael123 committed Jan 24, 2025
1 parent 69d612c commit cb88f06
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion storage/framework/core/orm/src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export async function generateModelString(
async ${relationName}HasMany(): Promise<${modelRelation}Model[]> {
if (this.id === undefined)
throw new HttpError(500, 'Relation Error!')
const results = await db.selectFrom('${tableRelation}')
.where('${foreignKeyRelation}', '=', this.id)
.limit(5)
Expand Down
2 changes: 1 addition & 1 deletion storage/framework/core/orm/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export async function getRelations(model: Model, modelName: string): Promise<Rel
const modelRelationTable = getTableName(modelRelation, modelRelationPath)
const table = getTableName(model, modelPath)
const modelRelationName = snakeCase(getModelName(modelRelation, modelRelationPath))
const formattedModelName = modelName.toLowerCase()
const formattedModelName = snakeCase(modelName)

const relationshipData: RelationConfig = {
relationship: relation,
Expand Down
2 changes: 1 addition & 1 deletion storage/framework/orm/src/models/PaymentMethod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ export class PaymentMethodModel {
throw new HttpError(500, 'Relation Error!')

const results = await db.selectFrom('transactions')
.where('transaction_id', '=', this.id)
.where('payment_method_id', '=', this.id)
.limit(5)
.selectAll()
.execute()
Expand Down
2 changes: 1 addition & 1 deletion storage/framework/orm/src/models/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ interface QueryOptions {

export class TransactionModel {
private readonly hidden: Array<keyof TransactionJsonResponse> = []
private readonly fillable: Array<keyof TransactionJsonResponse> = ['name', 'description', 'amount', 'type', 'provider_id', 'uuid', 'user_id', 'paymentmethod_id']
private readonly fillable: Array<keyof TransactionJsonResponse> = ['name', 'description', 'amount', 'type', 'provider_id', 'uuid', 'user_id', 'payment_method_id']

protected selectFromQuery: any
protected withRelations: string[]
Expand Down
4 changes: 2 additions & 2 deletions storage/framework/requests/TransactionRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface RequestDataTransaction {
type: string
provider_id: string
user_id: number
paymentmethod_id: number
payment_method_id: number
created_at?: Date
updated_at?: Date
}
Expand All @@ -30,7 +30,7 @@ export class TransactionRequest extends Request<RequestDataTransaction> implemen
public type = ''
public provider_id = ''
public user_id = 0
public paymentmethod_id = 0
public payment_method_id = 0
public created_at = new Date()
public updated_at = new Date()
public uuid = ''
Expand Down
6 changes: 3 additions & 3 deletions storage/framework/types/requests.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,13 @@ interface RequestDataTransaction {
type: string
provider_id: string
user_id: number
paymentmethod_id: number
payment_method_id: number
created_at?: Date
updated_at?: Date
}
export interface TransactionRequestType extends Request {
validate: (attributes?: CustomAttributes) => void
get: ((key: 'id') => number) & ((key: 'name' | 'description' | 'type' | 'provider_id') => string) & ((key: 'amount') => number) & ((key: 'user_id') => string) & ((key: 'paymentmethod_id') => string)
get: ((key: 'id') => number) & ((key: 'name' | 'description' | 'type' | 'provider_id') => string) & ((key: 'amount') => number) & ((key: 'user_id') => string) & ((key: 'payment_method_id') => string)

all: () => RequestDataTransaction
id: number
Expand All @@ -328,7 +328,7 @@ export interface TransactionRequestType extends Request {
type: string
provider_id: string
user_id: number
paymentmethod_id: number
payment_method_id: number
created_at?: Date
updated_at?: Date
}
Expand Down

0 comments on commit cb88f06

Please sign in to comment.