Files
fiberops-api-admin/src/users/users.controller.ts
2026-04-13 09:43:35 +08:00

36 lines
937 B
TypeScript

import { Controller, Get, Patch, Param, Body, Query } from '@nestjs/common';
import { UsersService } from './users.service';
@Controller('users')
export class UsersController {
constructor(private readonly service: UsersService) {}
@Get()
findAll(
@Query('search') search?: string,
@Query('tenantId') tenantId?: string,
@Query('page') page?: number,
@Query('limit') limit?: number,
) {
return this.service.findAll({ search, tenantId, page, limit });
}
@Get(':id')
findOne(@Param('id') id: string) {
return this.service.findOne(id);
}
@Patch(':id')
update(
@Param('id') id: string,
@Body() dto: { isActive?: boolean; firstName?: string; lastName?: string },
) {
return this.service.update(id, dto);
}
@Patch(':id/reset-password')
resetPassword(@Param('id') id: string, @Body() dto: { password: string }) {
return this.service.resetPassword(id, dto.password);
}
}