Creating import&export excel

This commit is contained in:
2026-09-15 17:33:05 +03:30
parent 9ae176bec0
commit 44f9849d0e
26 changed files with 3682 additions and 474 deletions
+32 -2
View File
@@ -5,6 +5,7 @@ import {
Param,
Patch,
Post,
StreamableFile,
UseGuards,
} from '@nestjs/common';
import type { UserRole } from '@mento/shared';
@@ -12,7 +13,12 @@ import { JwtAuthGuard } from '../auth/jwt-auth.guard';
import { CurrentUser } from '../auth/current-user.decorator';
import { Roles } from '../auth/roles.decorator';
import { RolesGuard } from '../auth/roles.guard';
import { InviteUserDto, UpdateUserCommissionDto, UpdateUserRoleDto } from './dto';
import {
InviteUserDto,
UpdateUserCommissionDto,
UpdateUserRoleDto,
UpdateUserStatusDto,
} from './dto';
import { UsersService } from './users.service';
@Controller('users')
@@ -25,6 +31,15 @@ export class UsersController {
return this.usersService.list(user.organizationId);
}
@Get(':id/avatar')
async avatar(
@CurrentUser() user: { organizationId: string },
@Param('id') id: string,
) {
const file = await this.usersService.openAvatar(user.organizationId, id);
return new StreamableFile(file.stream, { type: file.mimeType });
}
@Post()
@Roles('owner', 'admin')
invite(
@@ -49,6 +64,21 @@ export class UsersController {
);
}
@Patch(':id/status')
@Roles('owner', 'admin')
updateStatus(
@CurrentUser() user: { organizationId: string; userId: string; role: UserRole },
@Param('id') id: string,
@Body() dto: UpdateUserStatusDto,
) {
return this.usersService.updateStatus(
user.organizationId,
{ userId: user.userId, role: user.role },
id,
dto.isActive,
);
}
@Patch(':id/role')
@Roles('owner', 'admin')
updateRole(
@@ -60,7 +90,7 @@ export class UsersController {
user.organizationId,
{ userId: user.userId, role: user.role },
id,
dto.role,
dto,
);
}
}