Compare commits

..

No commits in common. "c95b015094b3286b59891d41d6eb6dc2ceee7ae4" and "268824c1085847873cf15c091fc22305f39e30d5" have entirely different histories.

8 changed files with 5 additions and 77 deletions

View File

@ -6,32 +6,4 @@ router.get("/users", (request, response) => {
response.send(require("./json/users.json")) response.send(require("./json/users.json"))
}) })
router.post("/auth", (request, response) => {
const {phoneNumber, password} = request.body;
console.log(phoneNumber, password);
if (phoneNumber === '89999999999') {
response.send(require("../json/auth/dogsitter.success.json"))
}
else if (phoneNumber === '89555555555') {
response.status(400).send(require("../json/auth/error.json"))
}
else {
response.send(require("../json/auth/owner.success.json"))
}
})
router.post("/register", (request, response) => {
const {firstName, secondName, phoneNumber, password, role} = request.body;
console.log(phoneNumber, password, role);
if (phoneNumber === '89283244141' || phoneNumber === '89872855893') {
response.status(400).send(require("../json/register/error.json"))
}
else if (role === 'dogsitter') {
response.send(require("../json/register/dogsitter.success.json"))
}
else {
response.send(require("../json/register/owner.success.json"))
}
})
module.exports = router; module.exports = router;

View File

@ -1,12 +0,0 @@
{
"data": {
"id": 1,
"phoneNumber": 89283244141,
"firstName": "Вася",
"secondName": "Пупкин",
"role": "dogsitter",
"location": "Россия, республика Татарстан, Казань, улица Пушкина, 12",
"price": 1500,
"aboutMe": "Я люблю собак"
}
}

View File

@ -1,3 +0,0 @@
{
"error": "Пользователь не найден"
}

View File

@ -1,9 +0,0 @@
{
"data": {
"id": 3,
"phoneNumber": 89872855893,
"firstName": "Гадий",
"secondName": "Петрович",
"role": "owner"
}
}

View File

@ -1,12 +0,0 @@
{
"data": {
"id": 5,
"phoneNumber": 89555555555,
"firstName": "Масяня",
"secondName": "Карлова",
"role": "dogsitter",
"location": "Россия, республика Татарстан, Казань, улица Пушкина, 12",
"price": 100,
"aboutMe": "Все на свете - собаки"
}
}

View File

@ -1,3 +0,0 @@
{
"error": "Пользователь с таким номером телефона уже существует"
}

View File

@ -1,9 +0,0 @@
{
"data": {
"id": 6,
"phoneNumber": 89888888888,
"firstName": "Генадий",
"secondName": "Паровозов",
"role": "owner"
}
}

View File

@ -2,6 +2,7 @@
{ {
"id": 1, "id": 1,
"phone_number": 89283244141, "phone_number": 89283244141,
"password": "1234",
"first_name": "Вася", "first_name": "Вася",
"second_name": "Пупкин", "second_name": "Пупкин",
"role": "dogsitter", "role": "dogsitter",
@ -12,6 +13,7 @@
{ {
"id": 2, "id": 2,
"phone_number": 89272844541, "phone_number": 89272844541,
"password": "1234",
"first_name": "Ваня", "first_name": "Ваня",
"second_name": "Пуськин", "second_name": "Пуськин",
"role": "dogsitter", "role": "dogsitter",
@ -22,6 +24,7 @@
{ {
"id": 3, "id": 3,
"phone_number": 89872855893, "phone_number": 89872855893,
"password": "12345",
"first_name": "Гадий", "first_name": "Гадий",
"second_name": "Петрович", "second_name": "Петрович",
"role": "owner" "role": "owner"
@ -29,9 +32,10 @@
{ {
"id": 4, "id": 4,
"phone_number": 89872844591, "phone_number": 89872844591,
"password": "12345",
"first_name": "Галкин", "first_name": "Галкин",
"second_name": "Максим", "second_name": "Максим",
"role": "dogsitter", "role": ["owner", "dogsitter"],
"location": "Россия, республика Татарстан, Казань, проспект Ямашева, 83", "location": "Россия, республика Татарстан, Казань, проспект Ямашева, 83",
"price": 1000000, "price": 1000000,
"about_me": "Миллион алых роз" "about_me": "Миллион алых роз"