1
- // import type { TransactionModel } from '../../../../orm/src/models/Transaction '
1
+ import type { PaymentTransactionModel } from '../../../../orm/src/models/PaymentTransaction '
2
2
import type { UserModel } from '../../../../orm/src/models/User'
3
- // import Product from '../../../../orm/src/models/Product '
4
- // import { Transaction } from '../../../../orm/src/models/Transaction '
3
+ import PaymentProduct from '../../../../orm/src/models/PaymentProduct '
4
+ import { PaymentTransaction } from '../../../../orm/src/models/PaymentTransaction '
5
5
6
6
export interface ManageTransaction {
7
- store : ( user : UserModel , productId : number ) => Promise < TransactionModel >
8
- list : ( user : UserModel ) => Promise < TransactionModel [ ] >
7
+ store : ( user : UserModel , productId : number ) => Promise < PaymentTransactionModel >
8
+ list : ( user : UserModel ) => Promise < PaymentTransactionModel [ ] >
9
9
}
10
10
11
11
export const manageTransaction : ManageTransaction = ( ( ) => {
12
- async function store ( user : UserModel , productId : number ) : Promise < TransactionModel > {
13
- const product = await Product . find ( productId )
12
+ async function store ( user : UserModel , productId : number ) : Promise < PaymentTransactionModel > {
13
+ const product = await PaymentProduct . find ( productId )
14
14
15
15
const data = {
16
16
name : product ?. name ,
@@ -22,13 +22,13 @@ export const manageTransaction: ManageTransaction = (() => {
22
22
user_id : user . id ,
23
23
}
24
24
25
- const transaction = await Transaction . create ( data )
25
+ const transaction = await PaymentTransaction . create ( data )
26
26
27
27
return transaction
28
28
}
29
29
30
- async function list ( user : UserModel ) : Promise < TransactionModel [ ] > {
31
- const transaction = await Transaction . where ( 'user_id' , user . id ) . get ( )
30
+ async function list ( user : UserModel ) : Promise < PaymentTransactionModel [ ] > {
31
+ const transaction = await PaymentTransaction . where ( 'user_id' , user . id ) . get ( )
32
32
33
33
return transaction
34
34
}
0 commit comments