Merge pull request 'Update stubs DogsittersFinder' (#42) from dogsitter-finder into master

Reviewed-on: #42
This commit is contained in:
Primakov Alexandr Alexandrovich 2024-11-30 14:40:32 +03:00
commit c95b015094
8 changed files with 77 additions and 5 deletions

View File

@ -6,4 +6,32 @@ router.get("/users", (request, response) => {
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;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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