Skip to content

Commit

Permalink
backend: Add missing create API endpoint for account
Browse files Browse the repository at this point in the history
  • Loading branch information
somnisomni committed Jan 22, 2025
1 parent e35f2ef commit cae34d6
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions projects/Backend/src/modules/v2/account/account.controller.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Body, Controller, Delete, Get, Param, ParseIntPipe, Patch } from "@nestjs/common";
import { Body, Controller, Delete, Get, Param, ParseIntPipe, Patch, Post } from "@nestjs/common";
import AccountService from "./account.service";
import { AllowedFor, AuthData, UserTypes } from "../auth/auth.guard";
import { IAuthData } from "../auth/jwt-util.service";
import { AccountResponseDto, SuperAdminAccountResponseDto } from "./dto/account.dto";
import { UpdateAccountRequestDto } from "./dto/update.dto";
import { UpdateAccountPasswordRequestDto } from "./dto/update-password.dto";
import { ISuccessResponse } from "@myboothmanager/common";
import type { UpdateAccountRequestDto } from "./dto/update.dto";
import type { UpdateAccountPasswordRequestDto } from "./dto/update-password.dto";
import type { CreateAccountRequestDto } from "@/modules/v2/account/dto/create.dto";
import type { ISuccessResponse } from "@myboothmanager/common";

@Controller("/account")
export default class AccountController {
Expand Down Expand Up @@ -66,6 +67,15 @@ export default class AccountController {
return new SuperAdminAccountResponseDto(await this.account.findOne(id));
}

/**
* Create a new account
*/
@Post()
@AllowedFor(UserTypes.SUPER_ADMIN)
async create(@Body() createDto: CreateAccountRequestDto): Promise<SuperAdminAccountResponseDto> {
return new SuperAdminAccountResponseDto(await this.account.create(createDto));
}

/**
* Update single account information by ID (PK)
*/
Expand Down

0 comments on commit cae34d6

Please sign in to comment.