Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions migration/1776930994259-AddRecallReason.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* @typedef {import('typeorm').MigrationInterface} MigrationInterface
* @typedef {import('typeorm').QueryRunner} QueryRunner
*/

/**
* @class
* @implements {MigrationInterface}
*/
module.exports = class AddRecallReason1776930994259 {
name = 'AddRecallReason1776930994259'

/**
* @param {QueryRunner} queryRunner
*/
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "recall" ADD "reason" nvarchar(256)`);
}

/**
* @param {QueryRunner} queryRunner
*/
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "recall" DROP COLUMN "reason"`);
}
}
7 changes: 6 additions & 1 deletion src/subdomains/supporting/recall/dto/create-recall.dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IsInt, IsNotEmpty, IsNumber, IsOptional, IsString, ValidateIf } from 'class-validator';
import { IsEnum, IsInt, IsNotEmpty, IsNumber, IsOptional, IsString, ValidateIf } from 'class-validator';
import { RecallReason } from '../recall-reason.enum';

export class CreateRecallDto {
@IsNotEmpty()
Expand Down Expand Up @@ -26,4 +27,8 @@ export class CreateRecallDto {
@IsNotEmpty()
@IsNumber()
fee: number;

@IsNotEmpty()
@IsEnum(RecallReason)
reason: RecallReason;
}
7 changes: 6 additions & 1 deletion src/subdomains/supporting/recall/dto/update-recall.dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IsInt, IsNumber, IsString } from 'class-validator';
import { IsEnum, IsInt, IsNumber, IsString } from 'class-validator';
import { IsOptionalButNotNull } from 'src/shared/validators/is-not-null.validator';
import { RecallReason } from '../recall-reason.enum';

export class UpdateRecallDto {
@IsOptionalButNotNull()
Expand All @@ -17,4 +18,8 @@ export class UpdateRecallDto {
@IsOptionalButNotNull()
@IsNumber()
fee?: number;

@IsOptionalButNotNull()
@IsEnum(RecallReason)
reason?: RecallReason;
}
9 changes: 9 additions & 0 deletions src/subdomains/supporting/recall/recall-reason.enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export enum RecallReason {
DUPL = 'DUPL',
TECH = 'TECH',
FRAD = 'FRAD',
CUST = 'CUST',
AM09 = 'AM09',
AC03 = 'AC03',
UNKNOWN = 'Unknown',
}
4 changes: 4 additions & 0 deletions src/subdomains/supporting/recall/recall.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { User } from 'src/subdomains/generic/user/models/user/user.entity';
import { Column, Entity, Index, ManyToOne } from 'typeorm';
import { BankTx } from '../bank-tx/bank-tx/entities/bank-tx.entity';
import { CheckoutTx } from '../fiat-payin/entities/checkout-tx.entity';
import { RecallReason } from './recall-reason.enum';

@Entity()
@Index((r: Recall) => [r.bankTx, r.checkoutTx, r.sequence], { unique: true })
Expand All @@ -24,4 +25,7 @@ export class Recall extends IEntity {

@Column({ type: 'float' })
fee: number;

@Column({ length: 256, nullable: true })
reason?: RecallReason;
}
Loading