Skip to content

Commit 3e9ccab

Browse files
chore: wip
1 parent 674d69e commit 3e9ccab

File tree

4 files changed

+24
-15
lines changed

4 files changed

+24
-15
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,6 +1361,16 @@ export function mapEntity(attribute: ModelElement): string | undefined {
13611361
return 'Date | string'
13621362
case 'datetime':
13631363
return 'Date | string'
1364+
case 'float':
1365+
return 'number'
1366+
case 'double':
1367+
return 'number'
1368+
case 'decimal':
1369+
return 'number'
1370+
case 'integer':
1371+
return 'number'
1372+
case 'bigint':
1373+
return 'number'
13641374
default:
13651375
return entity
13661376
}

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ export class ShippingRateModel extends BaseOrm<ShippingRateModel, ShippingRatesT
162162
return this.attributes.uuid
163163
}
164164

165-
get weight_from(): float {
165+
get weight_from(): number {
166166
return this.attributes.weight_from
167167
}
168168

169-
get weight_to(): float {
169+
get weight_to(): number {
170170
return this.attributes.weight_to
171171
}
172172

@@ -186,11 +186,11 @@ export class ShippingRateModel extends BaseOrm<ShippingRateModel, ShippingRatesT
186186
this.attributes.uuid = value
187187
}
188188

189-
set weight_from(value: float) {
189+
set weight_from(value: number) {
190190
this.attributes.weight_from = value
191191
}
192192

193-
set weight_to(value: float) {
193+
set weight_to(value: number) {
194194
this.attributes.weight_to = value
195195
}
196196

@@ -820,7 +820,6 @@ export class ShippingRateModel extends BaseOrm<ShippingRateModel, ShippingRatesT
820820
return {
821821
id: this.id,
822822
method: this.method,
823-
zone: this.zone,
824823
weight_from: this.weight_from,
825824
weight_to: this.weight_to,
826825
rate: this.rate,
@@ -923,14 +922,14 @@ export async function remove(id: number): Promise<void> {
923922
.execute()
924923
}
925924

926-
export async function whereWeightFrom(value: float): Promise<ShippingRateModel[]> {
925+
export async function whereWeightFrom(value: number): Promise<ShippingRateModel[]> {
927926
const query = DB.instance.selectFrom('shipping_rates').where('weight_from', '=', value)
928927
const results: ShippingRateJsonResponse = await query.execute()
929928

930929
return results.map((modelItem: ShippingRateJsonResponse) => new ShippingRateModel(modelItem))
931930
}
932931

933-
export async function whereWeightTo(value: float): Promise<ShippingRateModel[]> {
932+
export async function whereWeightTo(value: number): Promise<ShippingRateModel[]> {
934933
const query = DB.instance.selectFrom('shipping_rates').where('weight_to', '=', value)
935934
const results: ShippingRateJsonResponse = await query.execute()
936935

storage/framework/orm/src/types/ShippingRateType.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import type { Operator } from '@stacksjs/orm'
33

44
export interface ShippingRatesTable {
55
id: Generated<number>
6-
weight_from: float
7-
weight_to: float
6+
weight_from: number
7+
weight_to: number
88
rate: number
99
shipping_method_id?: number
1010
shipping_zone_id?: number
@@ -39,10 +39,10 @@ export type ShippingRateUpdate = Updateable<ShippingRateWrite>
3939
export interface ShippingRateModelType {
4040
// Properties
4141
readonly id: number
42-
get weightFrom(): float
43-
set weightFrom(value: float)
44-
get weightTo(): float
45-
set weightTo(value: float)
42+
get weightFrom(): number
43+
set weightFrom(value: number)
44+
get weightTo(): number
45+
set weightTo(value: number)
4646
get rate(): number
4747
set rate(value: number)
4848

storage/framework/types/attributes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ export interface Attributes {
153153
discount_percentage: number
154154
base_rate: number
155155
free_shipping: number
156-
weight_from: float
157-
weight_to: float
156+
weight_from: number
157+
weight_to: number
158158
total_items: number
159159
subtotal: number
160160
total: number

0 commit comments

Comments
 (0)