add: transaction distribution and order
This commit is contained in:
@@ -2,6 +2,7 @@ import { HttpException, HttpStatus, Injectable } from '@nestjs/common';
|
||||
import { EntityNotFoundError, Repository } from 'typeorm';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { COA } from './entities/coa.entity';
|
||||
import { coaType } from '../helper/enum-list';
|
||||
|
||||
export class CoaService {
|
||||
constructor(
|
||||
@@ -9,9 +10,9 @@ export class CoaService {
|
||||
private coaRepository: Repository<COA>,
|
||||
) {}
|
||||
|
||||
async findByUser(id: string) {
|
||||
async findByUser(id: string, type: coaType) {
|
||||
try {
|
||||
return await this.coaRepository.findOneOrFail({ user: id });
|
||||
return await this.coaRepository.findOneOrFail({ user: id, type: type });
|
||||
} catch (e) {
|
||||
if (e instanceof EntityNotFoundError) {
|
||||
throw new HttpException(
|
||||
|
||||
Reference in New Issue
Block a user