Validate manual account creation
This commit is contained in:
parent
3163c9018f
commit
9629d4ea8f
@ -2,6 +2,7 @@ import { Body, Controller, Get, Param, Patch, Post, Query } from "@nestjs/common
|
|||||||
import { ok } from "../common/response";
|
import { ok } from "../common/response";
|
||||||
import { AccountsService } from "./accounts.service";
|
import { AccountsService } from "./accounts.service";
|
||||||
import { CurrentUser } from "../common/decorators/current-user.decorator";
|
import { CurrentUser } from "../common/decorators/current-user.decorator";
|
||||||
|
import { CreateManualAccountDto } from "./dto/create-manual-account.dto";
|
||||||
import { UpdateAccountOwnershipDto } from "./dto/update-account-ownership.dto";
|
import { UpdateAccountOwnershipDto } from "./dto/update-account-ownership.dto";
|
||||||
|
|
||||||
@Controller("accounts")
|
@Controller("accounts")
|
||||||
@ -27,7 +28,7 @@ export class AccountsController {
|
|||||||
@Post("manual")
|
@Post("manual")
|
||||||
async manual(
|
async manual(
|
||||||
@CurrentUser() userId: string,
|
@CurrentUser() userId: string,
|
||||||
@Body() payload: { institutionName: string; accountType: string; mask?: string },
|
@Body() payload: CreateManualAccountDto,
|
||||||
) {
|
) {
|
||||||
const data = await this.accountsService.createManualAccount(userId, payload);
|
const data = await this.accountsService.createManualAccount(userId, payload);
|
||||||
return ok(data);
|
return ok(data);
|
||||||
|
|||||||
16
src/accounts/dto/create-manual-account.dto.ts
Normal file
16
src/accounts/dto/create-manual-account.dto.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { IsIn, IsOptional, IsString, MaxLength } from "class-validator";
|
||||||
|
|
||||||
|
export class CreateManualAccountDto {
|
||||||
|
@IsString()
|
||||||
|
@MaxLength(120)
|
||||||
|
institutionName!: string;
|
||||||
|
|
||||||
|
@IsString()
|
||||||
|
@IsIn(["checking", "savings", "credit", "investment", "loan", "cash", "other"])
|
||||||
|
accountType!: string;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
@MaxLength(12)
|
||||||
|
mask?: string;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user