diff --git a/README.md b/README.md index 2cf454a..75464f6 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,46 @@ # java-filmorate -Template repository for Filmorate project. + +![scheme](/scheme.png) + + +--Examples of SQL requests: + +--READ +```SQL +--("/films/{id}") +SELECT * +FROM "films" +WHERE "film_id" = id; + +--("/films/popular") +SELECT * +FROM "films" +ORDER BY "likes_count" DESC +LIMIT(10); + +--("/users") +SELECT * +FROM "users"; + + +--("/users/{id}") +SELECT * +FROM "users" +WHERE "user_id" = id; + +--("/users/{id}/friends") +SELECT * +FROM "friends" fr +INNER JOIN "users" u ON fr."friend_id"=u."user_id" +WHERE fr."user_id" = id; + +--("/users/{id}/friends/common/{otherId}") +SELECT * +FROM "users" us +INNER JOIN (SELECT fr."user_id" +FROM "friends" fr +INNER JOIN "users" u1 ON fr."friend_id"=u1."user_id" +INNER JOIN "users" u2 ON fr."friend_id"=u2."user_id" +WHERE u1."user_id" = id +AND u2."user_id" = otherId) friends ON us."user_id"=friends."user_id"; +``` diff --git a/pom.xml b/pom.xml index c11cc6e..90d0f51 100644 --- a/pom.xml +++ b/pom.xml @@ -27,19 +27,24 @@ org.springframework.boot - spring-boot-starter-test - test + spring-boot-starter-data-jpa + + + com.h2database + h2 + runtime + 2.1.212 - org.projectlombok - lombok - 1.18.20 - provided + org.springframework.boot + spring-boot-starter-test + test org.projectlombok lombok + provided diff --git a/scheme.png b/scheme.png new file mode 100644 index 0000000..0c376b2 Binary files /dev/null and b/scheme.png differ diff --git a/scheme.sql b/scheme.sql new file mode 100644 index 0000000..da92529 --- /dev/null +++ b/scheme.sql @@ -0,0 +1,61 @@ +CREATE TYPE "genre" AS ENUM ( + 'COMEDEY', + 'DRAMA', + 'CARTOON', + 'THRILLER', + 'DOCUMENTARY', + 'ACTION' +); + +CREATE TYPE "mpa" AS ENUM ( + 'G', + 'PG', + 'PG13', + 'R', + 'NC' +); + +CREATE TABLE "users" ( + "user_id" int4 PRIMARY KEY, + "email" varchar(50), + "login" varchar(30), + "name" varchar(100), + "birthday" date +); + +CREATE TABLE "friends" ( + "id" int4 PRIMARY KEY, + "user_id" int4, + "friend_id" int4 +); + +CREATE TABLE "likes" ( + "id" int4 PRIMARY KEY, + "user_id" int4, + "film_id" int4 +); + +CREATE TABLE "films" ( + "film_id" int4 PRIMARY KEY, + "name" varchar(50), + "description" varchar(150), + "release_date" date, + "duration" int2, + "rate" int4, + "mpa" mpa, + "likes_count" int4 +); + +CREATE TABLE "genres" ( + "id" int4 PRIMARY KEY, + "film_id" int4, + "genre" genre +); + +ALTER TABLE "genres" ADD FOREIGN KEY ("film_id") REFERENCES "films" ("film_id"); + +ALTER TABLE "friends" ADD FOREIGN KEY ("user_id") REFERENCES "users" ("user_id"); + +ALTER TABLE "likes" ADD FOREIGN KEY ("user_id") REFERENCES "users" ("user_id"); + +ALTER TABLE "likes" ADD FOREIGN KEY ("film_id") REFERENCES "films" ("film_id"); diff --git a/sprint.json b/sprint.json index 90ff36a..d85d844 100644 --- a/sprint.json +++ b/sprint.json @@ -1,6970 +1,42733 @@ -{ - "info": { - "_postman_id": "5bc299c1-f2a4-4e89-8ae7-26e06579ca77", - "name": "API Test Sprint 2", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "users", - "item": [ - { - "name": "User Create", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.expect(pm.response.code).to.be.oneOf([200,201]);\r", - "});\r", - "pm.test(\"Test create user\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.id).to.eql(1);\r", - " pm.expect(jsonData.email).to.eql('mail@mail.ru');\r", - " pm.expect(jsonData.name).to.eql('Nick Name');\r", - " pm.expect(jsonData.login).to.eql('dolore'); \r", - " pm.expect(jsonData.birthday).to.eql('1946-08-20');\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "*/*" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"login\": \"dolore\",\n \"name\": \"Nick Name\",\n \"email\": \"mail@mail.ru\",\n \"birthday\": \"1946-08-20\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/users", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"login\": \"dolore ullamco\",\n \"name\": \"est adipisicing\",\n \"id\": -35528664,\n \"email\": \"Lorem mollit nisi anim\",\n \"birthday\": \"1946-08-20\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/users", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "User create Fail login", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 500 or 400\", function () {\r", - " pm.expect(pm.response.code).to.be.oneOf([500,400]);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "*/*" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"login\": \"dolore ullamco\",\n \"email\": \"mail.ru\",\n \"birthday\": \"2446-08-20\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/users", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"login\": \"dolore ullamco\",\n \"name\": \"est adipisicing\",\n \"id\": -35528664,\n \"email\": \"Lorem mollit nisi anim\",\n \"birthday\": \"1946-08-20\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/users", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "User create Fail birthday", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 500 or 400\", function () {\r", - " pm.expect(pm.response.code).to.be.oneOf([500,400]);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "*/*" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"login\": \"dolore\",\n \"name\": \"\",\n \"email\": \"test@mail.ru\",\n \"birthday\": \"2446-08-20\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/users", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"login\": \"dolore ullamco\",\n \"name\": \"est adipisicing\",\n \"id\": -35528664,\n \"email\": \"Lorem mollit nisi anim\",\n \"birthday\": \"1946-08-20\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/users", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "User create Fail email", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 500 or 400\", function () {\r", - " pm.expect(pm.response.code).to.be.oneOf([500,400]);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "*/*" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"login\": \"dolore ullamco\",\n \"name\": \"\",\n \"email\": \"mail.ru\",\n \"birthday\": \"1980-08-20\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/users", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"login\": \"dolore ullamco\",\n \"name\": \"est adipisicing\",\n \"id\": -35528664,\n \"email\": \"Lorem mollit nisi anim\",\n \"birthday\": \"1946-08-20\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/users", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "User update", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "pm.test(\"Test update user\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.id).to.eql(1);\r", - " pm.expect(jsonData.email).to.eql('mail@yandex.ru');\r", - " pm.expect(jsonData.name).to.eql('est adipisicing');\r", - " pm.expect(jsonData.login).to.eql('doloreUpdate'); \r", - " pm.expect(jsonData.birthday).to.eql('1976-09-20');\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "*/*" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"login\": \"doloreUpdate\",\n \"name\": \"est adipisicing\",\n \"id\": 1,\n \"email\": \"mail@yandex.ru\",\n \"birthday\": \"1976-09-20\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/users", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"login\": \"dolore ullamco\",\n \"name\": \"est adipisicing\",\n \"id\": -35528664,\n \"email\": \"Lorem mollit nisi anim\",\n \"birthday\": \"1946-08-20\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/users", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "User update unknown", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 404\", function () {\r", - " pm.response.to.have.status(404);\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "*/*" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"login\": \"doloreUpdate\",\n \"name\": \"est adipisicing\",\n \"id\": -1,\n \"email\": \"mail@yandex.ru\",\n \"birthday\": \"1976-09-20\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/users", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"login\": \"dolore ullamco\",\n \"name\": \"est adipisicing\",\n \"id\": -35528664,\n \"email\": \"Lorem mollit nisi anim\",\n \"birthday\": \"1946-08-20\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/users", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "User All", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "\r", - "pm.test(\"Test list user\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.length).to.eql(1);\r", - " pm.expect(jsonData[0].id).to.eql(1);\r", - " pm.expect(jsonData[0].email).to.eql('mail@yandex.ru');\r", - " pm.expect(jsonData[0].name).to.eql('est adipisicing');\r", - " pm.expect(jsonData[0].login).to.eql('doloreUpdate'); \r", - " pm.expect(jsonData[0].birthday).to.eql('1976-09-20');\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/users", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - } - ] - }, - { - "name": "user", - "item": [ - { - "name": "Friend Create", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.expect(pm.response.code).to.be.oneOf([200,201]);\r", - "});\r", - "pm.test(\"Test create friend\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.id).to.eql(2);\r", - " pm.expect(jsonData.email).to.eql('friend@mail.ru');\r", - " pm.expect(jsonData.name).to.eql('friend adipisicing');\r", - " pm.expect(jsonData.login).to.eql('friend'); \r", - " pm.expect(jsonData.birthday).to.eql('1976-08-20');\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "*/*" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"login\": \"friend\",\n \"name\": \"friend adipisicing\",\n \"email\": \"friend@mail.ru\",\n \"birthday\": \"1976-08-20\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/users", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"login\": \"dolore ullamco\",\n \"name\": \"est adipisicing\",\n \"id\": -35528664,\n \"email\": \"Lorem mollit nisi anim\",\n \"birthday\": \"1946-08-20\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/users", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "Common Friend Create", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.expect(pm.response.code).to.be.oneOf([200,201]);\r", - "});\r", - "pm.test(\"Test empty name\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.name).to.eql('common');\r", - "});\r", - "pm.test(\"Test create common friend\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.id).to.eql(3);\r", - " pm.expect(jsonData.email).to.eql('friend@common.ru');\r", - " pm.expect(jsonData.name).to.eql('common');\r", - " pm.expect(jsonData.login).to.eql('common'); \r", - " pm.expect(jsonData.birthday).to.eql('2000-08-20');\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "*/*" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"login\": \"common\",\n \"name\": \"\",\n \"email\": \"friend@common.ru\",\n \"birthday\": \"2000-08-20\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/users", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"login\": \"dolore ullamco\",\n \"name\": \"est adipisicing\",\n \"id\": -35528664,\n \"email\": \"Lorem mollit nisi anim\",\n \"birthday\": \"1946-08-20\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/users", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "User get", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "pm.test(\"Test get user\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.id).to.eql(1);\r", - " pm.expect(jsonData.email).to.eql('mail@yandex.ru');\r", - " pm.expect(jsonData.name).to.eql('est adipisicing');\r", - " pm.expect(jsonData.login).to.eql('doloreUpdate'); \r", - " pm.expect(jsonData.birthday).to.eql('1976-09-20');\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/users/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "1", - "description": "(Required) " - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "User get unknown", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 404\", function () {\r", - " pm.response.to.have.status(404);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/users/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-1", - "description": "(Required) " - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "Friend get", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "pm.test(\"Test get friend\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.id).to.eql(2);\r", - " pm.expect(jsonData.email).to.eql('friend@mail.ru');\r", - " pm.expect(jsonData.name).to.eql('friend adipisicing');\r", - " pm.expect(jsonData.login).to.eql('friend'); \r", - " pm.expect(jsonData.birthday).to.eql('1976-08-20');\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/users/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "2", - "description": "(Required) " - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - } - ] - }, - { - "name": "friend", - "item": [ - { - "name": "User get friends common empty", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "pm.test(\"Test get common friend\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.length).to.eql(0);\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/common/:otherId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - "common", - ":otherId" - ], - "variable": [ - { - "key": "id", - "value": "1", - "description": "(Required) " - }, - { - "key": "otherId", - "value": "2" - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "User add friend", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.expect(pm.response.code).to.be.oneOf([200,204]);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "1", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "2", - "description": "(Required) " - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "POST", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "text/plain" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "POST", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "POST", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "POST", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "User add friend unknown", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 404\", function () {\r", - " pm.response.to.have.status(404);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "1", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-1", - "description": "(Required) " - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "POST", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "text/plain" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "POST", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "POST", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "POST", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "User get friends", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "pm.test(\"Test user friends\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.length).to.eql(1);\r", - " pm.expect(jsonData[0].id).to.eql(2);\r", - " pm.expect(jsonData[0].email).to.eql('friend@mail.ru');\r", - " pm.expect(jsonData[0].name).to.eql('friend adipisicing');\r", - " pm.expect(jsonData[0].login).to.eql('friend'); \r", - " pm.expect(jsonData[0].birthday).to.eql('1976-08-20');\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "1", - "description": "(Required) " - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "Friend get friends", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "pm.test(\"Test user friends\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.length).to.eql(1);\r", - " pm.expect(jsonData[0].id).to.eql(1);\r", - " pm.expect(jsonData[0].email).to.eql('mail@yandex.ru');\r", - " pm.expect(jsonData[0].name).to.eql('est adipisicing');\r", - " pm.expect(jsonData[0].login).to.eql('doloreUpdate'); \r", - " pm.expect(jsonData[0].birthday).to.eql('1976-09-20');\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "2", - "description": "(Required) " - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "User get friends mutual", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "pm.test(\"Test user mutual friends\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.length).to.eql(0);\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/common/:otherId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - "common", - ":otherId" - ], - "variable": [ - { - "key": "id", - "value": "1", - "description": "(Required) " - }, - { - "key": "otherId", - "value": "2" - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "User add common friend", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.expect(pm.response.code).to.be.oneOf([200,204]);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "1", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "3", - "description": "(Required) " - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "POST", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "text/plain" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "POST", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "POST", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "POST", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "User get 2 friends", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "pm.test(\"Test user 2 friends\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.length).to.eql(2);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "1", - "description": "(Required) " - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "Friend add common friend", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.expect(pm.response.code).to.be.oneOf([200,204]);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "2", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "3", - "description": "(Required) " - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "POST", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "text/plain" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "POST", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "POST", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "POST", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "Friend get 2 friends", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "pm.test(\"Test friend friends\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.length).to.eql(2);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "2", - "description": "(Required) " - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "User get friends common", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "pm.test(\"Test get common friend\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.length).to.eql(1);\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/common/:otherId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - "common", - ":otherId" - ], - "variable": [ - { - "key": "id", - "value": "1", - "description": "(Required) " - }, - { - "key": "otherId", - "value": "2" - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "User remove friend", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.expect(pm.response.code).to.be.oneOf([200,204]);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "1", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "2", - "description": "(Required) " - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "text/plain" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/:friendId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - ":friendId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "friendId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "User get friends common", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "pm.test(\"Test get common friend\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.length).to.eql(1);\r", - " pm.expect(jsonData[0].id).to.eql(3);\r", - " pm.expect(jsonData[0].email).to.eql('friend@common.ru');\r", - " pm.expect(jsonData[0].name).to.eql('common');\r", - " pm.expect(jsonData[0].login).to.eql('common'); \r", - " pm.expect(jsonData[0].birthday).to.eql('2000-08-20');\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/common/:otherId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - "common", - ":otherId" - ], - "variable": [ - { - "key": "id", - "value": "1", - "description": "(Required) " - }, - { - "key": "otherId", - "value": "2" - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "Friend get friends common", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "pm.test(\"Test get common friend\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.length).to.eql(1);\r", - " pm.expect(jsonData[0].id).to.eql(3);\r", - " pm.expect(jsonData[0].email).to.eql('friend@common.ru');\r", - " pm.expect(jsonData[0].name).to.eql('common');\r", - " pm.expect(jsonData[0].login).to.eql('common'); \r", - " pm.expect(jsonData[0].birthday).to.eql('2000-08-20');\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/users/:id/friends/common/:otherId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends", - "common", - ":otherId" - ], - "variable": [ - { - "key": "id", - "value": "2", - "description": "(Required) " - }, - { - "key": "otherId", - "value": "1" - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/users/:id/friends", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users", - ":id", - "friends" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - } - ] - }, - { - "name": "films", - "item": [ - { - "name": "Film get All", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "pm.test(\"Test count films\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.length).to.eql(0);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "Film create", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.expect(pm.response.code).to.be.oneOf([200,201]);\r", - "});\r", - "pm.test(\"Test created film\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.id).to.eql(1);\r", - " pm.expect(jsonData.name).to.eql('labore nulla');\r", - " pm.expect(jsonData.description).to.eql('Duis in consequat esse'); \r", - " pm.expect(jsonData.releaseDate).to.eql('1979-04-17');\r", - " pm.expect(jsonData.duration).to.eql(100);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "*/*" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 100,\n \"rate\": 4\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "Film create Fail name", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 500 or 400\", function () {\r", - " pm.expect(pm.response.code).to.be.oneOf([500,400]);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "*/*" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"\",\n \"description\": \"Description\",\n \"releaseDate\": \"1900-03-25\",\n \"duration\": 200\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"nisi eiusmod\",\n \"id\": -7113753,\n \"description\": \"adipisicing\",\n \"releaseDate\": \"1967-03-25\",\n \"duration\": 33722088\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "Film create Fail description", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 500 or 400\", function () {\r", - " pm.expect(pm.response.code).to.be.oneOf([500,400]);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "*/*" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"Film name\",\n \"description\": \"Пятеро друзей ( комик-группа «Шарло»), приезжают в город Бризуль. Здесь они хотят разыскать господина Огюста Куглова, который задолжал им деньги, а именно 20 миллионов. о Куглов, который за время «своего отсутствия», стал кандидатом Коломбани.\",\n \"releaseDate\": \"1900-03-25\",\n \"duration\": 200\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"nisi eiusmod\",\n \"id\": -7113753,\n \"description\": \"adipisicing\",\n \"releaseDate\": \"1967-03-25\",\n \"duration\": 33722088\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "Film create Fail releaseDate", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 500 or 400\", function () {\r", - " pm.expect(pm.response.code).to.be.oneOf([500,400]);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "*/*" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"Name\",\n \"description\": \"Description\",\n \"releaseDate\": \"1890-03-25\",\n \"duration\": 200\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"nisi eiusmod\",\n \"id\": -7113753,\n \"description\": \"adipisicing\",\n \"releaseDate\": \"1967-03-25\",\n \"duration\": 33722088\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "Film create Fail duration", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 500 or 400\", function () {\r", - " pm.expect(pm.response.code).to.be.oneOf([500,400]);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "*/*" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"Name\",\n \"description\": \"Descrition\",\n \"releaseDate\": \"1980-03-25\",\n \"duration\": -200\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"nisi eiusmod\",\n \"id\": -7113753,\n \"description\": \"adipisicing\",\n \"releaseDate\": \"1967-03-25\",\n \"duration\": 33722088\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "Film update", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "pm.test(\"Test updated film\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.id).to.eql(1);\r", - " pm.expect(jsonData.name).to.eql('Film Updated');\r", - " pm.expect(jsonData.description).to.eql('New film update decription'); \r", - " pm.expect(jsonData.releaseDate).to.eql('1989-04-17');\r", - " pm.expect(jsonData.duration).to.eql(190);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "*/*" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"id\": 1,\n \"name\": \"Film Updated\",\n \"releaseDate\": \"1989-04-17\",\n \"description\": \"New film update decription\",\n \"duration\": 190,\n \"rate\": 4\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "Film update unknown", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 404\", function () {\r", - " pm.response.to.have.status(404);\r", - "});\r", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "*/*" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"id\": -1,\n \"name\": \"Film Updated\",\n \"releaseDate\": \"1989-04-17\",\n \"description\": \"New film update decription\",\n \"duration\": 190,\n \"rate\": 4\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "PUT", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"login\": \"dolore ullamco\",\n \"name\": \"est adipisicing\",\n \"id\": -35528664,\n \"email\": \"Lorem mollit nisi anim\",\n \"birthday\": \"1946-08-20\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/users", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "users" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "Film get Popular", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "pm.test(\"Test popular film\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.length).to.eql(1);\r", - " pm.expect(jsonData[0].name).to.eql('Film Updated');\r", - " pm.expect(jsonData[0].description).to.eql('New film update decription'); \r", - " pm.expect(jsonData[0].releaseDate).to.eql('1989-04-17');\r", - " pm.expect(jsonData[0].duration).to.eql(190);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/films/popular", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - "popular" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/popular", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - "popular" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/popular", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - "popular" - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/popular", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - "popular" - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/popular", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - "popular" - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - } - ] - }, - { - "name": "film", - "item": [ - { - "name": "Film create Firend", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.expect(pm.response.code).to.be.oneOf([200,201]);\r", - "});\r", - "pm.test(\"Test email\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.name).to.eql('New film');\r", - " pm.expect(jsonData.description).to.eql('New film about friends'); \r", - " pm.expect(jsonData.releaseDate).to.eql('1999-04-30');\r", - " pm.expect(jsonData.duration).to.eql(120);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Accept", - "value": "*/*" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"New film\",\n \"releaseDate\": \"1999-04-30\",\n \"description\": \"New film about friends\",\n \"duration\": 120,\n \"rate\": 4\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{baseUrl}}/films", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films" - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "Film get", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/films/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "1", - "description": "(Required) " - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "Film get unknown", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 404\", function () {\r", - " pm.response.to.have.status(404);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/films/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-1", - "description": "(Required) " - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/:id", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - } - ] - }, - { - "name": "like", - "item": [ - { - "name": "Film add Like", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.expect(pm.response.code).to.be.oneOf([200,204]);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "PUT", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/films/:id/like/:userId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id", - "like", - ":userId" - ], - "variable": [ - { - "key": "id", - "value": "2", - "description": "(Required) " - }, - { - "key": "userId", - "value": "1", - "description": "(Required) " - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "PUT", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/:id/like/:userId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id", - "like", - ":userId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "userId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "text/plain" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "PUT", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/:id/like/:userId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id", - "like", - ":userId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "userId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "PUT", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/:id/like/:userId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id", - "like", - ":userId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "userId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "PUT", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/:id/like/:userId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id", - "like", - ":userId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "userId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "Film get Popular count", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "pm.test(\"Test popular\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.length).to.eql(1);\r", - " pm.expect(jsonData[0].id).to.eql(2);\r", - " pm.expect(jsonData[0].name).to.eql('New film');\r", - " pm.expect(jsonData[0].description).to.eql('New film about friends'); \r", - " pm.expect(jsonData[0].releaseDate).to.eql('1999-04-30');\r", - " pm.expect(jsonData[0].duration).to.eql(120);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/films/popular?count=1", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - "popular" - ], - "query": [ - { - "key": "count", - "value": "1" - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/popular", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - "popular" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/popular", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - "popular" - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/popular", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - "popular" - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/popular", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - "popular" - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "Film remove Like", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.expect(pm.response.code).to.be.oneOf([200,204]);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/films/:id/like/:userId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id", - "like", - ":userId" - ], - "variable": [ - { - "key": "id", - "value": "2", - "description": "(Required) " - }, - { - "key": "userId", - "value": "1", - "description": "(Required) " - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/:id/like/:userId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id", - "like", - ":userId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "userId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "text/plain" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/:id/like/:userId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id", - "like", - ":userId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "userId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/:id/like/:userId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id", - "like", - ":userId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "userId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/:id/like/:userId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id", - "like", - ":userId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "userId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "Film get Popular count 2", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 200\", function () {\r", - " pm.response.to.have.status(200);\r", - "});\r", - "pm.test(\"Test popular\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.expect(jsonData.length).to.eql(2);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/films/popular", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - "popular" - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/popular", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - "popular" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/popular", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - "popular" - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/popular", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - "popular" - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/popular", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - "popular" - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - }, - { - "name": "Film remove Like not found", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "pm.test(\"Status code is 404\", function () {\r", - " pm.response.to.have.status(404);\r", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "DELETE", - "header": [ - { - "key": "Accept", - "value": "*/*" - } - ], - "url": { - "raw": "{{baseUrl}}/films/:id/like/:userId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id", - "like", - ":userId" - ], - "variable": [ - { - "key": "id", - "value": "1", - "description": "(Required) " - }, - { - "key": "userId", - "value": "-2", - "description": "(Required) " - } - ] - } - }, - "response": [ - { - "name": "OK", - "originalRequest": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/:id/like/:userId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id", - "like", - ":userId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "userId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "text/plain" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Not Found", - "originalRequest": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/:id/like/:userId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id", - "like", - ":userId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "userId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Not Found", - "code": 404, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Conflict", - "originalRequest": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/:id/like/:userId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id", - "like", - ":userId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "userId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Conflict", - "code": 409, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - }, - { - "name": "Internal Server Error", - "originalRequest": { - "method": "DELETE", - "header": [], - "url": { - "raw": "{{baseUrl}}/films/:id/like/:userId", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "films", - ":id", - "like", - ":userId" - ], - "variable": [ - { - "key": "id", - "value": "-29029902", - "description": "(Required) " - }, - { - "key": "userId", - "value": "-29029902", - "description": "(Required) " - } - ] - } - }, - "status": "Internal Server Error", - "code": 500, - "_postman_previewlanguage": "text", - "header": [ - { - "key": "Content-Type", - "value": "*/*" - } - ], - "cookie": [], - "body": "" - } - ] - } - ] - } - ], - "variable": [ - { - "key": "baseUrl", - "value": "http://localhost:8080", - "type": "string" - } - ] -} \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + java-filmorate/sprint.json at add-database · yandex-praktikum/java-filmorate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Skip to content + + + + + + + + + + + + + + +
+ +
+ + + + + + + +
+ + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + yandex-praktikum  /   + java-filmorate  /   + +
+
+ + + +
+ + +
+ + +
+ + + +
+
+ Tip: + Type # to search pull requests +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type # to search issues +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type # to search discussions +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type ! to search projects +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type @ to search teams +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type @ to search people and organizations +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type > to activate command mode +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Go to your accessibility settings to change your keyboard shortcuts +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type author:@me to search your content +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type is:pr to filter to pull requests +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type is:issue to filter to issues +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type is:project to filter to projects +
+
+ Type ? for help and tips +
+
+
+ +
+
+ Tip: + Type is:open to filter to open content +
+
+ Type ? for help and tips +
+
+
+ +
+ +
+
+ We’ve encountered an error and some results aren't available at this time. Type a new search or try again later. +
+
+ + No results matched your search + + + + + + + + + + +
+ + + + + Search for issues and pull requests + + # + + + + Search for issues, pull requests, discussions, and projects + + # + + + + Search for organizations, repositories, and users + + @ + + + + Search for projects + + ! + + + + Search for files + + / + + + + Activate command mode + + > + + + + Search your issues, pull requests, and discussions + + # author:@me + + + + Search your issues, pull requests, and discussions + + # author:@me + + + + Filter to pull requests + + # is:pr + + + + Filter to issues + + # is:issue + + + + Filter to discussions + + # is:discussion + + + + Filter to projects + + # is:project + + + + Filter to open issues, pull requests, and discussions + + # is:open + + + + + + + + + + + + + + + + +
+
+
+ +
+ + + + + + + + + + +
+ + +
+
+
+ + + + + + + + + + +
+ +
+ +
+
+ + + / + + java-filmorate + + + Public template +
+ +
+ +
    + + + +
  • + +
    + + + + + + + Watch + + + 12 + + + + +
    +
    +

    Notifications

    + +
    + +
    +
    + + + + + + + + +
    + + +
    + + + + + Get push notifications on iOS or Android. + +
    +
    +
    +
    + + + + +
    +
    +
    + + + +
  • + +
  • + + Fork + 61 + + +
  • + +
  • + + +
    +
    + + +
    +
    + +
    +
    + + + + +
    + +
    +
    + + + + + + + +
    + +
    +
    +
    +
    +
    +
  • + + + +
+ +
+ +
+
+ + + + +
+ + + + + +
+ Open in github.dev + Open in a new github.dev tab + + + + + + +
+ + +
+ + + + + + + + +Permalink + +
+ +
+
+ + + add-database + + + + +
+
+
+ Switch branches/tags + +
+ + + +
+ +
+ +
+ + +
+ +
+ + + + + + + + + + + + + + + +
+ + +
+
+
+
+ +
+ +
+ + + Go to file + + +
+ + + + + +
+
+
+ + + + + + + + + +
+ +
+
+ + @vlad-iv + +
+ + + + + + +
+
+ + Latest commit + bb5631f + May 27, 2022 + + + + + + History + + +
+
+ +
+ +
+
+ + + 1 + + contributor + + +
+ +

+ Users who have contributed to this file +

+
+ + + + + + +
+
+
+
+ + + + + + + + + + + + +
+ +
+ + +
+ + 9981 lines (9981 sloc) + + 216 KB +
+ +
+ + + + +
+ + + +
+
+
+
+ +
+
+ +
+
+
+
+ + + +
+
+ + + +
+ +
+
+ +
+ +
+
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{
"info": {
"_postman_id": "3e285987-d223-42cb-95b6-34f7b9ca053e",
"name": "API Test Sprint 4",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "2036415"
},
"item": [
{
"name": "users",
"item": [
{
"name": "User Create",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([200,201]);\r",
"});\r",
"pm.test(\"Test create user\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.id).to.eql(1);\r",
" pm.expect(jsonData.email).to.eql('mail@mail.ru');\r",
" pm.expect(jsonData.name).to.eql('Nick Name');\r",
" pm.expect(jsonData.login).to.eql('dolore'); \r",
" pm.expect(jsonData.birthday).to.eql('1946-08-20');\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"login\": \"dolore\",\n \"name\": \"Nick Name\",\n \"email\": \"mail@mail.ru\",\n \"birthday\": \"1946-08-20\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"login\": \"dolore ullamco\",\n \"name\": \"est adipisicing\",\n \"id\": -35528664,\n \"email\": \"Lorem mollit nisi anim\",\n \"birthday\": \"1946-08-20\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "User create Fail login",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 500 or 400\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([500,400]);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"login\": \"dolore ullamco\",\n \"email\": \"mail.ru\",\n \"birthday\": \"2446-08-20\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"login\": \"dolore ullamco\",\n \"name\": \"est adipisicing\",\n \"id\": -35528664,\n \"email\": \"Lorem mollit nisi anim\",\n \"birthday\": \"1946-08-20\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "User create Fail birthday",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 500 or 400\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([500,400]);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"login\": \"dolore\",\n \"name\": \"\",\n \"email\": \"test@mail.ru\",\n \"birthday\": \"2446-08-20\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"login\": \"dolore ullamco\",\n \"name\": \"est adipisicing\",\n \"id\": -35528664,\n \"email\": \"Lorem mollit nisi anim\",\n \"birthday\": \"1946-08-20\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "User create Fail email",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 500 or 400\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([500,400]);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"login\": \"dolore ullamco\",\n \"name\": \"\",\n \"email\": \"mail.ru\",\n \"birthday\": \"1980-08-20\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"login\": \"dolore ullamco\",\n \"name\": \"est adipisicing\",\n \"id\": -35528664,\n \"email\": \"Lorem mollit nisi anim\",\n \"birthday\": \"1946-08-20\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "User update",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test update user\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.id).to.eql(1);\r",
" pm.expect(jsonData.email).to.eql('mail@yandex.ru');\r",
" pm.expect(jsonData.name).to.eql('est adipisicing');\r",
" pm.expect(jsonData.login).to.eql('doloreUpdate'); \r",
" pm.expect(jsonData.birthday).to.eql('1976-09-20');\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"login\": \"doloreUpdate\",\n \"name\": \"est adipisicing\",\n \"id\": 1,\n \"email\": \"mail@yandex.ru\",\n \"birthday\": \"1976-09-20\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"login\": \"dolore ullamco\",\n \"name\": \"est adipisicing\",\n \"id\": -35528664,\n \"email\": \"Lorem mollit nisi anim\",\n \"birthday\": \"1946-08-20\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "User update unknown",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 404\", function () {\r",
" pm.response.to.have.status(404);\r",
"});\r",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"login\": \"doloreUpdate\",\n \"name\": \"est adipisicing\",\n \"id\": -1,\n \"email\": \"mail@yandex.ru\",\n \"birthday\": \"1976-09-20\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"login\": \"dolore ullamco\",\n \"name\": \"est adipisicing\",\n \"id\": -35528664,\n \"email\": \"Lorem mollit nisi anim\",\n \"birthday\": \"1946-08-20\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "User All",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"\r",
"pm.test(\"Test list user\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.length).to.eql(1);\r",
" pm.expect(jsonData[0].id).to.eql(1);\r",
" pm.expect(jsonData[0].email).to.eql('mail@yandex.ru');\r",
" pm.expect(jsonData[0].name).to.eql('est adipisicing');\r",
" pm.expect(jsonData[0].login).to.eql('doloreUpdate'); \r",
" pm.expect(jsonData[0].birthday).to.eql('1976-09-20');\r",
"});\r",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
}
]
},
{
"name": "user",
"item": [
{
"name": "Friend Create",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([200,201]);\r",
"});\r",
"pm.test(\"Test create friend\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.id).to.eql(2);\r",
" pm.expect(jsonData.email).to.eql('friend@mail.ru');\r",
" pm.expect(jsonData.name).to.eql('friend adipisicing');\r",
" pm.expect(jsonData.login).to.eql('friend'); \r",
" pm.expect(jsonData.birthday).to.eql('1976-08-20');\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"login\": \"friend\",\n \"name\": \"friend adipisicing\",\n \"email\": \"friend@mail.ru\",\n \"birthday\": \"1976-08-20\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"login\": \"dolore ullamco\",\n \"name\": \"est adipisicing\",\n \"id\": -35528664,\n \"email\": \"Lorem mollit nisi anim\",\n \"birthday\": \"1946-08-20\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Common Friend Create",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([200,201]);\r",
"});\r",
"pm.test(\"Test empty name\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.name).to.eql('common');\r",
"});\r",
"pm.test(\"Test create common friend\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.id).to.eql(3);\r",
" pm.expect(jsonData.email).to.eql('friend@common.ru');\r",
" pm.expect(jsonData.name).to.eql('common');\r",
" pm.expect(jsonData.login).to.eql('common'); \r",
" pm.expect(jsonData.birthday).to.eql('2000-08-20');\r",
"});\r",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"login\": \"common\",\n \"name\": \"\",\n \"email\": \"friend@common.ru\",\n \"birthday\": \"2000-08-20\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"login\": \"dolore ullamco\",\n \"name\": \"est adipisicing\",\n \"id\": -35528664,\n \"email\": \"Lorem mollit nisi anim\",\n \"birthday\": \"1946-08-20\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "User get",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test get user\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.id).to.eql(1);\r",
" pm.expect(jsonData.email).to.eql('mail@yandex.ru');\r",
" pm.expect(jsonData.name).to.eql('est adipisicing');\r",
" pm.expect(jsonData.login).to.eql('doloreUpdate'); \r",
" pm.expect(jsonData.birthday).to.eql('1976-09-20');\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "1",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "User get unknown",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 404\", function () {\r",
" pm.response.to.have.status(404);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-1",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Friend get",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test get friend\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.id).to.eql(2);\r",
" pm.expect(jsonData.email).to.eql('friend@mail.ru');\r",
" pm.expect(jsonData.name).to.eql('friend adipisicing');\r",
" pm.expect(jsonData.login).to.eql('friend'); \r",
" pm.expect(jsonData.birthday).to.eql('1976-08-20');\r",
"});\r",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "2",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
}
]
},
{
"name": "friend",
"item": [
{
"name": "User get friends common empty",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test get common friend\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.length).to.eql(0);\r",
"});\r",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/common/:otherId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
"common",
":otherId"
],
"variable": [
{
"key": "id",
"value": "1",
"description": "(Required) "
},
{
"key": "otherId",
"value": "2"
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "User add friend",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([200,204]);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PUT",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "1",
"description": "(Required) "
},
{
"key": "friendId",
"value": "2",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "User add friend unknown",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 404\", function () {\r",
" pm.response.to.have.status(404);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PUT",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "1",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-1",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "User get friends",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test user friends\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.length).to.eql(1);\r",
" pm.expect(jsonData[0].id).to.eql(2);\r",
" pm.expect(jsonData[0].email).to.eql('friend@mail.ru');\r",
" pm.expect(jsonData[0].name).to.eql('friend adipisicing');\r",
" pm.expect(jsonData[0].login).to.eql('friend'); \r",
" pm.expect(jsonData[0].birthday).to.eql('1976-08-20');\r",
"});\r",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "1",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Friend get friends",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test user friends\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.length).to.eql(0);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "2",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "User get friends mutual",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test user mutual friends\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.length).to.eql(0);\r",
"});\r",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/common/:otherId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
"common",
":otherId"
],
"variable": [
{
"key": "id",
"value": "1",
"description": "(Required) "
},
{
"key": "otherId",
"value": "2"
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "User add common friend",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([200,204]);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PUT",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "1",
"description": "(Required) "
},
{
"key": "friendId",
"value": "3",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "User get 2 friends",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test user 2 friends\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.length).to.eql(2);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "1",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Friend add common friend",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([200,204]);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PUT",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "2",
"description": "(Required) "
},
{
"key": "friendId",
"value": "3",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Friend get 1 friends",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test friend friends\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.length).to.eql(1);\r",
" pm.expect(jsonData[0].id).to.eql(3);\r",
" pm.expect(jsonData[0].email).to.eql('friend@common.ru');\r",
" pm.expect(jsonData[0].name).to.eql('common');\r",
" pm.expect(jsonData[0].login).to.eql('common'); \r",
" pm.expect(jsonData[0].birthday).to.eql('2000-08-20');\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "2",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "User get friends common",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test get common friend\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.length).to.eql(1);\r",
" pm.expect(jsonData[0].id).to.eql(3);\r",
" pm.expect(jsonData[0].email).to.eql('friend@common.ru');\r",
" pm.expect(jsonData[0].name).to.eql('common');\r",
" pm.expect(jsonData[0].login).to.eql('common'); \r",
" pm.expect(jsonData[0].birthday).to.eql('2000-08-20');\r",
"});\r",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/common/:otherId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
"common",
":otherId"
],
"variable": [
{
"key": "id",
"value": "1",
"description": "(Required) "
},
{
"key": "otherId",
"value": "2"
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "User remove friend",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([200,204]);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "DELETE",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "1",
"description": "(Required) "
},
{
"key": "friendId",
"value": "2",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "DELETE",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "DELETE",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "DELETE",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "DELETE",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/:friendId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
":friendId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "friendId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "User get friends common",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test get common friend\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.length).to.eql(1);\r",
" pm.expect(jsonData[0].id).to.eql(3);\r",
" pm.expect(jsonData[0].email).to.eql('friend@common.ru');\r",
" pm.expect(jsonData[0].name).to.eql('common');\r",
" pm.expect(jsonData[0].login).to.eql('common'); \r",
" pm.expect(jsonData[0].birthday).to.eql('2000-08-20');\r",
"});\r",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/common/:otherId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
"common",
":otherId"
],
"variable": [
{
"key": "id",
"value": "1",
"description": "(Required) "
},
{
"key": "otherId",
"value": "2"
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Friend get friends common",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test get common friend\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.length).to.eql(1);\r",
" pm.expect(jsonData[0].id).to.eql(3);\r",
" pm.expect(jsonData[0].email).to.eql('friend@common.ru');\r",
" pm.expect(jsonData[0].name).to.eql('common');\r",
" pm.expect(jsonData[0].login).to.eql('common'); \r",
" pm.expect(jsonData[0].birthday).to.eql('2000-08-20');\r",
"});\r",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/users/:id/friends/common/:otherId",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends",
"common",
":otherId"
],
"variable": [
{
"key": "id",
"value": "2",
"description": "(Required) "
},
{
"key": "otherId",
"value": "1"
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "User get 1 friends",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test user 2 friends\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.length).to.eql(1);\r",
" pm.expect(jsonData[0].id).to.eql(3);\r",
" pm.expect(jsonData[0].email).to.eql('friend@common.ru');\r",
" pm.expect(jsonData[0].name).to.eql('common');\r",
" pm.expect(jsonData[0].login).to.eql('common'); \r",
" pm.expect(jsonData[0].birthday).to.eql('2000-08-20');\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "1",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id/friends",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id",
"friends"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
}
]
},
{
"name": "films",
"item": [
{
"name": "Film get All",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test count films\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.length).to.eql(0);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Film create",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([200,201]);\r",
"});\r",
"pm.test(\"Test created film\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.id).to.eql(1);\r",
" pm.expect(jsonData.name).to.eql('labore nulla');\r",
" pm.expect(jsonData.description).to.eql('Duis in consequat esse'); \r",
" pm.expect(jsonData.releaseDate).to.eql('1979-04-17');\r",
" pm.expect(jsonData.duration).to.eql(100);\r",
" pm.expect(jsonData.mpa.id).to.eql(1);\r",
" pm.expect(jsonData.genres).null;\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 100,\n \"rate\": 4,\n \"mpa\": { \"id\": 1}\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Film create Fail name",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 500 or 400\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([500,400]);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"\",\n \"description\": \"Description\",\n \"releaseDate\": \"1900-03-25\",\n \"duration\": 200\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"nisi eiusmod\",\n \"id\": -7113753,\n \"description\": \"adipisicing\",\n \"releaseDate\": \"1967-03-25\",\n \"duration\": 33722088\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Film create Fail description",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 500 or 400\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([500,400]);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"Film name\",\n \"description\": \"Пятеро друзей ( комик-группа «Шарло»), приезжают в город Бризуль. Здесь они хотят разыскать господина Огюста Куглова, который задолжал им деньги, а именно 20 миллионов. о Куглов, который за время «своего отсутствия», стал кандидатом Коломбани.\",\n \"releaseDate\": \"1900-03-25\",\n \"duration\": 200\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"nisi eiusmod\",\n \"id\": -7113753,\n \"description\": \"adipisicing\",\n \"releaseDate\": \"1967-03-25\",\n \"duration\": 33722088\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Film create Fail releaseDate",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 500 or 400\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([500,400]);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"Name\",\n \"description\": \"Description\",\n \"releaseDate\": \"1890-03-25\",\n \"duration\": 200\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"nisi eiusmod\",\n \"id\": -7113753,\n \"description\": \"adipisicing\",\n \"releaseDate\": \"1967-03-25\",\n \"duration\": 33722088\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Film create Fail duration",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 500 or 400\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([500,400]);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"Name\",\n \"description\": \"Descrition\",\n \"releaseDate\": \"1980-03-25\",\n \"duration\": -200\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"nisi eiusmod\",\n \"id\": -7113753,\n \"description\": \"adipisicing\",\n \"releaseDate\": \"1967-03-25\",\n \"duration\": 33722088\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Film create Fail MPA",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 500 or 400\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([500,400]);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"Name\",\n \"description\": \"Descrition\",\n \"releaseDate\": \"1980-03-25\",\n \"duration\": 200,\n \"mpa\": null\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"nisi eiusmod\",\n \"id\": -7113753,\n \"description\": \"adipisicing\",\n \"releaseDate\": \"1967-03-25\",\n \"duration\": 33722088\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Film update",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test updated film\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.id).to.eql(1);\r",
" pm.expect(jsonData.name).to.eql('Film Updated');\r",
" pm.expect(jsonData.description).to.eql('New film update decription'); \r",
" pm.expect(jsonData.releaseDate).to.eql('1989-04-17');\r",
" pm.expect(jsonData.duration).to.eql(190);\r",
" pm.expect(jsonData.mpa.id).to.eql(5);\r",
" pm.expect(jsonData.genres).null;\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 1,\n \"name\": \"Film Updated\",\n \"releaseDate\": \"1989-04-17\",\n \"description\": \"New film update decription\",\n \"duration\": 190,\n \"rate\": 4,\n \"mpa\": { \"id\": 5}\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Film update unknown",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 404\", function () {\r",
" pm.response.to.have.status(404);\r",
"});\r",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"id\": -1,\n \"name\": \"Film Updated\",\n \"releaseDate\": \"1989-04-17\",\n \"description\": \"New film update decription\",\n \"duration\": 190,\n \"mpa\": { \"id\": 5}\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"login\": \"dolore ullamco\",\n \"name\": \"est adipisicing\",\n \"id\": -35528664,\n \"email\": \"Lorem mollit nisi anim\",\n \"birthday\": \"1946-08-20\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Film get Popular",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test popular film\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.length).to.eql(1);\r",
" pm.expect(jsonData[0].name).to.eql('Film Updated');\r",
" pm.expect(jsonData[0].description).to.eql('New film update decription'); \r",
" pm.expect(jsonData[0].releaseDate).to.eql('1989-04-17');\r",
" pm.expect(jsonData[0].duration).to.eql(190);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/films/popular",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
"popular"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/popular",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
"popular"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/popular",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
"popular"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/popular",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
"popular"
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/popular",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
"popular"
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
}
]
},
{
"name": "film",
"item": [
{
"name": "Film create Firend",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([200,201]);\r",
"});\r",
"pm.test(\"Test email\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.name).to.eql('New film');\r",
" pm.expect(jsonData.description).to.eql('New film about friends'); \r",
" pm.expect(jsonData.releaseDate).to.eql('1999-04-30');\r",
" pm.expect(jsonData.duration).to.eql(120);\r",
" pm.expect(jsonData.mpa.id).to.eql(3);\r",
" pm.expect(jsonData.genres.length).to.eql(1);\r",
" pm.expect(jsonData.genres[0].id).to.eql(1);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"New film\",\n \"releaseDate\": \"1999-04-30\",\n \"description\": \"New film about friends\",\n \"duration\": 120,\n \"rate\": 4,\n \"mpa\": { \"id\": 3},\n \"genres\": [{ \"id\": 1}]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Film get",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test get film\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.id).to.eql(1);\r",
" pm.expect(jsonData.name).to.eql('Film Updated');\r",
" pm.expect(jsonData.description).to.eql('New film update decription'); \r",
" pm.expect(jsonData.releaseDate).to.eql('1989-04-17');\r",
" pm.expect(jsonData.duration).to.eql(190);\r",
" pm.expect(jsonData.mpa.id).to.eql(5);\r",
" pm.expect(jsonData.mpa.name).not.null;\r",
" pm.expect(jsonData.genres).null;\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "1",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Film get unknown",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 404\", function () {\r",
" pm.response.to.have.status(404);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-1",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Friend film get",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test get film\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.id).to.eql(2);\r",
" pm.expect(jsonData.name).to.eql('New film');\r",
" pm.expect(jsonData.description).to.eql('New film about friends'); \r",
" pm.expect(jsonData.releaseDate).to.eql('1999-04-30');\r",
" pm.expect(jsonData.duration).to.eql(120);\r",
" pm.expect(jsonData.mpa.id).to.eql(3);\r",
" pm.expect(jsonData.mpa.name).to.eql('PG-13');\r",
" pm.expect(jsonData.genres.length).to.eql(1);\r",
" pm.expect(jsonData.genres[0].id).to.eql(1);\r",
" pm.expect(jsonData.genres[0].name).to.eql('Комедия');\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "2",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
}
]
},
{
"name": "like",
"item": [
{
"name": "Film add Like",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([200,204]);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PUT",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/films/:id/like/:userId",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id",
"like",
":userId"
],
"variable": [
{
"key": "id",
"value": "2",
"description": "(Required) "
},
{
"key": "userId",
"value": "1",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "PUT",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id/like/:userId",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id",
"like",
":userId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "userId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "PUT",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id/like/:userId",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id",
"like",
":userId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "userId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "PUT",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id/like/:userId",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id",
"like",
":userId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "userId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "PUT",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id/like/:userId",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id",
"like",
":userId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "userId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Film get Popular count",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test popular\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.length).to.eql(1);\r",
" pm.expect(jsonData[0].id).to.eql(2);\r",
" pm.expect(jsonData[0].name).to.eql('New film');\r",
" pm.expect(jsonData[0].description).to.eql('New film about friends'); \r",
" pm.expect(jsonData[0].releaseDate).to.eql('1999-04-30');\r",
" pm.expect(jsonData[0].duration).to.eql(120);\r",
" pm.expect(jsonData[0].mpa.id).to.eql(3);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/films/popular?count=1",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
"popular"
],
"query": [
{
"key": "count",
"value": "1"
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/popular",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
"popular"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/popular",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
"popular"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/popular",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
"popular"
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/popular",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
"popular"
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Film remove Like",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([200,204]);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "DELETE",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/films/:id/like/:userId",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id",
"like",
":userId"
],
"variable": [
{
"key": "id",
"value": "2",
"description": "(Required) "
},
{
"key": "userId",
"value": "1",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "DELETE",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id/like/:userId",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id",
"like",
":userId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "userId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "DELETE",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id/like/:userId",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id",
"like",
":userId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "userId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "DELETE",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id/like/:userId",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id",
"like",
":userId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "userId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "DELETE",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id/like/:userId",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id",
"like",
":userId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "userId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Film get Popular count 2",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test popular\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.length).to.eql(2);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/films/popular",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
"popular"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/popular",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
"popular"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/popular",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
"popular"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/popular",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
"popular"
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/popular",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
"popular"
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Film remove Like not found",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 404\", function () {\r",
" pm.response.to.have.status(404);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "DELETE",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/films/:id/like/:userId",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id",
"like",
":userId"
],
"variable": [
{
"key": "id",
"value": "1",
"description": "(Required) "
},
{
"key": "userId",
"value": "-2",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "DELETE",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id/like/:userId",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id",
"like",
":userId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "userId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "DELETE",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id/like/:userId",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id",
"like",
":userId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "userId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "DELETE",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id/like/:userId",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id",
"like",
":userId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "userId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "DELETE",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id/like/:userId",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id",
"like",
":userId"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
},
{
"key": "userId",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
}
]
},
{
"name": "MPA",
"item": [
{
"name": "Mpa get",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test get user\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.id).to.eql(1);\r",
" pm.expect(jsonData.name).to.eql('G');\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/mpa/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"mpa",
":id"
],
"variable": [
{
"key": "id",
"value": "1",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Mpa get unknown",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 404\", function () {\r",
" pm.response.to.have.status(404);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/mpa/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"mpa",
":id"
],
"variable": [
{
"key": "id",
"value": "-1",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Mpa All",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"\r",
"pm.test(\"Test list user\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.length).to.eql(5);\r",
" pm.expect(jsonData[0].id).to.eql(1);\r",
" pm.expect(jsonData[0].name).to.eql('G');\r",
"});\r",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/mpa",
"host": [
"{{baseUrl}}"
],
"path": [
"mpa"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
}
]
},
{
"name": "Genre",
"item": [
{
"name": "Genre get",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test get user\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.id).to.eql(1);\r",
" pm.expect(jsonData.name).to.eql('Комедия');\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/genres/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"genres",
":id"
],
"variable": [
{
"key": "id",
"value": "1",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Genre get unknown",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 404\", function () {\r",
" pm.response.to.have.status(404);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/genres/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"genres",
":id"
],
"variable": [
{
"key": "id",
"value": "-1",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Genre All",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"\r",
"pm.test(\"Test list user\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.length).to.eql(6);\r",
" pm.expect(jsonData[0].id).to.eql(1);\r",
" pm.expect(jsonData[0].name).to.eql('Комедия');\r",
" pm.expect(jsonData[1].id).to.eql(2);\r",
" pm.expect(jsonData[1].name).to.eql('Драма');\r",
"});\r",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/genres",
"host": [
"{{baseUrl}}"
],
"path": [
"genres"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/users",
"host": [
"{{baseUrl}}"
],
"path": [
"users"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Film genre update",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test updated film\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.id).to.eql(1);\r",
" pm.expect(jsonData.name).to.eql('Film Updated');\r",
" pm.expect(jsonData.description).to.eql('New film update decription'); \r",
" pm.expect(jsonData.releaseDate).to.eql('1989-04-17');\r",
" pm.expect(jsonData.duration).to.eql(190);\r",
" pm.expect(jsonData.mpa.id).to.eql(5);\r",
" pm.expect(jsonData.genres.length).to.eql(1);\r",
" pm.expect(jsonData.genres[0].id).to.eql(2);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 1,\n \"name\": \"Film Updated\",\n \"releaseDate\": \"1989-04-17\",\n \"description\": \"New film update decription\",\n \"duration\": 190,\n \"rate\": 4,\n \"mpa\": { \"id\": 5},\n \"genres\": [{ \"id\": 2}]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Film get with genre",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test get film\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.id).to.eql(1);\r",
" pm.expect(jsonData.name).to.eql('Film Updated');\r",
" pm.expect(jsonData.description).to.eql('New film update decription'); \r",
" pm.expect(jsonData.releaseDate).to.eql('1989-04-17');\r",
" pm.expect(jsonData.duration).to.eql(190);\r",
" pm.expect(jsonData.mpa.id).to.eql(5);\r",
" pm.expect(jsonData.mpa.name).to.eql('NC-17');\r",
" pm.expect(jsonData.genres.length).to.eql(1);\r",
" pm.expect(jsonData.genres[0].id).to.eql(2);\r",
" pm.expect(jsonData.genres[0].name).to.eql('Драма');\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "1",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Film update remove genre",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test updated film\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.id).to.eql(1);\r",
" pm.expect(jsonData.name).to.eql('Film Updated');\r",
" pm.expect(jsonData.description).to.eql('New film update decription'); \r",
" pm.expect(jsonData.releaseDate).to.eql('1989-04-17');\r",
" pm.expect(jsonData.duration).to.eql(190);\r",
" pm.expect(jsonData.mpa.id).to.eql(5);\r",
" pm.expect(jsonData.genres.length).to.eql(0);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 1,\n \"name\": \"Film Updated\",\n \"releaseDate\": \"1989-04-17\",\n \"description\": \"New film update decription\",\n \"duration\": 190,\n \"rate\": 4,\n \"mpa\": { \"id\": 5},\n \"genres\": []\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Film get without genre",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test get film\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.id).to.eql(1);\r",
" pm.expect(jsonData.name).to.eql('Film Updated');\r",
" pm.expect(jsonData.description).to.eql('New film update decription'); \r",
" pm.expect(jsonData.releaseDate).to.eql('1989-04-17');\r",
" pm.expect(jsonData.duration).to.eql(190);\r",
" pm.expect(jsonData.mpa.id).to.eql(5);\r",
" pm.expect(jsonData.mpa.name).to.eql('NC-17');\r",
" pm.expect(jsonData.genres).null;\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "1",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Friend film genres update",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test updated film\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.id).to.eql(2);\r",
" pm.expect(jsonData.name).to.eql('New film');\r",
" pm.expect(jsonData.description).to.eql('New film about friends'); \r",
" pm.expect(jsonData.releaseDate).to.eql('1999-04-30');\r",
" pm.expect(jsonData.duration).to.eql(120);\r",
" pm.expect(jsonData.mpa.id).to.eql(3);\r",
" pm.expect(jsonData.genres.length).to.eql(3);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 2,\n \"name\": \"New film\",\n \"releaseDate\": \"1999-04-30\",\n \"description\": \"New film about friends\",\n \"duration\": 120,\n \"mpa\": { \"id\": 3},\n \"genres\": [{ \"id\": 1}, { \"id\": 2}, { \"id\": 3}]\n}\n",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Friend film get with genre",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test get film\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.id).to.eql(2);\r",
" pm.expect(jsonData.name).to.eql('New film');\r",
" pm.expect(jsonData.description).to.eql('New film about friends'); \r",
" pm.expect(jsonData.releaseDate).to.eql('1999-04-30');\r",
" pm.expect(jsonData.duration).to.eql(120);\r",
" pm.expect(jsonData.mpa.id).to.eql(3);\r",
" pm.expect(jsonData.mpa.name).to.eql('PG-13');\r",
" pm.expect(jsonData.genres.length).to.eql(3);\r",
" pm.expect(jsonData.genres[0].id).to.eql(1);\r",
" pm.expect(jsonData.genres[0].name).to.eql('Комедия');\r",
" pm.expect(jsonData.genres[1].id).to.eql(2);\r",
" pm.expect(jsonData.genres[1].name).to.eql('Драма');\r",
" pm.expect(jsonData.genres[2].id).to.eql(3);\r",
" pm.expect(jsonData.genres[2].name).to.eql('Мультфильм');\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "2",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Friend film genres update Copy",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test updated film\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.id).to.eql(2);\r",
" pm.expect(jsonData.name).to.eql('New film');\r",
" pm.expect(jsonData.description).to.eql('New film about friends'); \r",
" pm.expect(jsonData.releaseDate).to.eql('1999-04-30');\r",
" pm.expect(jsonData.duration).to.eql(120);\r",
" pm.expect(jsonData.mpa.id).to.eql(3);\r",
" pm.expect(jsonData.genres.length).to.eql(2);\r",
" pm.expect(jsonData.genres[0].id).to.eql(1);\r",
" pm.expect(jsonData.genres[1].id).to.eql(2);\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "*/*"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 2,\n \"name\": \"New film\",\n \"releaseDate\": \"1999-04-30\",\n \"description\": \"New film about friends\",\n \"duration\": 120,\n \"mpa\": { \"id\": 3},\n \"genres\": [{ \"id\": 1}, { \"id\": 2}, { \"id\": 1}]\n}\n",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 76030770,\n \"name\": \"labore nulla\",\n \"releaseDate\": \"1979-04-17\",\n \"description\": \"Duis in consequat esse\",\n \"duration\": 47277389,\n \"rate\": 44519530\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/films",
"host": [
"{{baseUrl}}"
],
"path": [
"films"
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Friend film get with genre Copy",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"pm.test(\"Test get film\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.name).to.eql('New film');\r",
" pm.expect(jsonData.description).to.eql('New film about friends'); \r",
" pm.expect(jsonData.releaseDate).to.eql('1999-04-30');\r",
" pm.expect(jsonData.duration).to.eql(120);\r",
" pm.expect(jsonData.mpa.id).to.eql(3);\r",
" pm.expect(jsonData.mpa.name).to.eql('PG-13');\r",
" pm.expect(jsonData.genres.length).to.eql(2);\r",
" pm.expect(jsonData.genres[0].id).to.eql(1);\r",
" pm.expect(jsonData.genres[0].name).to.eql('Комедия');\r",
" pm.expect(jsonData.genres[1].id).to.eql(2);\r",
" pm.expect(jsonData.genres[1].name).to.eql('Драма');\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "*/*"
}
],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "2",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Conflict",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/films/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"films",
":id"
],
"variable": [
{
"key": "id",
"value": "-29029902",
"description": "(Required) "
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "*/*"
}
],
"cookie": [],
"body": ""
}
]
}
]
}
],
"variable": [
{
"key": "baseUrl",
"value": "http://localhost:8080",
"type": "string"
}
]
}
+
+ + + +
+ +
+ + + + +
+ + +
+ + +
+
+ + +
+ +
+ + +
+ +
+ + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/ru/yandex/practicum/filmorate/controller/FilmController.java b/src/main/java/ru/yandex/practicum/filmorate/controller/FilmController.java index e1ca531..aa4dcb7 100644 --- a/src/main/java/ru/yandex/practicum/filmorate/controller/FilmController.java +++ b/src/main/java/ru/yandex/practicum/filmorate/controller/FilmController.java @@ -4,17 +4,18 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; -import ru.yandex.practicum.filmorate.exception.FilmNotFoundException; -import ru.yandex.practicum.filmorate.exception.LikeNotFoundException; +import ru.yandex.practicum.filmorate.exception.*; import ru.yandex.practicum.filmorate.model.Film; +import ru.yandex.practicum.filmorate.model.Genres; +import ru.yandex.practicum.filmorate.model.Mpa; import ru.yandex.practicum.filmorate.service.FilmService; import javax.validation.Valid; +import java.util.List; import java.util.Map; import java.util.Set; @Slf4j @RestController -@RequestMapping("/films") public class FilmController { public FilmService filmService; @@ -24,14 +25,14 @@ public FilmController(FilmService filmService) { this.filmService = filmService; } - @GetMapping("/{id}") + @GetMapping("/films/{id}") @ResponseBody public Film getFilmById(@PathVariable int id) throws FilmNotFoundException { return filmService.getById(id); } - @GetMapping("/popular") + @GetMapping("/films/popular") @ResponseBody public Set getTopRatedFilms(@RequestParam(required = false) String count){ if (count == null) { @@ -40,7 +41,7 @@ public Set getTopRatedFilms(@RequestParam(required = false) String count){ return filmService.getTopByLikes(Integer.parseInt(count)); } - @GetMapping + @GetMapping("/films") @ResponseBody public Set findAll() { return filmService.findAll(); @@ -48,28 +49,54 @@ public Set findAll() { - @PostMapping + @PostMapping("/films") public Film create(@Valid @RequestBody Film film) { - filmService.create(film); - return film; + return filmService.create(film); } - @PutMapping("/{id}/like/{userId}") - public void like(@PathVariable int id, @PathVariable long userId){ + @PutMapping("/films/{id}/like/{userId}") + public void like(@PathVariable int id, @PathVariable int userId) throws FilmNotFoundException, UserNotFoundException { filmService.like(id, userId); } - @PutMapping + @PutMapping("/films") @ResponseBody public Film renew(@RequestBody Film film) throws FilmNotFoundException { + log.debug("/film case, film.toString() {}", film.toString()); return (filmService.renew(film)); } - @DeleteMapping("/{id}/like/{userId}") - public void dislike(@PathVariable long id, @PathVariable long userId) throws FilmNotFoundException, LikeNotFoundException { + + @DeleteMapping("/films/{id}/like/{userId}") + public void dislike(@PathVariable int id, @PathVariable int userId) throws FilmNotFoundException, LikeNotFoundException, UserNotFoundException { filmService.dislike(id, userId); } + @GetMapping("/mpa") + @ResponseBody + public List getAllMpa(){ + return filmService.getAllMpa(); + } + + @GetMapping("/mpa/{id}") + @ResponseBody + public Mpa getMpaById(@PathVariable int id) throws MpaNotFoundException { + return filmService.getMpaById(id); + } + + @GetMapping("/genres") + @ResponseBody + public List getAllGenres(){ + return filmService.getAllGenres(); + } + + @GetMapping("/genres/{id}") + @ResponseBody + public Genres getGenreById(@PathVariable int id) throws GenreNotFoundException { + log.debug("getGenreById top"); + return filmService.getGenreById(id); + } + @ExceptionHandler public ResponseEntity> HandleFilmNotFoundException(final FilmNotFoundException e) { return new ResponseEntity<>( @@ -85,4 +112,20 @@ public ResponseEntity> HandleLikeNotFoundException(final Lik HttpStatus.NOT_FOUND ); } + + @ExceptionHandler + public ResponseEntity> HandleMpaNotFoundException(final MpaNotFoundException e ) { + return new ResponseEntity<>( + Map.of("error", e.getMessage()), + HttpStatus.NOT_FOUND + ); + } + + @ExceptionHandler + public ResponseEntity> HandleGenreNotFoundException(final GenreNotFoundException e ) { + return new ResponseEntity<>( + Map.of("error", e.getMessage()), + HttpStatus.NOT_FOUND + ); + } } diff --git a/src/main/java/ru/yandex/practicum/filmorate/controller/UserController.java b/src/main/java/ru/yandex/practicum/filmorate/controller/UserController.java index 33d205f..56770a3 100644 --- a/src/main/java/ru/yandex/practicum/filmorate/controller/UserController.java +++ b/src/main/java/ru/yandex/practicum/filmorate/controller/UserController.java @@ -32,19 +32,19 @@ public Set findAll() { @GetMapping("/{id}") @ResponseBody - public User getUserById(@PathVariable long id) throws UserNotFoundException { + public User getUserById(@PathVariable int id) throws UserNotFoundException { return userService.getUserById(id); } @GetMapping("/{id}/friends") @ResponseBody - public Set getFriends(@PathVariable long id) throws UserNotFoundException { + public Set getFriends(@PathVariable int id) throws UserNotFoundException { return userService.getFriends(id); } @GetMapping("/{id}/friends/common/{otherId}") @ResponseBody - public Set getCommonFriends(@PathVariable long id, @PathVariable long otherId) throws UserNotFoundException { + public Set getCommonFriends(@PathVariable int id, @PathVariable int otherId) throws UserNotFoundException { return userService.getCommonFriends(id, otherId); } @@ -56,7 +56,7 @@ public User create(@Valid @RequestBody User user) { @PutMapping("/{id}/friends/{friendId}") @ResponseBody - public void addToFriends(@PathVariable long id, @PathVariable long friendId) throws UserNotFoundException { + public void addToFriends(@PathVariable int id, @PathVariable int friendId) throws UserNotFoundException { userService.addToFriends(id, friendId); } @@ -67,7 +67,7 @@ public User renew(@RequestBody User user) throws UserNotFoundException { } @DeleteMapping("/{id}/friends/{friendId}") - public void removeFromFriends(@PathVariable long id, @PathVariable long friendId) throws UserNotFoundException { + public void removeFromFriends(@PathVariable int id, @PathVariable int friendId) throws UserNotFoundException { userService.removeFromFriends(id, friendId); } @@ -78,8 +78,5 @@ public ResponseEntity> HandleUserNotFoundException(final Use HttpStatus.NOT_FOUND ); } - - - } diff --git a/src/main/java/ru/yandex/practicum/filmorate/dao/FilmDao.java b/src/main/java/ru/yandex/practicum/filmorate/dao/FilmDao.java new file mode 100644 index 0000000..06e7976 --- /dev/null +++ b/src/main/java/ru/yandex/practicum/filmorate/dao/FilmDao.java @@ -0,0 +1,39 @@ +package ru.yandex.practicum.filmorate.dao; + +import ru.yandex.practicum.filmorate.exception.FilmNotFoundException; +import ru.yandex.practicum.filmorate.exception.GenreNotFoundException; +import ru.yandex.practicum.filmorate.exception.MpaNotFoundException; +import ru.yandex.practicum.filmorate.exception.UserNotFoundException; +import ru.yandex.practicum.filmorate.model.Film; +import ru.yandex.practicum.filmorate.model.Genres; +import ru.yandex.practicum.filmorate.model.Mpa; + +import java.util.List; +import java.util.Set; + +public interface FilmDao { + + Set get(); + + Set getPopular(Integer size); + + Film getById(int id) throws FilmNotFoundException; + + Film create(Film film); + + Film update(Film updatedFilm) throws FilmNotFoundException; + + void like(Integer filmId, Integer userId) throws FilmNotFoundException, UserNotFoundException; + + void dislike(Integer filmId, Integer userId) throws FilmNotFoundException, UserNotFoundException; + + boolean isEmpty(int id); + + List getAllMpa(); + + Mpa getMpaById(int id) throws MpaNotFoundException; + + List getAllGenres(); + + Genres getGenreById(int id) throws GenreNotFoundException; +} diff --git a/src/main/java/ru/yandex/practicum/filmorate/dao/GenresDao.java b/src/main/java/ru/yandex/practicum/filmorate/dao/GenresDao.java new file mode 100644 index 0000000..db79b93 --- /dev/null +++ b/src/main/java/ru/yandex/practicum/filmorate/dao/GenresDao.java @@ -0,0 +1,10 @@ +package ru.yandex.practicum.filmorate.dao; + +import ru.yandex.practicum.filmorate.model.Genres; + +import java.util.Set; + +public interface GenresDao { + + Set getGenresByFilmId(int id); +} diff --git a/src/main/java/ru/yandex/practicum/filmorate/dao/MpaDao.java b/src/main/java/ru/yandex/practicum/filmorate/dao/MpaDao.java new file mode 100644 index 0000000..bfb0fcd --- /dev/null +++ b/src/main/java/ru/yandex/practicum/filmorate/dao/MpaDao.java @@ -0,0 +1,8 @@ +package ru.yandex.practicum.filmorate.dao; + +import ru.yandex.practicum.filmorate.model.Mpa; + +public interface MpaDao { + + Mpa getMpaById(int id); +} diff --git a/src/main/java/ru/yandex/practicum/filmorate/dao/UserDao.java b/src/main/java/ru/yandex/practicum/filmorate/dao/UserDao.java new file mode 100644 index 0000000..8d91ac1 --- /dev/null +++ b/src/main/java/ru/yandex/practicum/filmorate/dao/UserDao.java @@ -0,0 +1,28 @@ +package ru.yandex.practicum.filmorate.dao; + + +import ru.yandex.practicum.filmorate.model.User; + +import java.util.Optional; +import java.util.Set; + +public interface UserDao { + + User createUser(User user); + + User updateUser(User updatedUser); + + Set getAllUsers(); + + void addToFriends(int firstId, int secondId); + + void removeFromFriends(int firstId, int secondId); + Set getFriends(int id); + Optional getUserById(Integer id); + + Set getCommonFriends(Integer firstId, Integer secondId); + + void deleteUserById(Integer id); + + boolean checkForUserExist(int id); +} diff --git a/src/main/java/ru/yandex/practicum/filmorate/exception/FilmNotFoundException.java b/src/main/java/ru/yandex/practicum/filmorate/exception/FilmNotFoundException.java index bbfcd19..7ab34ad 100644 --- a/src/main/java/ru/yandex/practicum/filmorate/exception/FilmNotFoundException.java +++ b/src/main/java/ru/yandex/practicum/filmorate/exception/FilmNotFoundException.java @@ -4,11 +4,6 @@ import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; -/* -Существует ли какой-то способ обработать исключения средствами Spring'а не пробрасывая их на самый верх? -И нужны ли вообще эти исключения, если получается что это штатная ситуация в работе программы? -У меня такое чувство что я делаю что-то не так :) - */ @ResponseStatus(code = HttpStatus.NOT_FOUND) // вот эта строка по-моему вообще ничего не меняет :) public class FilmNotFoundException extends Exception{ diff --git a/src/main/java/ru/yandex/practicum/filmorate/exception/GenreNotFoundException.java b/src/main/java/ru/yandex/practicum/filmorate/exception/GenreNotFoundException.java new file mode 100644 index 0000000..5925789 --- /dev/null +++ b/src/main/java/ru/yandex/practicum/filmorate/exception/GenreNotFoundException.java @@ -0,0 +1,12 @@ +package ru.yandex.practicum.filmorate.exception; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.ResponseStatus; + +@ResponseStatus(code = HttpStatus.NOT_FOUND) + +public class GenreNotFoundException extends Exception{ + + public GenreNotFoundException(String message) { + super(message); + } +} diff --git a/src/main/java/ru/yandex/practicum/filmorate/exception/MpaNotFoundException.java b/src/main/java/ru/yandex/practicum/filmorate/exception/MpaNotFoundException.java new file mode 100644 index 0000000..92a6b34 --- /dev/null +++ b/src/main/java/ru/yandex/practicum/filmorate/exception/MpaNotFoundException.java @@ -0,0 +1,12 @@ +package ru.yandex.practicum.filmorate.exception; + +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.ResponseStatus; + +@ResponseStatus(code = HttpStatus.NOT_FOUND) +public class MpaNotFoundException extends Exception{ + + public MpaNotFoundException(String message) { + super(message); + } +} diff --git a/src/main/java/ru/yandex/practicum/filmorate/impl/FilmDaoImpl.java b/src/main/java/ru/yandex/practicum/filmorate/impl/FilmDaoImpl.java new file mode 100644 index 0000000..06ff3b3 --- /dev/null +++ b/src/main/java/ru/yandex/practicum/filmorate/impl/FilmDaoImpl.java @@ -0,0 +1,214 @@ +package ru.yandex.practicum.filmorate.impl; +import lombok.extern.slf4j.Slf4j; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Component; +import ru.yandex.practicum.filmorate.dao.FilmDao; +import ru.yandex.practicum.filmorate.exception.FilmNotFoundException; +import ru.yandex.practicum.filmorate.exception.GenreNotFoundException; +import ru.yandex.practicum.filmorate.exception.MpaNotFoundException; +import ru.yandex.practicum.filmorate.exception.UserNotFoundException; +import ru.yandex.practicum.filmorate.model.Genres; +import ru.yandex.practicum.filmorate.model.Mpa; +import ru.yandex.practicum.filmorate.utils.FilmMapper; +import ru.yandex.practicum.filmorate.model.Film; +import ru.yandex.practicum.filmorate.utils.GenresMapper; +import ru.yandex.practicum.filmorate.utils.MpaMapper; +import ru.yandex.practicum.filmorate.utils.UserMapper; +import java.util.*; + +@Slf4j +@Component +public class FilmDaoImpl implements FilmDao { + + private final JdbcTemplate jdbcTemplate; + public FilmDaoImpl(JdbcTemplate jdbcTemplate) { + this.jdbcTemplate = jdbcTemplate; + } + + + public List getLikesByFilmId(int id) { + + String sql = "select user_id from likes where film_id = ?"; + return jdbcTemplate.query(sql, (rs, rowNum) -> rs.getInt("user_id") , id); + } + @Override + public Set get() { + return new HashSet<>(jdbcTemplate.query("select * from films ORDER BY RATE DESC LIMIT(10)", + new FilmMapper())); + } + + @Override + public Set getPopular(Integer size) { + Set result = new HashSet(jdbcTemplate.query("select * from films ORDER BY RATE DESC LIMIT(?)", + new FilmMapper(), size)); + for (Film film : result) { + fillFilm(film, film.getId()); + } + return result; + } + + private void fillFilm(Film film, int id){ + film.setMpa(jdbcTemplate.query("select * from MPA where ID IN (SELECT MPA FROM FILMS WHERE ID = ?)", + new MpaMapper(), id).stream().findAny().orElse(new Mpa())); + film.setGenres(new HashSet<>(jdbcTemplate.query("SELECT g1.GENRE as ID, g2.name " + + "FROM GENRES g1 INNER JOIN GENRE_LIST g2 ON g1.GENRE=g2.ID WHERE FILM_ID = ? ORDER BY ID;", + new GenresMapper(), id))); + if (film.getGenres().isEmpty()) { + film.setGenres(null); + } + } + + @Override + public Film getById(int id) throws FilmNotFoundException { + Film result = jdbcTemplate.query("select * from films where ID = ?", + new FilmMapper(), id).stream().findAny().orElseThrow(() -> + new FilmNotFoundException("Фильма с id "+ id + " нет в базе")); + fillFilm(result, id); + return result; + } + + @Override + public Film create(Film film) { + + + jdbcTemplate.update("INSERT INTO FILMS (NAME, RELEASE_DATE, DESCRIPTION, DURATION, RATE, MPA)" + + "VALUES (?, ?, ?, ?, ?, ?);", + film.getName(), + film.getReleaseDate(), + film.getDescription(), + film.getDuration(), + film.getRate(), + film.getMpa().getId()); + + int id = jdbcTemplate.query("SELECT MAX(ID) FROM FILMS as ID", + (rs, rowNum) -> rs.getInt(1)).stream().findAny().orElse(0); + + if (film.getGenres() != null){ + for (Genres genre: film.getGenres()) { + jdbcTemplate.update( "INSERT INTO GENRES (FILM_ID, GENRE) VALUES (?, ?);", id, genre.getId()); + } + } + film.setId(id); + + return film; + } + + @Override + public Film update(Film updatedFilm) throws FilmNotFoundException { + Film result = new Film(); + log.debug("updateFilm case: updatedFilm.toString() {}", updatedFilm.toString()); + jdbcTemplate.update("UPDATE FILMS SET " + + "NAME = ?, RELEASE_DATE = ?, DESCRIPTION = ?, DURATION = ?, RATE = ?, MPA = ?" + + "WHERE ID = ?;", + updatedFilm.getName(), + updatedFilm.getReleaseDate(), + updatedFilm.getDescription(), + updatedFilm.getDuration(), + updatedFilm.getRate(), + updatedFilm.getMpa().getId(), + updatedFilm.getId()); + if (updatedFilm.getMpa() != null){ + jdbcTemplate.update( "UPDATE MPA SET ID = ?, NAME = ? " + + "WHERE NAME = ?; ", updatedFilm.getMpa().getId(), updatedFilm.getMpa().getName(), + updatedFilm.getMpa().getName()); + } + log.debug("updatedFilm.getGenres() {}", updatedFilm.getGenres()); + log.debug("updatedFilm.getGenres() = null? {}", (updatedFilm.getGenres() == null)); + if (updatedFilm.getGenres() != null) { + jdbcTemplate.update("DELETE FROM GENRES WHERE FILM_ID = ?", updatedFilm.getId()); + if (!updatedFilm.getGenres().isEmpty()) { + int count = 1; + for (Genres genre : updatedFilm.getGenres()) { + log.debug("genre.getName() = {}, genre.getId() = {}", genre.getName(), genre.getId()); + jdbcTemplate.update("MERGE INTO GENRES VALUES (?, ?, ?)", count + ,updatedFilm.getId(), genre.getId()); + count++; + } + } + } + result = getById(updatedFilm.getId()); + if (updatedFilm.getGenres() != null) { + if (updatedFilm.getGenres().isEmpty()) { + result.setGenres(updatedFilm.getGenres()); + } + } + return result; + } + + + @Override + public void dislike(Integer filmId, Integer userId) throws FilmNotFoundException, UserNotFoundException { + if (isEmpty(filmId)){ + throw new FilmNotFoundException("Фильма с id " + filmId + "нет в базе"); + } + if (checkForUserExist(userId)) { + throw new UserNotFoundException("Пользователя с id " + filmId + "нет в базе"); + } + jdbcTemplate.update("DELETE FROM LIKES WHERE FILM_ID=? AND USER_ID = ?;" + + "update FILMS SET RATE = RATE - 1 WHERE ID = ?", filmId, userId, filmId); + } + + @Override + public boolean isEmpty(int id) { + return jdbcTemplate.query("select * from films where ID = ?", + new FilmMapper(), id).stream().findAny().isEmpty(); + } + + @Override + public List getAllMpa() { + return new LinkedList<>(jdbcTemplate.query("select * from MPA ORDER BY ID", + new MpaMapper())); + } + + @Override + public Mpa getMpaById(int id) throws MpaNotFoundException { + if (checkForMpaExist(id)){ + throw new MpaNotFoundException("Рейтинга с id " + id + "нет в базе!"); + } + return jdbcTemplate.queryForObject("select * from MPA WHERE ID = ?", new MpaMapper(), id); + } + + @Override + public List getAllGenres() { + return new LinkedList(jdbcTemplate.query("select * from GENRE_LIST ORDER BY ID", + new GenresMapper())); + } + + @Override + public Genres getGenreById(int id) throws GenreNotFoundException { + log.debug("getGenreById started"); + if (checkForGenreExist(id)){ + throw new GenreNotFoundException("Жанра с id " + id + "нет в базе!"); + } + return jdbcTemplate.queryForObject("select * from GENRE_LIST WHERE ID = ?", new GenresMapper(), id); + } + + public boolean checkForMpaExist(int id) { + log.debug("checkForMpaExist started, id = {}", id); + return jdbcTemplate.query("select * from GENRE_LIST where ID = ?", + new MpaMapper(), id).stream().findAny().isEmpty(); + } + + public boolean checkForGenreExist(int id) { + return jdbcTemplate.query("select * from GENRE_LIST where ID = ?", + new GenresMapper(), id).stream().findAny().isEmpty(); + } + + public boolean checkForUserExist(int id) { + return jdbcTemplate.query("select * from USERS where ID = ?", + new UserMapper(), id).stream().findAny().isEmpty(); + } + + @Override + public void like(Integer filmId, Integer userId) throws FilmNotFoundException, UserNotFoundException { + if (isEmpty(filmId)){ + throw new FilmNotFoundException("Фильма с id " + filmId + "нет в базе"); + } + if (checkForUserExist(userId)) { + throw new UserNotFoundException("Пользователя с id " + filmId + "нет в базе"); + } + jdbcTemplate.update("INSERT INTO LIKES (FILM_ID, USER_ID) VALUES (?, ?);" + + "UPDATE FILMS SET RATE = RATE + 1 WHERE ID = ?", filmId, userId, filmId); + } + +} diff --git a/src/main/java/ru/yandex/practicum/filmorate/impl/GenresDaoImpl.java b/src/main/java/ru/yandex/practicum/filmorate/impl/GenresDaoImpl.java new file mode 100644 index 0000000..b9338f6 --- /dev/null +++ b/src/main/java/ru/yandex/practicum/filmorate/impl/GenresDaoImpl.java @@ -0,0 +1,25 @@ +package ru.yandex.practicum.filmorate.impl; + +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Component; +import ru.yandex.practicum.filmorate.dao.GenresDao; +import ru.yandex.practicum.filmorate.model.Genres; +import ru.yandex.practicum.filmorate.utils.GenresMapper; + +import java.util.HashSet; +import java.util.Set; + +@Component +public class GenresDaoImpl implements GenresDao { + + private final JdbcTemplate jdbcTemplate; + public GenresDaoImpl(JdbcTemplate jdbcTemplate) { + this.jdbcTemplate = jdbcTemplate; + } + + @Override + public Set getGenresByFilmId(int id) { + return new HashSet<>(jdbcTemplate.query("select * from GENRES", + new GenresMapper())); + } +} diff --git a/src/main/java/ru/yandex/practicum/filmorate/impl/MpaDaoImpl.java b/src/main/java/ru/yandex/practicum/filmorate/impl/MpaDaoImpl.java new file mode 100644 index 0000000..f216ec5 --- /dev/null +++ b/src/main/java/ru/yandex/practicum/filmorate/impl/MpaDaoImpl.java @@ -0,0 +1,11 @@ +package ru.yandex.practicum.filmorate.impl; + +import ru.yandex.practicum.filmorate.dao.MpaDao; +import ru.yandex.practicum.filmorate.model.Mpa; + +public class MpaDaoImpl implements MpaDao { + @Override + public Mpa getMpaById(int id) { + return null; + } +} diff --git a/src/main/java/ru/yandex/practicum/filmorate/impl/UserDaoImpl.java b/src/main/java/ru/yandex/practicum/filmorate/impl/UserDaoImpl.java new file mode 100644 index 0000000..7fd7300 --- /dev/null +++ b/src/main/java/ru/yandex/practicum/filmorate/impl/UserDaoImpl.java @@ -0,0 +1,105 @@ +package ru.yandex.practicum.filmorate.impl; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Component; +import ru.yandex.practicum.filmorate.dao.UserDao; +import ru.yandex.practicum.filmorate.model.User; +import lombok.extern.slf4j.Slf4j; +import ru.yandex.practicum.filmorate.utils.UserMapper; + +import java.util.HashSet; +import java.util.Optional; +import java.util.Set; + +@Slf4j +@Component +public class UserDaoImpl implements UserDao { + private final JdbcTemplate jdbcTemplate; + + public UserDaoImpl(JdbcTemplate jdbcTemplate){ + this.jdbcTemplate=jdbcTemplate; + } + + @Override + public User createUser(User user) { + jdbcTemplate.update("INSERT INTO USERS (EMAIL, LOGIN, NAME, BIRTHDAY)" + + "VALUES (?, ?, ?, ?);", + user.getEmail(), + user.getLogin(), + user.getName(), + user.getBirthday()); + user.setId(jdbcTemplate.query("SELECT ID FROM USERS WHERE EMAIL = ?", + (rs, rowNum) -> rs.getInt("id"), + user.getEmail()).stream().findAny().orElse(0)); + return user; + } + + @Override + public User updateUser(User updatedUser) { + jdbcTemplate.update("UPDATE USERS SET " + + "EMAIL = ?, LOGIN = ?, NAME = ?, BIRTHDAY = ?;", + updatedUser.getEmail(), + updatedUser.getLogin(), + updatedUser.getName(), + updatedUser.getBirthday()); + return updatedUser; + } + + @Override + public Set getAllUsers() { + return new HashSet<>(jdbcTemplate.query("SELECT * FROM USERS", + new UserMapper())); + } + + @Override + public void addToFriends(int firstId, int secondId) { + jdbcTemplate.update("INSERT INTO FRIENDS (USER_ID, FRIEND_ID) VALUES (?, ?)", firstId, secondId); + } + + @Override + public void removeFromFriends(int firstId, int secondId) { + jdbcTemplate.update("DELETE FROM FRIENDS WHERE USER_ID = ? AND FRIEND_ID = ?", firstId, secondId); + } + + @Override + public Set getFriends(int id) { + return new HashSet<>(jdbcTemplate.query("SELECT * FROM USERS WHERE ID IN " + + "(SELECT FRIEND_ID FROM FRIENDS WHERE USER_ID = ?)", + new UserMapper(), id)); + } + + @Override + public Optional getUserById(Integer id) { + + return jdbcTemplate.query("select * from USERS where ID = ?", + new UserMapper(), id).stream().findAny(); + } + + @Override + public Set getCommonFriends(Integer firstId, Integer secondId) { + return new HashSet<>(jdbcTemplate.query("SELECT * FROM USERS " + + "WHERE ID IN " + + "(SELECT f1.FRIEND_ID " + + "FROM FRIENDS f1 " + + "INNER JOIN FRIENDS f2 ON f1.FRIEND_ID=f2.FRIEND_ID " + + "WHERE f1.USER_ID = ? AND f2.USER_ID = ?)", + new UserMapper(), firstId, secondId)); + } + + @Override + public void deleteUserById(Integer id) { + jdbcTemplate.update("DELETE FROM USERS WHERE ID=?;", id); + } + + public Set getFriendListById(Integer id) { + + String sql = "select friend_id from friends where user_id = ?"; + return Set.copyOf(jdbcTemplate.query(sql, (rs, rowNum) -> rs.getInt("friend_id") , id)); + } + + @Override + public boolean checkForUserExist(int id) { + return jdbcTemplate.query("select * from USERS where ID = ?", + new UserMapper(), id).stream().findAny().isEmpty(); + } + +} \ No newline at end of file diff --git a/src/main/java/ru/yandex/practicum/filmorate/model/Film.java b/src/main/java/ru/yandex/practicum/filmorate/model/Film.java index 3fa3db4..6e20f7d 100644 --- a/src/main/java/ru/yandex/practicum/filmorate/model/Film.java +++ b/src/main/java/ru/yandex/practicum/filmorate/model/Film.java @@ -1,20 +1,17 @@ package ru.yandex.practicum.filmorate.model; - import lombok.Data; -import ru.yandex.practicum.filmorate.exception.LikeNotFoundException; - import javax.validation.constraints.NotEmpty; import javax.validation.constraints.Positive; import java.time.LocalDate; -import java.util.Comparator; -import java.util.HashSet; import java.util.Set; @Data public class Film { - public Set likes = null; - private long id; + // private Set likes = null; + private Mpa mpa; + private Set genres; + private int id; @NotEmpty private String name; private String description; @@ -23,26 +20,8 @@ public class Film { private int duration; private int rate; - public void like(Long id){ - if (likes == null){ - likes = new HashSet<>(); - } - likes.add(id); - } - - public void dislike(Long id) throws LikeNotFoundException { - if (likes == null){ - likes = new HashSet<>(); - } - if (likes.contains(id)) { - likes.remove(id); - } else { - throw new LikeNotFoundException("Вы не ставили лайк этому фильму. Нечего удалять."); - } - } - public Set getFriends(){ - return likes; + public Film() { } } diff --git a/src/main/java/ru/yandex/practicum/filmorate/model/Genres.java b/src/main/java/ru/yandex/practicum/filmorate/model/Genres.java new file mode 100644 index 0000000..f329f2c --- /dev/null +++ b/src/main/java/ru/yandex/practicum/filmorate/model/Genres.java @@ -0,0 +1,10 @@ +package ru.yandex.practicum.filmorate.model; + +import lombok.Data; + +@Data +public class Genres { + int id; + String name; + +} diff --git a/src/main/java/ru/yandex/practicum/filmorate/model/Mpa.java b/src/main/java/ru/yandex/practicum/filmorate/model/Mpa.java new file mode 100644 index 0000000..e66b974 --- /dev/null +++ b/src/main/java/ru/yandex/practicum/filmorate/model/Mpa.java @@ -0,0 +1,9 @@ +package ru.yandex.practicum.filmorate.model; + +import lombok.Data; + +@Data +public class Mpa { + private int id; + private String name; +} diff --git a/src/main/java/ru/yandex/practicum/filmorate/model/User.java b/src/main/java/ru/yandex/practicum/filmorate/model/User.java index d833d70..29fd2f7 100644 --- a/src/main/java/ru/yandex/practicum/filmorate/model/User.java +++ b/src/main/java/ru/yandex/practicum/filmorate/model/User.java @@ -1,7 +1,9 @@ package ru.yandex.practicum.filmorate.model; import lombok.Data; +import javax.persistence.Entity; import javax.validation.constraints.*; +import java.sql.Date; import java.time.LocalDate; import java.util.HashSet; import java.util.Set; @@ -9,8 +11,8 @@ @Data public class User { - private Set friends = new HashSet<>(); - private long id; + // private Set friends = new HashSet<>(); + private int id; @Email @NotEmpty private String email; @@ -25,15 +27,27 @@ public class User { public User() { } + public User(int user_id, String name, String login, String email, LocalDate birthday) { + this.id = user_id; + this.name = name; + this.login = login; + this.email = email; + this.birthday = birthday; + } +/* public void addToFriends(Long id){ friends.add(id); } + + public void removeFromFriends(Long id){ friends.remove(id); } - public Set getFriends(){ + public Set getFriends(){ return friends; } + + */ } diff --git a/src/main/java/ru/yandex/practicum/filmorate/service/FilmService.java b/src/main/java/ru/yandex/practicum/filmorate/service/FilmService.java index 257b70f..1b144eb 100644 --- a/src/main/java/ru/yandex/practicum/filmorate/service/FilmService.java +++ b/src/main/java/ru/yandex/practicum/filmorate/service/FilmService.java @@ -2,66 +2,52 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; -import ru.yandex.practicum.filmorate.exception.FilmNotFoundException; -import ru.yandex.practicum.filmorate.exception.LikeNotFoundException; -import ru.yandex.practicum.filmorate.exception.ValidationException; +import ru.yandex.practicum.filmorate.dao.FilmDao; +import ru.yandex.practicum.filmorate.exception.*; import ru.yandex.practicum.filmorate.model.Film; -import ru.yandex.practicum.filmorate.storage.film.FilmStorage; +import ru.yandex.practicum.filmorate.model.Genres; +import ru.yandex.practicum.filmorate.model.Mpa; -import javax.management.StringValueExp; import java.time.LocalDate; import java.util.*; -import java.util.stream.Collectors; @Slf4j @Service public class FilmService { - FilmStorage filmStorage; - long id; + FilmDao filmDao; - public FilmService(FilmStorage filmStorage) { - this.filmStorage = filmStorage; + public FilmService(FilmDao filmDao) { + this.filmDao = filmDao; } - public void like(long filmId, long userId){ - filmStorage.getById(filmId).ifPresentOrElse(film -> { - film.like(userId); + + public void like(int filmId, int userId) throws FilmNotFoundException, UserNotFoundException { + if (filmDao.getById(filmId) != null) { + filmDao.like(filmId, userId); + } else { try { - filmStorage.renew(film); + throw new FilmNotFoundException("Фильма с ID " + filmId + " нет в базе"); } catch (FilmNotFoundException e) { throw new RuntimeException(e); } - log.debug(film.getLikes().toString()); - log.debug(filmStorage.getById(filmId).get().getLikes().toString()); - },() -> { + } + } + + public void dislike(int filmId, int userId) throws FilmNotFoundException, UserNotFoundException { + if (filmDao.getById(filmId) != null) { + filmDao.dislike(filmId, userId); + } else { try { throw new FilmNotFoundException("Фильма с ID " + filmId + " нет в базе"); } catch (FilmNotFoundException e) { throw new RuntimeException(e); } - }); - } - - public void dislike(long filmId, long userId) throws LikeNotFoundException, FilmNotFoundException { - Optional film = filmStorage.getById(filmId); - if (film.isPresent()) { - Film sub = film.get(); - sub.dislike(userId); - filmStorage.renew(sub); - } else { - throw new FilmNotFoundException("Фильма с ID " + filmId + " нет в базе"); } } public Set getTopByLikes(int size){ - log.debug("size: " + size); - log.debug("filmstorage size: " + filmStorage.findAll().size()); - return filmStorage.findAll() - .stream() - .sorted(filmByLikesComparator) - .limit(size) - .collect(Collectors.toSet()); + return filmDao.getPopular(size); } public boolean validate(Film film){ @@ -99,26 +85,22 @@ public boolean validate(Film film){ public Set findAll() { - return filmStorage.findAll(); + return filmDao.get(); } public Film getById(int id) throws FilmNotFoundException { - - if (filmStorage.getById(id).isPresent()) { - return filmStorage.getById(id).get(); - } else { + Film film = filmDao.getById(id); + if (film == null) { throw new FilmNotFoundException("Фильма с айди" + id + "нет в базе."); } + return film; } public Film create(Film film) { log.debug("Получен запрос на добавление фильма: {}", film); if (validate(film)) { - film.setId(++id); - filmStorage.create(film); - log.debug("film {} was added", film); - return film; + return filmDao.create(film); } else { log.warn("Валидация фильма не пройдена!"); throw new ValidationException("Неверные параметры фильма!"); @@ -126,20 +108,32 @@ public Film create(Film film) { } public Film renew(Film film) throws FilmNotFoundException { - return filmStorage.renew(film); + log.debug("renew case, film.toString() {}", film.toString()); + checkForFilmExist(film.getId()); + return filmDao.update(film); } - public Comparator filmByLikesComparator = new Comparator() { - @Override - public int compare(Film o1, Film o2) { - if (o1.likes == null) { - if (o2.likes == null){ - return 0; - } else return 1; - } else if (o2.likes == null) { - return -1; - } - return o1.likes.size() - o2.likes.size(); + + private void checkForFilmExist(int id) throws FilmNotFoundException { + if (filmDao.isEmpty(id)) { + throw new FilmNotFoundException("Фильма с ID " + id + " нет в базе."); } - }; + } + + public List getAllMpa() { + return filmDao.getAllMpa(); + } + + public Mpa getMpaById(int id) throws MpaNotFoundException { + return filmDao.getMpaById(id); + } + + public List getAllGenres() { + return filmDao.getAllGenres(); + } + + public Genres getGenreById(int id) throws GenreNotFoundException { + log.debug("Получен запрос на получение жанра по id {}", id); + return filmDao.getGenreById(id); + } } diff --git a/src/main/java/ru/yandex/practicum/filmorate/service/UserService.java b/src/main/java/ru/yandex/practicum/filmorate/service/UserService.java index 9015c2e..40f9616 100644 --- a/src/main/java/ru/yandex/practicum/filmorate/service/UserService.java +++ b/src/main/java/ru/yandex/practicum/filmorate/service/UserService.java @@ -1,25 +1,20 @@ package ru.yandex.practicum.filmorate.service; - import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import ru.yandex.practicum.filmorate.dao.UserDao; import ru.yandex.practicum.filmorate.exception.UserNotFoundException; import ru.yandex.practicum.filmorate.exception.ValidationException; import ru.yandex.practicum.filmorate.model.User; -import ru.yandex.practicum.filmorate.storage.user.UserStorage; import java.time.LocalDate; -import java.util.HashSet; import java.util.Set; @Slf4j - @Service public class UserService { + UserDao userDao; - UserStorage userStorage; - long id; - - public UserService(UserStorage userStorage) { - this.userStorage = userStorage; + public UserService(UserDao userDao) { + this.userDao = userDao ; } public boolean validate(User user){ @@ -58,74 +53,54 @@ public boolean validate(User user){ return true; } - public void addToFriends(long firstId, long otherId) throws UserNotFoundException { - User user1 = getUserById(firstId); - User user2 = getUserById(otherId); - user1.addToFriends(otherId); - user2.addToFriends(firstId); + public void addToFriends(int firstId, int otherId) throws UserNotFoundException { + checkForExist(firstId); + checkForExist(otherId); + userDao.addToFriends(firstId, otherId); } - public void removeFromFriends(long firstId, long otherId) throws UserNotFoundException { - User user1 = getUserById(firstId); - User user2 = getUserById(otherId); - user1.removeFromFriends(otherId); - user2.removeFromFriends(firstId); + public void removeFromFriends(int firstId, int otherId) { + userDao.removeFromFriends(firstId, otherId); } - public Set getFriends(long id) throws UserNotFoundException { - Set result = new HashSet<>(); - for (Long friendId : getUserById(id).getFriends()) { - result.add(getUserById(friendId)); - } - return result; + public Set getFriends(int id) { + return userDao.getFriends(id); } - public Set getCommonFriends(long firstId, long otherId) throws UserNotFoundException { - User user1 = getUserById(firstId); - User user2 = getUserById(otherId); - Set result = new HashSet<>(); - try { - for (long id1 : user1.getFriends()) { - for (long id2 : user2.getFriends()) { - if (id1 == id2) { - result.add(getUserById(id1)); - } - } - } - } catch (NullPointerException e) { - return result; - } - return result; + public Set getCommonFriends(int firstId, int otherId) { + return userDao.getCommonFriends(firstId, otherId); } public Set findAll() { - return userStorage.findAll(); + return userDao.getAllUsers(); } - public User getUserById(long id) throws UserNotFoundException { - if (userStorage.getById(id).isPresent()){ - return userStorage.getById(id).get(); - } else { - throw new UserNotFoundException("Пользователя с ID " + id + " нет в базе."); - } + public User getUserById(int id) throws UserNotFoundException { + return userDao.getUserById(id).orElseThrow(() -> + new UserNotFoundException("Пользователя с ID " + id + " нет в базе.")); } public User renew(User user) throws UserNotFoundException { - return userStorage.renew(user); + checkForExist(user.getId()); + return userDao.updateUser(user); + } public User create(User user) { log.debug("Получен запрос на добавление пользователя: {}", user); if (validate(user)) { - log.debug("user: {}", user); - user.setId(++id); - userStorage.create(user); - return user; + return userDao.createUser(user); } else { log.warn("Валидация пользователя не пройдена!"); throw new ValidationException("Неверные параметры пользователя!"); } } + private void checkForExist(int id) throws UserNotFoundException { + if (userDao.getUserById(id).isEmpty()) { + throw new UserNotFoundException("Пользователя с ID " + id + " нет в базе."); + } + } + } diff --git a/src/main/java/ru/yandex/practicum/filmorate/utils/FilmMapper.java b/src/main/java/ru/yandex/practicum/filmorate/utils/FilmMapper.java new file mode 100644 index 0000000..2664e71 --- /dev/null +++ b/src/main/java/ru/yandex/practicum/filmorate/utils/FilmMapper.java @@ -0,0 +1,22 @@ +package ru.yandex.practicum.filmorate.utils; + +import org.springframework.jdbc.core.RowMapper; +import ru.yandex.practicum.filmorate.model.Film; + +import java.sql.ResultSet; +import java.sql.SQLException; + +public class FilmMapper implements RowMapper { + @Override + public Film mapRow(ResultSet rs, int rowNum) throws SQLException { + Film film = new Film(); + film.setId(rs.getInt("id")); + film.setName(rs.getString("name")); + film.setDescription(rs.getString("description")); + film.setReleaseDate(rs.getDate("release_date").toLocalDate()); + film.setDuration(rs.getInt("duration")); + film.setRate(rs.getInt("rate")); + + return film; + } +} diff --git a/src/main/java/ru/yandex/practicum/filmorate/utils/GenresMapper.java b/src/main/java/ru/yandex/practicum/filmorate/utils/GenresMapper.java new file mode 100644 index 0000000..1839a00 --- /dev/null +++ b/src/main/java/ru/yandex/practicum/filmorate/utils/GenresMapper.java @@ -0,0 +1,19 @@ +package ru.yandex.practicum.filmorate.utils; + +import org.springframework.jdbc.core.RowMapper; +import ru.yandex.practicum.filmorate.model.Film; +import ru.yandex.practicum.filmorate.model.Genres; + +import java.sql.ResultSet; +import java.sql.SQLException; + +public class GenresMapper implements RowMapper { + @Override + public Genres mapRow(ResultSet rs, int rowNum) throws SQLException { + Genres genres = new Genres(); + genres.setId(rs.getInt("ID")); + genres.setName(rs.getString("NAME")); + + return genres; + } +} diff --git a/src/main/java/ru/yandex/practicum/filmorate/utils/MpaMapper.java b/src/main/java/ru/yandex/practicum/filmorate/utils/MpaMapper.java new file mode 100644 index 0000000..b576124 --- /dev/null +++ b/src/main/java/ru/yandex/practicum/filmorate/utils/MpaMapper.java @@ -0,0 +1,17 @@ +package ru.yandex.practicum.filmorate.utils; + +import org.springframework.jdbc.core.RowMapper; +import ru.yandex.practicum.filmorate.model.Mpa; + +import java.sql.ResultSet; +import java.sql.SQLException; + +public class MpaMapper implements RowMapper { + @Override + public Mpa mapRow(ResultSet rs, int rowNum) throws SQLException { + Mpa mpa = new Mpa(); + mpa.setId(rs.getInt("ID")); + mpa.setName(rs.getString("NAME")); + return mpa; + } +} diff --git a/src/main/java/ru/yandex/practicum/filmorate/utils/UserMapper.java b/src/main/java/ru/yandex/practicum/filmorate/utils/UserMapper.java new file mode 100644 index 0000000..70b4969 --- /dev/null +++ b/src/main/java/ru/yandex/practicum/filmorate/utils/UserMapper.java @@ -0,0 +1,20 @@ +package ru.yandex.practicum.filmorate.utils; +import org.springframework.jdbc.core.RowMapper; +import ru.yandex.practicum.filmorate.model.User; + +import java.sql.ResultSet; +import java.sql.SQLException; + +public class UserMapper implements RowMapper { + @Override + public User mapRow(ResultSet rs, int rowNum) throws SQLException { + User user = new User(); + + user.setId(rs.getInt("id")); + user.setEmail(rs.getString("email")); + user.setLogin(rs.getString("login")); + user.setName(rs.getString("name")); + user.setBirthday(rs.getDate("birthday").toLocalDate()); + return user; + } +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 2e94a85..d4c1637 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,4 +1,16 @@ -logging.level.ru.yandex.practicum.filmorate.controller=trace +logging.level.ru.yandex.practicum.filmorate.controller=debug logging.level.ru.yandex.practicum.filmorate.controller.UserController=debug +logging.level.ru.yandex.practicum.filmorate.controller.FilmController=debug logging.level.ru.yandex.practicum.filmorate.service.UserService=debug -logging.level.ru.yandex.practicum.filmorate.service.FilmService=debug \ No newline at end of file +logging.level.ru.yandex.practicum.filmorate.service.FilmService=debug +logging.level.ru.yandex.practicum.filmorate.impl.FilmDaoImpl=debug +#logging.level.com.zaxxer.hikari=debug + +spring.sql.init.mode=always +spring.datasource.url=jdbc:h2:file:./db/filmorate +#spring.datasource.url=jdbc:h2:mem:default +spring.datasource.driverClassName=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password=password +#spring.jpa.database-platform=org.hibernate.dialect.H2Dialect + diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql new file mode 100644 index 0000000..10aaac2 --- /dev/null +++ b/src/main/resources/data.sql @@ -0,0 +1,12 @@ +MERGE INTO GENRE_LIST KEY (ID) VALUES (1, 'Комедия'); +MERGE INTO GENRE_LIST KEY (ID) VALUES (2, 'Драма'); +MERGE INTO GENRE_LIST KEY (ID) VALUES (3, 'Мультфильм'); +MERGE INTO GENRE_LIST KEY (ID) VALUES (4, 'Триллер'); +MERGE INTO GENRE_LIST KEY (ID) VALUES (5, 'Документальный'); +MERGE INTO GENRE_LIST KEY (ID) VALUES (6, 'Боевик'); + +MERGE INTO MPA KEY (ID) VALUES (1, 'G'); +MERGE INTO MPA KEY (ID) VALUES (2, 'PG'); +MERGE INTO MPA KEY (ID) VALUES (3, 'PG-13'); +MERGE INTO MPA KEY (ID) VALUES (4, 'R'); +MERGE INTO MPA KEY (ID) VALUES (5, 'NC-17'); \ No newline at end of file diff --git a/src/main/resources/schema.sql b/src/main/resources/schema.sql new file mode 100644 index 0000000..27a5918 --- /dev/null +++ b/src/main/resources/schema.sql @@ -0,0 +1,53 @@ +CREATE TABLE IF NOT EXISTS GENRE_LIST ( + id int2 PRIMARY KEY, + name varchar(22) +); + +CREATE TABLE IF NOT EXISTS MPA( + id int2 PRIMARY KEY, + name varchar(5) UNIQUE +); + +CREATE TABLE IF NOT EXISTS USERS ( + id int4 PRIMARY KEY AUTO_INCREMENT, + email varchar(50), + login varchar(30), + name varchar(100), + birthday date +); + +CREATE TABLE IF NOT EXISTS FRIENDS ( + id int4 PRIMARY KEY AUTO_INCREMENT, + user_id int4, + friend_id int4 +); + +CREATE TABLE IF NOT EXISTS LIKES ( + id int4 PRIMARY KEY AUTO_INCREMENT, + user_id int4, + film_id int4 +); + +CREATE TABLE IF NOT EXISTS FILMS ( + id int4 PRIMARY KEY AUTO_INCREMENT, + name varchar(50), + description varchar(150), + release_date date, + duration int2, + rate int4, + mpa int2 +); + +CREATE TABLE IF NOT EXISTS GENRES ( + id int4 PRIMARY KEY AUTO_INCREMENT, + film_id int4, + genre int2 +); + +ALTER TABLE GENRES ADD FOREIGN KEY (film_id) REFERENCES FILMS (id); + +ALTER TABLE FRIENDS ADD FOREIGN KEY (user_id) REFERENCES USERS (id); + +ALTER TABLE LIKES ADD FOREIGN KEY (user_id) REFERENCES USERS (id); + +ALTER TABLE LIKES ADD FOREIGN KEY (film_id) REFERENCES FILMS (id); diff --git a/src/test/java/ru/yandex/practicum/filmorate/FilmControllerTest.java b/src/test/java/ru/yandex/practicum/filmorate/FilmControllerTest.java index beb6417..15009d3 100644 --- a/src/test/java/ru/yandex/practicum/filmorate/FilmControllerTest.java +++ b/src/test/java/ru/yandex/practicum/filmorate/FilmControllerTest.java @@ -1,14 +1,11 @@ package ru.yandex.practicum.filmorate; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.springframework.jdbc.core.JdbcTemplate; import ru.yandex.practicum.filmorate.controller.FilmController; -import ru.yandex.practicum.filmorate.controller.UserController; +import ru.yandex.practicum.filmorate.impl.FilmDaoImpl; import ru.yandex.practicum.filmorate.model.Film; import ru.yandex.practicum.filmorate.service.FilmService; -import ru.yandex.practicum.filmorate.service.UserService; -import ru.yandex.practicum.filmorate.storage.film.InMemoryFilmStorage; -import ru.yandex.practicum.filmorate.storage.user.InMemoryUserStorage; - import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import java.time.LocalDate; @@ -17,7 +14,7 @@ public class FilmControllerTest { public static void main(String[] args) { } - FilmController filmController = new FilmController(new FilmService(new InMemoryFilmStorage())); + FilmController filmController = new FilmController(new FilmService(new FilmDaoImpl(new JdbcTemplate()))); Film film; @BeforeEach diff --git a/src/test/java/ru/yandex/practicum/filmorate/UserControllerTest.java b/src/test/java/ru/yandex/practicum/filmorate/UserControllerTest.java index 393f4e7..df852a0 100644 --- a/src/test/java/ru/yandex/practicum/filmorate/UserControllerTest.java +++ b/src/test/java/ru/yandex/practicum/filmorate/UserControllerTest.java @@ -3,7 +3,10 @@ import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.springframework.jdbc.core.JdbcTemplate; import ru.yandex.practicum.filmorate.controller.UserController; +import ru.yandex.practicum.filmorate.dao.UserDao; +import ru.yandex.practicum.filmorate.impl.UserDaoImpl; import ru.yandex.practicum.filmorate.model.User; import ru.yandex.practicum.filmorate.service.UserService; import ru.yandex.practicum.filmorate.storage.user.InMemoryUserStorage; @@ -21,7 +24,8 @@ public class UserControllerTest { @BeforeEach public void beforeEach() { - userController = new UserController(new UserService(new InMemoryUserStorage())); + userController = new UserController(new UserService(new UserDaoImpl(new JdbcTemplate())) { + }); user = new User(); user.setName("User"); user.setId(1);