manager 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":"manager"
}

Response: status 201 Created

{}
  • login api

GET /user

Request

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

Response

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

Add Field

  • add-subfield api

POST /manager/add

Request

{
    "fieldex_name":"Teset"
    "rent":500
    "image":"path to image"
    "size":"50x150"
    "floor":"Natural grass"
}

Response: status 201 Created

{}

Edit Field

  • edit-subfield api

POST /manager/{ex_id}/update

Request

{
    "ex_id":1
    "fieldex_name":"Teset"
    "rent":500
    "image":"path to image"
    "size":"50x150"
    "floor":"Natural grass"
}

Response: status 200 OK

{}

Confirm Booking

  • list-of-reserve api

GET /reserv

Request

{ 
    "reserv_field_id": 1
}

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"
  }
]
  • confirm-reserve api

put /reserv/{reserv_id}/confirm

Request

{
    "reserv_id": 21
}

Response : status 200 OK

{
}

Cancel Booking

  • list-of-reserve api

GET /reserv

Request

{ 
    "reserv_field_id": 1
}

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"
  }
]
  • confirm-reserve api

put /reserv/{reserv_id}/confirm

Request

{
    "reserv_id": 21
}

Response : status 200 OK

{
}
  • cancel-reserve api

put /reserv/{reserv_id}/cancel

Request

{
    "reserv_id": 21
}

Response : status 200 OK

{
}

Manage Account

  • user-detail api

GET /user/{id}

Request

{
    "id": 1
}

Response

{
  "id": 1,
  "fullname": "TestUser",
  "email": "[email protected]",
  "address": "address1",
  "picture": "Tc/f/d/s",
  "username": "manager",
  "password": "manager",
  "role": "manager"
}
  • 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

{
}

View History

  • list-of-reserve api

GET /reserv

Request

{ 
    "reserv_ex_id": 1
}

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"
  }
]