Fakultas Ilmu Komputer UI

Commit 0241cf77 authored by BIMO IMAN SMARTADI's avatar BIMO IMAN SMARTADI
Browse files

Merge branch 'fasilitas-lokasi-auth' into 'PBI-4-menambahkan_informasi_fasilitas_publik'

Added consistency on README and Default image value on informasi-fasilitas views

See merge request !34
parents 2b4fed41 7f4030d1
Pipeline #42294 passed with stages
in 4 minutes and 6 seconds
...@@ -72,7 +72,7 @@ Make `POST` request to API endpoint `/informasi-lokasi/lokasi/add/` with the fol ...@@ -72,7 +72,7 @@ Make `POST` request to API endpoint `/informasi-lokasi/lokasi/add/` with the fol
* `image` : string of sourc image `.jpg` * `image` : string of sourc image `.jpg`
### 5. To view a location list: ### 5. To view a location list:
Make `GET` request to API endpoint `/informasi-lokasi/lokasi/list` with the key `name`. <br> Make `GET` request to API endpoint `/informasi-lokasi/lokasi/list/`. <br>
It will return a json list of locations with key: It will return a json list of locations with key:
* `id` : id of location * `id` : id of location
* `name` : location name * `name` : location name
...@@ -83,7 +83,7 @@ It will return a json list of locations with key: ...@@ -83,7 +83,7 @@ It will return a json list of locations with key:
* `image` : string of sourc image `.jpg` * `image` : string of sourc image `.jpg`
### 6. To view a location details: ### 6. To view a location details:
Make `GET` request to API endpoint `/informasi-lokasi/lokasi/detail/*nama_lokasi*` with the key `name`. <br> Make `GET` request to API endpoint `/informasi-lokasi/lokasi/detail/*nama_lokasi*/`. <br>
It will return a json with key: It will return a json with key:
* `name` : location name * `name` : location name
* `altitude` : location altitude, a float. * `altitude` : location altitude, a float.
...@@ -93,7 +93,7 @@ It will return a json with key: ...@@ -93,7 +93,7 @@ It will return a json with key:
* `image` : string of source image `.jpg` * `image` : string of source image `.jpg`
### 7. To register a facility: ### 7. To register a facility:
Make `POST` request to API endpoint `/informasi-lokasi/lokasi/add-fasilitas/*nama-lokasi*` with the following key: Make `POST` request to API endpoint `/informasi-lokasi/lokasi/add-fasilitas/*nama-lokasi*/` with the following key:
* `tag` : Fasility Tag * `tag` : Fasility Tag
* The options are : * The options are :
* KURSI_RODA = 'KR' * KURSI_RODA = 'KR'
...@@ -111,7 +111,7 @@ Make `POST` request to API endpoint `/informasi-lokasi/lokasi/add-fasilitas/*nam ...@@ -111,7 +111,7 @@ Make `POST` request to API endpoint `/informasi-lokasi/lokasi/add-fasilitas/*nam
* TEMPAT_PARKIR_BIASA = 'TB' * TEMPAT_PARKIR_BIASA = 'TB'
* Put as a String separated by space * Put as a String separated by space
* example: "KR LF TD" * example: `KR LF TD`
<br> <br>
* `deskripsi` : Facility description. * `deskripsi` : Facility description.
...@@ -121,7 +121,7 @@ Make `POST` request to API endpoint `/informasi-lokasi/lokasi/add-fasilitas/*nam ...@@ -121,7 +121,7 @@ Make `POST` request to API endpoint `/informasi-lokasi/lokasi/add-fasilitas/*nam
<b>Add this to your request header. `Authorization` with value `token *your_token_from_request*`</b> <b>Add this to your request header. `Authorization` with value `token *your_token_from_request*`</b>
### 8. To see a facility list: ### 8. To see a facility list:
Make `GET` request to API endpoint `/informasi-lokasi/lokasi/list-fasilitas/*nama-lokasi*` with `name` key. <br> Make `GET` request to API endpoint `/informasi-lokasi/lokasi/list-fasilitas/*nama-lokasi*/`. <br>
It will return a json with the following key: It will return a json with the following key:
* `id`: id of the facility * `id`: id of the facility
* `nama_lokasi`: location name of the facility * `nama_lokasi`: location name of the facility
...@@ -137,7 +137,7 @@ It will return a json with the following key: ...@@ -137,7 +137,7 @@ It will return a json with the following key:
### 9. To see a facility details: ### 9. To see a facility details:
Make `GET` request to API endpoint `/informasi-lokasi/lokasi/detail-fasilitas/*nama-lokasi*/id-fasilitas` with `name` key. <br> Make `GET` request to API endpoint `/informasi-lokasi/lokasi/detail-fasilitas/*nama-lokasi*/*id-fasilitas*/`. <br>
It will return a json with the following key: It will return a json with the following key:
* `nama_lokasi`: location name of the facility * `nama_lokasi`: location name of the facility
* `deskripsi`: the description * `deskripsi`: the description
......
...@@ -104,11 +104,15 @@ def add_fasilitas(request, nama_lokasi): ...@@ -104,11 +104,15 @@ def add_fasilitas(request, nama_lokasi):
deskripsi = request.POST['deskripsi'] deskripsi = request.POST['deskripsi']
rating = request.POST['rating'] rating = request.POST['rating']
tag = request.POST['tag'].split() tag = request.POST['tag'].split()
image = ""
if 'image' in request.POST.keys():
image = str(request.POST['image'])
fasilitas = Fasilitas.objects.create(lokasi=lokasi, fasilitas = Fasilitas.objects.create(lokasi=lokasi,
user=user, user=user,
deskripsi=deskripsi, deskripsi=deskripsi,
rating=rating, rating=rating,
tag=tag) tag=tag,
image = image)
return JsonResponse({'response' : 'fasilitas added', 'id':fasilitas.id}, status = 201) return JsonResponse({'response' : 'fasilitas added', 'id':fasilitas.id}, status = 201)
else: else:
return JsonResponse({'response' : request_error_message("post")}, status = 400) return JsonResponse({'response' : request_error_message("post")}, status = 400)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment