Fakultas Ilmu Komputer UI

Commit 4460eae6 authored by Usman Sidiq's avatar Usman Sidiq
Browse files

Merge branch 'dev-sidiq' into 'PBI-4-menambahkan_informasi_fasilitas_publik'

Finishing Touch

See merge request !18
parents 423eab76 f0ddfef7
Pipeline #40155 passed with stages
in 4 minutes and 27 seconds
......@@ -63,7 +63,7 @@ It will return a json with key:
* `phone_number` : Your phone number
### 4. To register a location:
Make `POST` request to API endpoint `/informasi-lokasi/lokasi/add` with the following key:
Make `POST` request to API endpoint `/informasi-lokasi/lokasi/add/` with the following key:
* `name` : location name
* `altitude` : location altitude, a float.
* `longitude` : location longitude, a float.
......@@ -71,7 +71,17 @@ Make `POST` request to API endpoint `/informasi-lokasi/lokasi/add` with the foll
* `no_telp` : Phone number
* `image` : string of sourc image `.jpg`
### 4. To view a location details:
### 5. To view a location list:
Make `GET` request to API endpoint `/informasi-lokasi/lokasi/list` with the key `name`. <br>
It will return a json list of locations with key:
* `name` : location name
* `altitude` : location altitude, a float.
* `longitude` : location longitude, a float.
* `alamat` : address
* `no_telp` : Phone number
* `image` : string of sourc image `.jpg`
### 6. To view a location details:
Make `GET` request to API endpoint `/informasi-lokasi/lokasi/detail/*nama_lokasi*` with the key `name`. <br>
It will return a json with key:
* `name` : location name
......@@ -79,9 +89,9 @@ It will return a json with key:
* `longitude` : location longitude, a float.
* `alamat` : address
* `no_telp` : Phone number
* `image` : string of sourc image `.jpg`
* `image` : string of source image `.jpg`
### 5. 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:
* `tag` : Fasility Tag
* The options are :
......@@ -97,6 +107,7 @@ Make `POST` request to API endpoint `/informasi-lokasi/lokasi/add-fasilitas/*nam
* KURSI_UMUM_DISABILITAS = 'KD'
* TEMPAT_PARKIR_DISABILITAS = 'PK'
* RUNNING_TEXT = 'RT'
* TEMPAT_PARKIR_BIASA = 'TB'
<br>
* `deskripsi` : Facility description.
......@@ -104,11 +115,18 @@ Make `POST` request to API endpoint `/informasi-lokasi/lokasi/add-fasilitas/*nam
<b>Make sure you have token it your request header.</b>
<b>Add this to your request header. `Authorization` with value `token *your_token_from_request*`</b>
### 6. To see a facility details:
Make `GET` request to API endpoint `/informasi-lokasi/lokasi/detail-fasilitas/*nama-lokasi*` with `name` key. <br>
### 8. To see a facility details:
Make `GET` request to API endpoint `/informasi-lokasi/lokasi/detail-fasilitas/*nama-lokasi*/id-fasilitas` with `name` key. <br>
It will return a json with the following key:
* `nama_lokasi`: location name of the facility
* `deskripsi`: the description
* `creator`: User's name who registered the facility
* `creator`: User's last name who registered the facility
* `date_time`: Date when the facility was made
* `like`: how many people like this facility. default is 0
* `dislike`: how many people dislike this facility. default is 0
* `rating`: rating of the facility. Default is 3
* `tag`: Facility tag
* `image`: Image for facility
* `is_verified`: Verified status
# Generated by Django 2.1.5 on 2020-04-10 10:21
from django.db import migrations, models
import multiselectfield.db.fields
class Migration(migrations.Migration):
dependencies = [
('informasi_fasilitas', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='fasilitas',
name='image',
field=models.ImageField(default=None, null=True, upload_to='static/img'),
),
migrations.AlterField(
model_name='fasilitas',
name='tag',
field=multiselectfield.db.fields.MultiSelectField(choices=[('KR', 'Kursi Roda'), ('LF', 'Lift Disabilitas'), ('TD', 'Toilet Disabilitas'), ('MM', 'Masjid/Mushola'), ('GB', 'Guiding Block'), ('BM', 'Bidang Miring'), ('CP', 'Teman Disabilitas'), ('JI', 'Juru Bahasa Isyarat'), ('TN', 'Tongkat Disabilitas Netra'), ('KD', 'Kursi Umum Disabilitas'), ('PK', 'Tempat Parkir Disabilitas'), ('RT', 'Running Text')], default=None, max_length=35, null=True),
),
]
# Generated by Django 2.1.5 on 2020-04-13 05:07
from django.db import migrations
import multiselectfield.db.fields
class Migration(migrations.Migration):
dependencies = [
('informasi_fasilitas', '0002_auto_20200410_1721'),
]
operations = [
migrations.AlterField(
model_name='fasilitas',
name='tag',
field=multiselectfield.db.fields.MultiSelectField(choices=[('KR', 'Kursi Roda'), ('LF', 'Lift Disabilitas'), ('TD', 'Toilet Disabilitas'), ('MM', 'Masjid/Mushola'), ('GB', 'Guiding Block'), ('BM', 'Bidang Miring'), ('CP', 'Teman Disabilitas'), ('JI', 'Juru Bahasa Isyarat'), ('TN', 'Tongkat Disabilitas Netra'), ('KD', 'Kursi Umum Disabilitas'), ('PK', 'Tempat Parkir Disabilitas'), ('RT', 'Running Text'), ('TB', 'Tempat Parkir Biasa')], default=None, max_length=38, null=True),
),
]
......@@ -15,6 +15,7 @@ TONGKAT_DISABILITAS_NETRA = 'TN'
KURSI_UMUM_DISABILITAS = 'KD'
TEMPAT_PARKIR_DISABILITAS = 'PK'
RUNNING_TEXT = 'RT'
TEMPAT_PARKIR_BIASA = 'TB'
FACILITIES = (
((KURSI_RODA, 'Kursi Roda'),
......@@ -28,7 +29,8 @@ FACILITIES = (
(TONGKAT_DISABILITAS_NETRA, 'Tongkat Disabilitas Netra'),
(KURSI_UMUM_DISABILITAS, 'Kursi Umum Disabilitas'),
(TEMPAT_PARKIR_DISABILITAS, 'Tempat Parkir Disabilitas'),
(RUNNING_TEXT, 'Running Text'))
(RUNNING_TEXT, 'Running Text'),
(TEMPAT_PARKIR_BIASA, 'Tempat Parkir Biasa'))
)
class Lokasi(models.Model):
......@@ -52,8 +54,8 @@ class Fasilitas(models.Model):
like = models.IntegerField(default=0)
dislike = models.IntegerField(default=0)
rating = models.IntegerField(default=3)
tag = MultiSelectField(choices=FACILITIES, null=True)
image = models.ImageField(upload_to="static/img", null=True)
tag = MultiSelectField(choices=FACILITIES, null=True, default=None)
image = models.ImageField(upload_to="static/img", null=True, default=None)
is_verified = models.BooleanField(default=False)
class Komentar(models.Model):
......
......@@ -98,7 +98,7 @@ def add_fasilitas(request, nama_lokasi):
user=user,
deskripsi=deskripsi,
image=image)
return JsonResponse({'response' : 'fasilitas added'}, status = 201)
return JsonResponse({'response' : 'fasilitas added', 'id':fasilitas.id}, status = 201)
else:
return JsonResponse({'response' : 'try post request instead'}, status = 400)
except KeyError as e:
......
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