user flow - Watthakorn/EZ_finance GitHub Wiki

Register and Login

  • register api

POST /user/add

Request

{
    "username":"tester",
    "user_fullname":"test case",
    "user_email":"Test@mail",
    "user_address":"test 20001",
    "user_picture":"path to image",
    "password":"aVcde",
    "user_role":"user"
}

Response: status 201 Created

{}
  • login api

GET /user

Request

{
    "username": "username"
    "password": "username"
}

Response

{
  "id": 1,
  "fullname": "TestUser",
  "email": "[email protected]",
  "address": "address1",
  "picture": "Tc/f/d/s",
  "username": "username",
  "password": "username",
  "role": "user"
}

View Field and Book Field

  • list-of-field api

GET /listfield

Request

{}

Response

[
  {
    "field_id": 1,
    "field_name": "SamPaoSan Football",
    "tel": "081-732-7343",
    "price": "3,000 - 3,500",
    "location": "98/1 M.13 Soi.Kubon Ramintra road ",
    "email": "[email protected]",
    "website": null,
    "detail": "Test123",
    "image": "path to image",
    "stime": 9,
    "etime": 24,
    "username": "man"
    },
  {
    "field_id": 2,
    "field_name": "KaoSan Football",
    "tel": "081-918-2677",
    "price": "2,000 - 2,600",
    "location": "Suansiam Soi 16 Bangkok 10320",
    "email": "[email protected]",
    "website": null,
    "detail": null,
    "image": "path to image",
    "stime": 9,
    "etime": 24,
    "username": "man1"
  },
    {
    "field_id": 3,
    "field_name": "TungTraKai Football",
    "tel": "02-513-3425",
    "price": "1,200 - 1,300",
    "location": "Soi Ladprao 18 Ladprao road Bangkok 10900",
    "email": null,
    "website": null,
    "detail": null,
    "image": "path to image",
    "stime": 9,
    "etime": 24,
    "username": "man2"
  }
]
  • field-detail api

GET /field?field_id={field_id}

Request

{
    "field_id":1
}

Response

{
  "field_id": 1,
  "field_name": "SamPaoSan Football",
  "tel": "081-732-7343",
  "price": "3,000 - 3,500",
  "location": "98/1 M.13 Soi.Kubon Ramintra road ",
  "email": "[email protected]",
  "website": null,
  "detail": "Test123",
  "image": "path to image",
  "stime": 9,
  "etime": 24,
  "username": "man"
}
  • list-subfield api

GET /field/{field_id}

Request

{
    "field_id":1
}

Response

[
  {
    "ex_id": 1,
    "field_id": 1,
    "fieldex_name": "test112",
    "rent": 500,
    "image": "img",
    "size": "35x50 m",
    "floor": "Natural grass"
  },
  {
    "ex_id": 2,
    "field_id": 1,
    "fieldex_name": "test2",
    "rent": 700,
    "image": "img",
    "size": "35x50 m",
    "floor": "Natural grass"
  },
  {
    "ex_id": 3,
    "field_id": 1,
    "fieldex_name": "test3",
    "rent": 800,
    "image": "img",
    "size": "35x50 m",
    "floor": "Natural grass"
  },
  {
    "ex_id": 4,
    "field_id": 1,
    "fieldex_name": "test4",
    "rent": 1000,
    "image": "img",
    "size": "105x75 m",
    "floor": "Plastic grass"
  },
  {
    "ex_id": 5,
    "field_id": 1,
    "fieldex_name": "test5",
    "rent": 1500,
    "image": "img",
    "size": "105x75 m",
    "floor": "Natural grass"
  },
  {
    "ex_id": 17,
    "field_id": 1,
    "fieldex_name": "RE",
    "rent": 111,
    "image": "img",
    "size": "100x200 m",
    "floor": "Resin floor"
  }
]
  • subfield-detail api

GET /field/{field_id}/{ex_id}

Request

{
    "field_id":1
    "ex_id":1
}

Response

{
  "ex_id": 1,
  "field_id": 1,
  "fieldex_name": "test112",
  "rent": 500,
  "image": "img",
  "size": "35x50 m",
  "floor": "Natural grass"
}
  • do-reserve api

POST /reserv

Request

{
    "reserv_user":"name",
    "reserv_field_id":2,
    "reserv_ex_id":2,
    "reserv_time":9,
    "reserv_date":"2017/03/15"
}

Response: status 201 Created

{}

Check Reserv Status and Cancel Reserv

  • list-of-reserve api

GET /reserv

Request

{ 
    "username": "TestUser" 
}

Response

[
  {
    "reserv_id": 1,
    "reserv_user": "TestUser",
    "reserv_field_id": 1,
    "reserv_ex_id": 1,
    "reserv_time": 1,
    "reserv_date": "2017-03-12",
    "reserv_status": "pending"
  },
  {
    "reserv_id": 2,
    "reserv_user": "TestUser",
    "reserv_field_id": 1,
    "reserv_ex_id": 1,
    "reserv_time": 2,
    "reserv_date": "2017-03-12",
    "reserv_status": "pending"
  },
  {
    "reserv_id": 3,
    "reserv_user": "TestUser",
    "reserv_field_id": 1,
    "reserv_ex_id": 1,
    "reserv_time": 3,
    "reserv_date": "2017-03-12",
    "reserv_status": "pending"
  },
  {
    "reserv_id": 4,
    "reserv_user": "TestUser",
    "reserv_field_id": 1,
    "reserv_ex_id": 1,
    "reserv_time": 4,
    "reserv_date": "2017-03-12",
    "reserv_status": "pending"
  }
]
  • delete-reserve api

DELETE /reserv/{reserv_id}/delete

Request

{
    "reserv_id": 21
}

Response : status 200 OK

{
}

View Booked History

  • list-of-reserve api

GET /reserv

Request

{ 
    "username": "TestUser" 
}

Response

[
  {
    "reserv_id": 1,
    "reserv_user": "TestUser",
    "reserv_field_id": 1,
    "reserv_ex_id": 1,
    "reserv_time": 1,
    "reserv_date": "2017-03-12",
    "reserv_status": "pending"
  },
  {
    "reserv_id": 2,
    "reserv_user": "TestUser",
    "reserv_field_id": 1,
    "reserv_ex_id": 1,
    "reserv_time": 2,
    "reserv_date": "2017-03-12",
    "reserv_status": "pending"
  },
  {
    "reserv_id": 3,
    "reserv_user": "TestUser",
    "reserv_field_id": 1,
    "reserv_ex_id": 1,
    "reserv_time": 3,
    "reserv_date": "2017-03-12",
    "reserv_status": "pending"
  },
  {
    "reserv_id": 4,
    "reserv_user": "TestUser",
    "reserv_field_id": 1,
    "reserv_ex_id": 1,
    "reserv_time": 4,
    "reserv_date": "2017-03-12",
    "reserv_status": "pending"
  }
]

Manage Account

  • user-detail api

GET /user/{id}

Request

{
    "user_id": 1
}

Response

{
  "user_id": 1,
  "fullname": "TestUser",
  "email": "[email protected]",
  "address": "address1",
  "picture": "Tc/f/d/s",
  "username": "username",
  "password": "username",
  "role": "user"
}
  • update-profile api

put /user/{id}/update

Request


{
    "user_id"=1,
    "user_fullname":"test case",
    "user_email":"Test@mail",
    "user_address":"test 20001",
    "user_picture":"C:\image",
    "password":"teeeAe123"
}

Response : status 200 OK

{
}
  • delete-user api

put /user/{id}/delete

Request

{
    "user_id":1
}

Response : status 200 OK

{}