fix: get deposit return to
This commit is contained in:
parent
e8ba8ec9b8
commit
4b8278a6bb
|
@ -165,16 +165,14 @@ export class TransactionController {
|
||||||
@Query('pageSize') pageSize: number,
|
@Query('pageSize') pageSize: number,
|
||||||
@Request() req,
|
@Request() req,
|
||||||
) {
|
) {
|
||||||
const [data, count] =
|
const data = await this.transactionService.getAllDepositReturnToUser(
|
||||||
await this.transactionService.getAllDepositReturnToUser(
|
|
||||||
req.user.userId,
|
req.user.userId,
|
||||||
page,
|
page,
|
||||||
pageSize,
|
pageSize,
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
data,
|
...data,
|
||||||
count,
|
|
||||||
statusCode: HttpStatus.OK,
|
statusCode: HttpStatus.OK,
|
||||||
message: 'success',
|
message: 'success',
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,6 +24,8 @@ import { SupplierService } from '../users/supplier/supplier.service';
|
||||||
import { ProductHistoryPriceService } from '../product/history-price/history-price.service';
|
import { ProductHistoryPriceService } from '../product/history-price/history-price.service';
|
||||||
import { CommissionService } from '../configurable/commission.service';
|
import { CommissionService } from '../configurable/commission.service';
|
||||||
import { DepositReturnDto } from './dto/deposit_return.dto';
|
import { DepositReturnDto } from './dto/deposit_return.dto';
|
||||||
|
import { User } from '../users/entities/user.entity';
|
||||||
|
import { UserDetail } from '../users/entities/user_detail.entity';
|
||||||
|
|
||||||
interface JournalEntry {
|
interface JournalEntry {
|
||||||
coa_id: string;
|
coa_id: string;
|
||||||
|
@ -673,6 +675,32 @@ export class TransactionService {
|
||||||
page: number,
|
page: number,
|
||||||
pageSize?: number,
|
pageSize?: number,
|
||||||
) {
|
) {
|
||||||
|
const baseQuery = this.transactionRepository
|
||||||
|
.createQueryBuilder('transaction')
|
||||||
|
.select('transaction.id', 'id')
|
||||||
|
.addSelect(['transaction.created_at', 'image_prove', 'amount'])
|
||||||
|
.where('transaction.user_destination = :id and transaction.type = 3', {
|
||||||
|
id: user,
|
||||||
|
})
|
||||||
|
.leftJoinAndMapOne(
|
||||||
|
'transaction.userData',
|
||||||
|
UserDetail,
|
||||||
|
'userData',
|
||||||
|
'userData.user = transaction.user',
|
||||||
|
)
|
||||||
|
.addSelect('userData.name', 'name');
|
||||||
|
|
||||||
|
const data = await baseQuery
|
||||||
|
.offset(page * (pageSize || 10))
|
||||||
|
.limit(pageSize || 10)
|
||||||
|
.getRawMany();
|
||||||
|
|
||||||
|
const totalData = await baseQuery.getCount();
|
||||||
|
|
||||||
|
return {
|
||||||
|
data,
|
||||||
|
count: totalData,
|
||||||
|
};
|
||||||
return this.transactionRepository.findAndCount({
|
return this.transactionRepository.findAndCount({
|
||||||
skip: page * (pageSize || 10),
|
skip: page * (pageSize || 10),
|
||||||
take: pageSize || 10,
|
take: pageSize || 10,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user