Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
fixed typo
Browse files Browse the repository at this point in the history
  • Loading branch information
OG-NI committed Apr 29, 2024
1 parent 68b52e8 commit 897cc6b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion backend/src/api/user/user.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('UserController', () => {
expect(controller).toBeDefined();
});

it('should return a SanatizedUser object in a gest request', async () => {
it('should return a SanitizedUser object in a gest request', async () => {
const user: User = {
id: '1',
displayName: 'Max Mustermann',
Expand Down
14 changes: 7 additions & 7 deletions backend/src/api/user/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { AuthService } from '../../auth/auth.service';
import { UserRepository } from '../../db/repositories/user.repository';
import { NestRequest } from '../../types/request.type';

type SanatizedUser = Omit<User, 'password'>;
type SanitizedUser = Omit<User, 'password'>;

@Controller('user')
export class UserController {
Expand All @@ -24,11 +24,11 @@ export class UserController {
private userRepository: UserRepository,
) {}

_sanatizeUser(user: User): SanatizedUser {
const sanatizedUser: SanatizedUser & { password?: string } = user;
_sanitizeUser(user: User): SanitizedUser {
const sanitizedUser: SanitizedUser & { password?: string } = user;

delete sanatizedUser.password;
return sanatizedUser;
delete sanitizedUser.password;
return sanitizedUser;
}

/**
Expand All @@ -42,7 +42,7 @@ export class UserController {
@Get('/me')
@UseGuards(AutoGuard)
async getMe(@Req() req) {
return this._sanatizeUser(req.user);
return this._sanitizeUser(req.user);
}

@Patch('/me')
Expand Down Expand Up @@ -77,7 +77,7 @@ export class UserController {
userChanges,
);

res.status(200).json(this._sanatizeUser(user));
res.status(200).json(this._sanitizeUser(user));
} else {
res.status(400).json({
error: 'Nothing was changed',
Expand Down

0 comments on commit 897cc6b

Please sign in to comment.