This commit is contained in:
Ahmed Bouhuolia
2026-01-15 22:04:42 +02:00
parent 3c1273becb
commit 2bbc154f18
34 changed files with 301 additions and 176 deletions

View File

@@ -1,4 +1,4 @@
import { Body, Controller, Get, Param, Post } from '@nestjs/common';
import { Body, Controller, Get, Param, Patch, Post } from '@nestjs/common';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { UsersApplication } from './Users.application';
import { InviteUserDto, SendInviteUserDto } from './dtos/InviteUser.dto';
@@ -38,7 +38,7 @@ export class UsersInviteController {
/**
* Send an invitation to a new user.
*/
@Post()
@Patch()
@ApiOperation({ summary: 'Send an invitation to a new user.' })
async sendInvite(@Body() sendInviteDTO: SendInviteUserDto) {
const result = await this.usersApplication.sendInvite(sendInviteDTO);

View File

@@ -18,7 +18,7 @@ export class EditUserService {
private readonly tenantUserModel: TenantModelProxy<typeof TenantUser>,
private readonly eventEmitter: EventEmitter2,
private readonly tenancyContext: TenancyContext,
) {}
) { }
/**
* Creates a new user.
@@ -52,7 +52,10 @@ export class EditUserService {
const tenantUser = await this.tenantUserModel()
.query()
.updateAndFetchById(userId, {
...editUserDTO,
firstName: editUserDTO.firstName,
lastName: editUserDTO.lastName,
email: editUserDTO.email,
roleId: editUserDTO.roleId,
});
// Triggers `onTenantUserEdited` event.
await this.eventEmitter.emitAsync(events.tenantUser.onEdited, {