chore: user financial
This commit is contained in:
@@ -2,6 +2,7 @@ import { Body, Controller, Get, HttpCode, HttpStatus, Patch, Post } from "@nestj
|
||||
import { ApiOperation, ApiTags } from "@nestjs/swagger";
|
||||
|
||||
import { CheckValidityDTO } from "./DTO/check-validity.dto";
|
||||
import { CreateFinancialDto } from "./DTO/create-user-financial.dto";
|
||||
import { UpdateProfileDto } from "./DTO/update-profile.dto";
|
||||
import { CreateUserGroupDto } from "./DTO/user-group.dto";
|
||||
import { User } from "./entities/user.entity";
|
||||
@@ -16,6 +17,8 @@ import { UserDec } from "../../common/decorators/user.decorator";
|
||||
export class UsersController {
|
||||
constructor(private usersService: UsersService) {}
|
||||
|
||||
/************************************************************ */
|
||||
|
||||
@AuthGuards()
|
||||
@ApiOperation({ summary: "Get user profile" })
|
||||
@Get("me")
|
||||
@@ -23,6 +26,8 @@ export class UsersController {
|
||||
return this.usersService.getMe(user.id);
|
||||
}
|
||||
|
||||
/************************************************************ */
|
||||
|
||||
@AuthGuards()
|
||||
@ApiOperation({ summary: "Update user profile" })
|
||||
@Patch("update-profile")
|
||||
@@ -30,6 +35,8 @@ export class UsersController {
|
||||
return this.usersService.updateProfile(user.id, updateProfileDto);
|
||||
}
|
||||
|
||||
/************************************************************ */
|
||||
|
||||
@AuthGuards()
|
||||
@ApiOperation({ summary: "Check validity of user field" })
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@@ -38,6 +45,8 @@ export class UsersController {
|
||||
return this.usersService.checkValidity(checkValidityDto, user.id);
|
||||
}
|
||||
|
||||
/************************************************************ */
|
||||
|
||||
@AuthGuards()
|
||||
@Roles(RoleEnum.ADMIN)
|
||||
@ApiOperation({ summary: "Create user group" })
|
||||
@@ -47,6 +56,8 @@ export class UsersController {
|
||||
return this.usersService.createUserGroup(createDto);
|
||||
}
|
||||
|
||||
/************************************************************ */
|
||||
|
||||
@ApiOperation({ summary: "get all user group" })
|
||||
@AuthGuards()
|
||||
@Roles(RoleEnum.ADMIN)
|
||||
@@ -54,4 +65,43 @@ export class UsersController {
|
||||
UserGroups() {
|
||||
return this.usersService.getUserGroups();
|
||||
}
|
||||
|
||||
/************************************************************ */
|
||||
|
||||
@ApiOperation({ summary: "get all users" })
|
||||
@AuthGuards()
|
||||
@Roles(RoleEnum.ADMIN)
|
||||
@Get("")
|
||||
Users() {
|
||||
return this.usersService.findAllUsers();
|
||||
}
|
||||
|
||||
/************************************************************ */
|
||||
|
||||
@ApiOperation({ summary: "get all customers" })
|
||||
@AuthGuards()
|
||||
@Roles(RoleEnum.ADMIN)
|
||||
@Get("customers")
|
||||
customers() {
|
||||
return this.usersService.findAllCustomers();
|
||||
}
|
||||
|
||||
/************************************************************ */
|
||||
|
||||
@AuthGuards()
|
||||
@ApiOperation({ summary: "Create user financial" })
|
||||
@HttpCode(HttpStatus.CREATED)
|
||||
@Post("user-financial")
|
||||
createUserFinancial(@Body() createDto: CreateFinancialDto, @UserDec() user: User) {
|
||||
return this.usersService.createUserFinancial(createDto, user);
|
||||
}
|
||||
|
||||
/************************************************************ */
|
||||
|
||||
@ApiOperation({ summary: "get all user financials" })
|
||||
@AuthGuards()
|
||||
@Get("user-financials")
|
||||
userFinancials(@UserDec("id") userId: string) {
|
||||
return this.usersService.getUserFinancial(userId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user