- Git - Download & Install Git.
- Node.js - Download & Install Node.js and the npm package manager.
git clone git@github.com:TheLevius/node-home-library-service.gitgit checkout task-8-logging-authenticationdocker-compose up --buildnpm install // test framework dependenciesAfter application running open new terminal and enter:
npm run test:authЕсли выдает ошибки (socket hang up);
просто надо остановить container app (база пусть работает, с миграциями должно быть все ок)
и запустить приложение без докера
docker stop app
npm run start:devи потом снова запустить тесты
npm run test:authDetails:
- For
Users,Artists,Albums,TracksandFavoritesREST endpoints with separate router paths should be created
-
Users(/userroute)-
GET /user- get all users- Server should answer with
status code200 and all users records
- Server should answer with
-
GET /user/:id- get single user by id- Server should answer with
status code200 and and record withid === userIdif it exists - Server should answer with
status code400 and corresponding message ifuserIdis invalid (notuuid) - Server should answer with
status code404 and corresponding message if record withid === userIddoesn't exist
- Server should answer with
-
POST /user- create user (following DTO should be used)CreateUserDtointerface CreateUserDto { login: string; password: string; }
- Server should answer with
status code201 and newly created record if request is valid - Server should answer with
status code400 and corresponding message if requestbodydoes not contain required fields
- Server should answer with
-
PUT /user/:id- update user's passwordUpdatePasswordDto(with attributes):interface UpdatePasswordDto { oldPassword: string; // previous password newPassword: string; // new password }
- Server should answer with
status code200 and updated record if request is valid - Server should answer with
status code400 and corresponding message ifuserIdis invalid (notuuid) - Server should answer with
status code404 and corresponding message if record withid === userIddoesn't exist - Server should answer with
status code403 and corresponding message ifoldPasswordis wrong
- Server should answer with
-
DELETE /user/:id- delete user- Server should answer with
status code204 if the record is found and deleted - Server should answer with
status code400 and corresponding message ifuserIdis invalid (notuuid) - Server should answer with
status code404 and corresponding message if record withid === userIddoesn't exist
- Server should answer with
-
-
Tracks(/trackroute)GET /track- get all tracks- Server should answer with
status code200 and all tracks records
- Server should answer with
GET /track/:id- get single track by id- Server should answer with
status code200 and and record withid === trackIdif it exists - Server should answer with
status code400 and corresponding message iftrackIdis invalid (notuuid) - Server should answer with
status code404 and corresponding message if record withid === trackIddoesn't exist
- Server should answer with
POST /track- create new track- Server should answer with
status code201 and newly created record if request is valid - Server should answer with
status code400 and corresponding message if requestbodydoes not contain required fields
- Server should answer with
PUT /track/:id- update track info- Server should answer with
status code200 and updated record if request is valid - Server should answer with
status code400 and corresponding message iftrackIdis invalid (notuuid) - Server should answer with
status code404 and corresponding message if record withid === trackIddoesn't exist
- Server should answer with
DELETE /track/:id- delete track- Server should answer with
status code204 if the record is found and deleted - Server should answer with
status code400 and corresponding message iftrackIdis invalid (notuuid) - Server should answer with
status code404 and corresponding message if record withid === trackIddoesn't exist
- Server should answer with
-
Artists(/artistroute)GET /artist- get all artists- Server should answer with
status code200 and all artists records
- Server should answer with
GET /artist/:id- get single artist by id- Server should answer with
status code200 and and record withid === artistIdif it exists - Server should answer with
status code400 and corresponding message ifartistIdis invalid (notuuid) - Server should answer with
status code404 and corresponding message if record withid === artistIddoesn't exist
- Server should answer with
POST /artist- create new artist- Server should answer with
status code201 and newly created record if request is valid - Server should answer with
status code400 and corresponding message if requestbodydoes not contain required fields
- Server should answer with
PUT /artist/:id- update artist info- Server should answer with
status code200 and updated record if request is valid - Server should answer with
status code400 and corresponding message ifartistis invalid (notuuid) - Server should answer with
status code404 and corresponding message if record withid === artistIddoesn't exist
- Server should answer with
DELETE /artist/:id- delete album- Server should answer with
status code204 if the record is found and deleted - Server should answer with
status code400 and corresponding message ifartistIdis invalid (notuuid) - Server should answer with
status code404 and corresponding message if record withid === artistIddoesn't exist
- Server should answer with
-
Albums(/albumroute)GET /album- get all albums- Server should answer with
status code200 and all albums records
- Server should answer with
GET /album/:id- get single album by id- Server should answer with
status code200 and and record withid === albumIdif it exists - Server should answer with
status code400 and corresponding message ifalbumIdis invalid (notuuid) - Server should answer with
status code404 and corresponding message if record withid === albumIddoesn't exist
- Server should answer with
POST /album- create new album- Server should answer with
status code201 and newly created record if request is valid - Server should answer with
status code400 and corresponding message if requestbodydoes not contain required fields
- Server should answer with
PUT /album/:id- update album info- Server should answer with
status code200 and updated record if request is valid - Server should answer with
status code400 and corresponding message ifalbumIdis invalid (notuuid) - Server should answer with
status code404 and corresponding message if record withid === albumIddoesn't exist
- Server should answer with
DELETE /album/:id- delete album- Server should answer with
status code204 if the record is found and deleted - Server should answer with
status code400 and corresponding message ifalbumIdis invalid (notuuid) - Server should answer with
status code404 and corresponding message if record withid === albumIddoesn't exist
- Server should answer with
-
Favorites-
GET /favs- get all favorites- Server should answer with
status code200 and all favorite records (not their ids), split by entity type:
interface FavoritesResponse { artists: Artist[]; albums: Album[]; tracks: Track[]; }
- Server should answer with
-
POST /favs/track/:id- add track to the favorites- Server should answer with
status code201 and corresponding message if track withid === trackIdexists - Server should answer with
status code400 and corresponding message iftrackIdis invalid (notuuid) - Server should answer with
status code422 and corresponding message if track withid === trackIddoesn't exist
- Server should answer with
-
DELETE /favs/track/:id- delete track from favorites- Server should answer with
status code204 if the track was in favorites and now it's deleted id is found and deleted - Server should answer with
status code400 and corresponding message iftrackIdis invalid (notuuid) - Server should answer with
status code404 and corresponding message if corresponding track is not favorite
- Server should answer with
-
POST /favs/album/:id- add album to the favorites- Server should answer with
status code201 and corresponding message if album withid === albumIdexists - Server should answer with
status code400 and corresponding message ifalbumIdis invalid (notuuid) - Server should answer with
status code422 and corresponding message if album withid === albumIddoesn't exist
- Server should answer with
-
DELETE /favs/album/:id- delete album from favorites- Server should answer with
status code204 if the album was in favorites and now it's deleted id is found and deleted - Server should answer with
status code400 and corresponding message ifalbumIdis invalid (notuuid) - Server should answer with
status code404 and corresponding message if corresponding album is not favorite
- Server should answer with
-
POST /favs/artist/:id- add artist to the favorites- Server should answer with
status code201 and corresponding message if artist withid === artistIdexists - Server should answer with
status code400 and corresponding message ifartistIdis invalid (notuuid) - Server should answer with
status code422 and corresponding message if artist withid === artistIddoesn't exist
- Server should answer with
-
DELETE /favs/artist/:id- delete artist from favorites- Server should answer with
status code204 if the artist was in favorites and now it's deleted id is found and deleted - Server should answer with
status code400 and corresponding message ifartistIdis invalid (notuuid) - Server should answer with
status code404 and corresponding message if corresponding artist is not favorite
- Server should answer with
-