@@ -25,7 +25,6 @@ export interface OrdersTable {
25
25
user ?: UserModel
26
26
coupon_id ?: number
27
27
coupon ?: CouponModel
28
- customer_id ?: string
29
28
status ?: string
30
29
total_amount ?: number
31
30
tax_amount ?: number
@@ -76,7 +75,7 @@ interface QueryOptions {
76
75
77
76
export class OrderModel {
78
77
private readonly hidden : Array < keyof OrderJsonResponse > = [ ]
79
- private readonly fillable : Array < keyof OrderJsonResponse > = [ 'customer_id' , ' status', 'total_amount' , 'tax_amount' , 'discount_amount' , 'delivery_fee' , 'tip_amount' , 'order_type' , 'delivery_address' , 'special_instructions' , 'estimated_delivery_time' , 'applied_coupon_id' , 'order_items' , 'uuid' , 'customer_id' , 'gift_card_id' , 'coupon_id' ]
78
+ private readonly fillable : Array < keyof OrderJsonResponse > = [ 'status' , 'total_amount' , 'tax_amount' , 'discount_amount' , 'delivery_fee' , 'tip_amount' , 'order_type' , 'delivery_address' , 'special_instructions' , 'estimated_delivery_time' , 'applied_coupon_id' , 'order_items' , 'uuid' , 'customer_id' , 'gift_card_id' , 'coupon_id' ]
80
79
private readonly guarded : Array < keyof OrderJsonResponse > = [ ]
81
80
protected attributes : Partial < OrderJsonResponse > = { }
82
81
protected originalAttributes : Partial < OrderJsonResponse > = { }
@@ -182,10 +181,6 @@ export class OrderModel {
182
181
return this . attributes . uuid
183
182
}
184
183
185
- get customer_id ( ) : string | undefined {
186
- return this . attributes . customer_id
187
- }
188
-
189
184
get status ( ) : string | undefined {
190
185
return this . attributes . status
191
186
}
@@ -246,10 +241,6 @@ export class OrderModel {
246
241
this . attributes . uuid = value
247
242
}
248
243
249
- set customer_id ( value : string ) {
250
- this . attributes . customer_id = value
251
- }
252
-
253
244
set status ( value : string ) {
254
245
this . attributes . status = value
255
246
}
@@ -1238,14 +1229,6 @@ export class OrderModel {
1238
1229
return instance
1239
1230
}
1240
1231
1241
- static whereCustomerId ( value : string ) : OrderModel {
1242
- const instance = new OrderModel ( null )
1243
-
1244
- instance . selectFromQuery = instance . selectFromQuery . where ( 'customer_id' , '=' , value )
1245
-
1246
- return instance
1247
- }
1248
-
1249
1232
static whereStatus ( value : string ) : OrderModel {
1250
1233
const instance = new OrderModel ( null )
1251
1234
@@ -1899,7 +1882,6 @@ export class OrderModel {
1899
1882
const output : Partial < OrderJsonResponse > = {
1900
1883
1901
1884
id : this . id ,
1902
- customer_id : this . customer_id ,
1903
1885
status : this . status ,
1904
1886
total_amount : this . total_amount ,
1905
1887
tax_amount : this . tax_amount ,
@@ -1972,13 +1954,6 @@ export async function remove(id: number): Promise<void> {
1972
1954
. execute ( )
1973
1955
}
1974
1956
1975
- export async function whereCustomerId ( value : string ) : Promise < OrderModel [ ] > {
1976
- const query = DB . instance . selectFrom ( 'orders' ) . where ( 'customer_id' , '=' , value )
1977
- const results = await query . execute ( )
1978
-
1979
- return results . map ( ( modelItem : OrderModel ) => new OrderModel ( modelItem ) )
1980
- }
1981
-
1982
1957
export async function whereStatus ( value : string ) : Promise < OrderModel [ ] > {
1983
1958
const query = DB . instance . selectFrom ( 'orders' ) . where ( 'status' , '=' , value )
1984
1959
const results = await query . execute ( )
0 commit comments