Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion libs/rucken/core-nestjs/src/controllers/users.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class UsersController {
constructor(
@Inject(CORE_CONFIG_TOKEN) private readonly coreConfig: ICoreConfig,
private readonly service: UsersService
) {}
) { }

@Roles('isSuperuser')
@Permissions('add_user')
Expand All @@ -45,6 +45,7 @@ export class UsersController {
description: 'The record has been successfully created.'
})
@ApiResponse({ status: HttpStatus.FORBIDDEN, description: 'Forbidden.' })
@ApiResponse({ status: HttpStatus.CONFLICT, description: 'Email/username already exists.' })
@Post()
async create(@Body() dto: InCreateUserDto) {
if (dto.isSuperuser && this.coreConfig.demo) {
Expand All @@ -71,6 +72,7 @@ export class UsersController {
description: 'The record has been successfully updated.'
})
@ApiResponse({ status: HttpStatus.FORBIDDEN, description: 'Forbidden.' })
@ApiResponse({ status: HttpStatus.CONFLICT, description: 'Email/username already exists.' })
@ApiImplicitParam({ name: 'id', type: Number })
@Put(':id')
async update(@Param('id', new ParseIntPipe()) id, @Body() dto: InUserDto) {
Expand Down
6 changes: 3 additions & 3 deletions libs/rucken/core-nestjs/src/services/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { User } from '../entities/user.entity';

@Injectable()
export class UsersService {
constructor(@InjectRepository(User) private readonly repository: Repository<User>) {}
constructor(@InjectRepository(User) private readonly repository: Repository<User>) { }

async assertUsernameAndEmail(options: { id?: number; email: string; username: string }) {
if (options.email) {
Expand Down Expand Up @@ -141,7 +141,7 @@ export class UsersService {
user: item
};
} catch (error) {
throw new NotFoundException(`User with email "${options.email}" not founded`);
throw new NotFoundException(`User with email "${options.email}" not found`);
}
}

Expand All @@ -157,7 +157,7 @@ export class UsersService {
user: item
};
} catch (error) {
throw new NotFoundException(`User with username "${options.username}" not founded`);
throw new NotFoundException(`User with username "${options.username}" not found`);
}
}
}
82 changes: 22 additions & 60 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.