diff --git a/back/src/users/users.controller.ts b/back/src/users/users.controller.ts index f049e46..257ebba 100644 --- a/back/src/users/users.controller.ts +++ b/back/src/users/users.controller.ts @@ -1,31 +1,12 @@ -import { - Controller, - Get, - Post, - Body, - Param, - Delete, - NotFoundException, -} from '@nestjs/common'; +import { Controller, Get, Param, NotFoundException } from '@nestjs/common'; import { UsersService } from './users.service'; -import { SettingsService } from 'src/settings/settings.service'; -import { CreateUserDto } from './dto/create-user.dto'; import { ApiNotFoundResponse, ApiTags } from '@nestjs/swagger'; import { User } from 'src/models/user'; -import { resolve } from 'path'; @ApiTags('users') @Controller('users') export class UsersController { - constructor(private readonly usersService: UsersService, private readonly settingsService: SettingsService) {} - - @Post() - create(@Body() createUserDto: CreateUserDto): Promise { - return this.usersService.createUser(createUserDto).then((user) => { - this.settingsService.createUserSetting(user.id); - return user; - }).catch((e) => e); - } + constructor(private readonly usersService: UsersService) {} @Get() findAll(): Promise { @@ -39,9 +20,4 @@ export class UsersController { if (!ret) throw new NotFoundException(); return ret; } - - @Delete(':id') - remove(@Param('id') id: string): Promise { - return this.usersService.deleteUser({ id: +id }); - } } diff --git a/back/test/robot/history/history.robot b/back/test/robot/history/history.robot index 9e8fb52..e2f39d6 100644 --- a/back/test/robot/history/history.robot +++ b/back/test/robot/history/history.robot @@ -34,7 +34,7 @@ Create and get an history record Integer $[0].songID ${song.body.id} Integer $[0].score 55 - [Teardown] Run Keywords DELETE /users/${userID} + [Teardown] Run Keywords DELETE /auth/me ... AND DELETE /song/${song.body.id} Create and get a duplicated history record @@ -68,7 +68,7 @@ Create and get a duplicated history record Integer $[1].songID ${song.body.id} Integer $[1].score 55 - [Teardown] Run Keywords DELETE /users/${userID} + [Teardown] Run Keywords DELETE /auth/me ... AND DELETE /song/${song.body.id} Create and get a search history record @@ -95,7 +95,7 @@ Create and get a search history record ${len}= Get Length ${res.body} Should Be Equal As Integers ${len} 1 - [Teardown] DELETE /users/${userID} + [Teardown] DELETE /auth/me Get the history of a single song [Documentation] Create an history item @@ -137,6 +137,6 @@ Get the history of a single song Integer $.history[1].score 55 Integer $.best 65 - [Teardown] Run Keywords DELETE /users/${userID} + [Teardown] Run Keywords DELETE /auth/me ... AND DELETE /song/${song.body.id} ... AND DELETE /song/${song2.body.id} diff --git a/back/test/robot/settings/settings.robot b/back/test/robot/settings/settings.robot index 1c436b6..49f3ed3 100644 --- a/back/test/robot/settings/settings.robot +++ b/back/test/robot/settings/settings.robot @@ -14,7 +14,7 @@ Get settings Output Should Be True ${get.body.emailNotification} Integer response status 200 - [Teardown] DELETE /users/${userID} + [Teardown] DELETE /auth/me Patch settingspushNotification ${userID}= RegisterLogin 2na-min-faranssa-wa-2na-adrus-allu3'at-al3rabia @@ -24,4 +24,4 @@ Patch settingspushNotification Output Should Not Be True ${patch.body.leaderBoard} Integer response status 200 - [Teardown] DELETE /users/${userID} + [Teardown] DELETE /auth/me diff --git a/back/test/robot/users/users.robot b/back/test/robot/users/users.robot deleted file mode 100644 index 034d07d..0000000 --- a/back/test/robot/users/users.robot +++ /dev/null @@ -1,14 +0,0 @@ -*** Settings *** -Documentation Tests of the /users route. -... Ensures that the users CRUD works corectly. - -Resource ../rest.resource - - -*** Test Cases *** -Create a user - [Documentation] Create a user - &{res}= POST /users {"username": "louis-boufon", "password": "pass", "email": "wow@gmail.com"} - Output - Integer response status 201 - [Teardown] DELETE /users/${res.body.id}