fix get locations, and remove KABUPATEN from seeds
This commit is contained in:
parent
ad08e6ab31
commit
2c420a7d4f
@ -160,23 +160,32 @@ func (server *Server) getTopListLocations(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type getListRecentLocationsWithRatingsReq struct {
|
type getListRecentLocationsWithRatingsReq struct {
|
||||||
Page int32 `form:"page_size" binding:"required,min=1"`
|
Page int32 `form:"page_size" binding:"required,min=1"`
|
||||||
|
LocationType string `form:"location_type"`
|
||||||
|
Region string `form:"regions"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (server *Server) getListRecentLocationsWithRatings(ctx *gin.Context) {
|
func (server *Server) getListRecentLocationsWithRatings(ctx *gin.Context) {
|
||||||
var req getListRecentLocationsWithRatingsReq
|
var req getListRecentLocationsWithRatingsReq
|
||||||
|
|
||||||
if err := ctx.ShouldBindQuery(&req); err != nil {
|
if err := ctx.ShouldBindQuery(&req); err != nil {
|
||||||
ctx.JSON(http.StatusBadRequest, ValidationErrorResponse(err))
|
ctx.JSON(http.StatusBadRequest, ValidationErrorResponse(err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
locations, err := server.Store.GetListRecentLocationsWithRatings(ctx, req.Page)
|
locations, err := server.Store.GetListRecentLocationsWithRatings(ctx, db.GetListRecentLocationsParams{
|
||||||
|
Limit: req.Page,
|
||||||
|
Regions: req.Region,
|
||||||
|
LocationTypes: req.LocationType,
|
||||||
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.JSON(http.StatusInternalServerError, ErrorResponse(err, "Something went wrong"))
|
ctx.JSON(http.StatusInternalServerError, ErrorResponse(err, "Something went wrong"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.JSON(http.StatusOK, locations)
|
ctx.JSON(http.StatusOK, locations)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type getLocationReq struct {
|
type getLocationReq struct {
|
||||||
@ -309,7 +318,8 @@ func (server *Server) getListLocationReviews(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type searchLocationsParams struct {
|
type searchLocationsParams struct {
|
||||||
Name string `form:"name" binding:"required"`
|
Name string `form:"name"`
|
||||||
|
Filter string `form:"filter"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (server *Server) searchLocations(ctx *gin.Context) {
|
func (server *Server) searchLocations(ctx *gin.Context) {
|
||||||
@ -323,6 +333,7 @@ func (server *Server) searchLocations(ctx *gin.Context) {
|
|||||||
searchRequest := meilisearch.SearchRequest{
|
searchRequest := meilisearch.SearchRequest{
|
||||||
Limit: 7,
|
Limit: 7,
|
||||||
Offset: 0,
|
Offset: 0,
|
||||||
|
Filter: req.Filter,
|
||||||
}
|
}
|
||||||
|
|
||||||
searchRes, err := server.MeilisearchClient.Index("locations").Search(req.Name, &searchRequest)
|
searchRes, err := server.MeilisearchClient.Index("locations").Search(req.Name, &searchRequest)
|
||||||
|
@ -1,52 +1,52 @@
|
|||||||
id,province_id,regency_name
|
id,province_id,regency_name
|
||||||
1101,11,Kabupaten Simeulue
|
1101,11,Simeulue
|
||||||
1102,11,Kabupaten Aceh Singkil
|
1102,11,Aceh Singkil
|
||||||
1103,11,Kabupaten Aceh Selatan
|
1103,11,Aceh Selatan
|
||||||
1104,11,Kabupaten Aceh Tenggara
|
1104,11,Aceh Tenggara
|
||||||
1105,11,Kabupaten Aceh Timur
|
1105,11,Aceh Timur
|
||||||
1106,11,Kabupaten Aceh Tengah
|
1106,11,Aceh Tengah
|
||||||
1107,11,Kabupaten Aceh Barat
|
1107,11,Aceh Barat
|
||||||
1108,11,Kabupaten Aceh Besar
|
1108,11,Aceh Besar
|
||||||
1109,11,Kabupaten Pidie
|
1109,11,Pidie
|
||||||
1110,11,Kabupaten Bireuen
|
1110,11,Bireuen
|
||||||
1111,11,Kabupaten Aceh Utara
|
1111,11,Aceh Utara
|
||||||
1112,11,Kabupaten Aceh Barat Daya
|
1112,11,Aceh Barat Daya
|
||||||
1113,11,Kabupaten Gayo Lues
|
1113,11,Gayo Lues
|
||||||
1114,11,Kabupaten Aceh Tamiang
|
1114,11,Aceh Tamiang
|
||||||
1115,11,Kabupaten Nagan Raya
|
1115,11,Nagan Raya
|
||||||
1116,11,Kabupaten Aceh Jaya
|
1116,11,Aceh Jaya
|
||||||
1117,11,Kabupaten Bener Meriah
|
1117,11,Bener Meriah
|
||||||
1118,11,Kabupaten Pidie Jaya
|
1118,11,Pidie Jaya
|
||||||
1171,11,Kota Banda Aceh
|
1171,11,Kota Banda Aceh
|
||||||
1172,11,Kota Sabang
|
1172,11,Kota Sabang
|
||||||
1173,11,Kota Langsa
|
1173,11,Kota Langsa
|
||||||
1174,11,Kota Lhokseumawe
|
1174,11,Kota Lhokseumawe
|
||||||
1175,11,Kota Subulussalam
|
1175,11,Kota Subulussalam
|
||||||
1201,12,Kabupaten Nias
|
1201,12,Nias
|
||||||
1202,12,Kabupaten Mandailing Natal
|
1202,12,Mandailing Natal
|
||||||
1203,12,Kabupaten Tapanuli Selatan
|
1203,12,Tapanuli Selatan
|
||||||
1204,12,Kabupaten Tapanuli Tengah
|
1204,12,Tapanuli Tengah
|
||||||
1205,12,Kabupaten Tapanuli Utara
|
1205,12,Tapanuli Utara
|
||||||
1206,12,Kabupaten Toba Samosir
|
1206,12,Toba Samosir
|
||||||
1207,12,Kabupaten Labuhan Batu
|
1207,12,Labuhan Batu
|
||||||
1208,12,Kabupaten Asahan
|
1208,12,Asahan
|
||||||
1209,12,Kabupaten Simalungun
|
1209,12,Simalungun
|
||||||
1210,12,Kabupaten Dairi
|
1210,12,Dairi
|
||||||
1211,12,Kabupaten Karo
|
1211,12,Karo
|
||||||
1212,12,Kabupaten Deli Serdang
|
1212,12,Deli Serdang
|
||||||
1213,12,Kabupaten Langkat
|
1213,12,Langkat
|
||||||
1214,12,Kabupaten Nias Selatan
|
1214,12,Nias Selatan
|
||||||
1215,12,Kabupaten Humbang Hasundutan
|
1215,12,Humbang Hasundutan
|
||||||
1216,12,Kabupaten Pakpak Bharat
|
1216,12,Pakpak Bharat
|
||||||
1217,12,Kabupaten Samosir
|
1217,12,Samosir
|
||||||
1218,12,Kabupaten Serdang Bedagai
|
1218,12,Serdang Bedagai
|
||||||
1219,12,Kabupaten Batu Bara
|
1219,12,Batu Bara
|
||||||
1220,12,Kabupaten Padang Lawas Utara
|
1220,12,Padang Lawas Utara
|
||||||
1221,12,Kabupaten Padang Lawas
|
1221,12,Padang Lawas
|
||||||
1222,12,Kabupaten Labuhan Batu Selatan
|
1222,12,Labuhan Batu Selatan
|
||||||
1223,12,Kabupaten Labuhan Batu Utara
|
1223,12,Labuhan Batu Utara
|
||||||
1224,12,Kabupaten Nias Utara
|
1224,12,Nias Utara
|
||||||
1225,12,Kabupaten Nias Barat
|
1225,12,Nias Barat
|
||||||
1271,12,Kota Sibolga
|
1271,12,Kota Sibolga
|
||||||
1272,12,Kota Tanjung Balai
|
1272,12,Kota Tanjung Balai
|
||||||
1273,12,Kota Pematang Siantar
|
1273,12,Kota Pematang Siantar
|
||||||
@ -55,18 +55,18 @@ id,province_id,regency_name
|
|||||||
1276,12,Kota Binjai
|
1276,12,Kota Binjai
|
||||||
1277,12,Kota Padangsidimpuan
|
1277,12,Kota Padangsidimpuan
|
||||||
1278,12,Kota Gunungsitoli
|
1278,12,Kota Gunungsitoli
|
||||||
1301,13,Kabupaten Kepulauan Mentawai
|
1301,13,Kepulauan Mentawai
|
||||||
1302,13,Kabupaten Pesisir Selatan
|
1302,13,Pesisir Selatan
|
||||||
1303,13,Kabupaten Solok
|
1303,13,Solok
|
||||||
1304,13,Kabupaten Sijunjung
|
1304,13,Sijunjung
|
||||||
1305,13,Kabupaten Tanah Datar
|
1305,13,Tanah Datar
|
||||||
1306,13,Kabupaten Padang Pariaman
|
1306,13,Padang Pariaman
|
||||||
1307,13,Kabupaten Agam
|
1307,13,Agam
|
||||||
1308,13,Kabupaten Lima Puluh Kota
|
1308,13,Lima Puluh Kota
|
||||||
1309,13,Kabupaten Pasaman
|
1309,13,Pasaman
|
||||||
1310,13,Kabupaten Solok Selatan
|
1310,13,Solok Selatan
|
||||||
1311,13,Kabupaten Dharmasraya
|
1311,13,Dharmasraya
|
||||||
1312,13,Kabupaten Pasaman Barat
|
1312,13,Pasaman Barat
|
||||||
1371,13,Kota Padang
|
1371,13,Kota Padang
|
||||||
1372,13,Kota Solok
|
1372,13,Kota Solok
|
||||||
1373,13,Kota Sawah Lunto
|
1373,13,Kota Sawah Lunto
|
||||||
@ -74,109 +74,109 @@ id,province_id,regency_name
|
|||||||
1375,13,Kota Bukittinggi
|
1375,13,Kota Bukittinggi
|
||||||
1376,13,Kota Payakumbuh
|
1376,13,Kota Payakumbuh
|
||||||
1377,13,Kota Pariaman
|
1377,13,Kota Pariaman
|
||||||
1401,14,Kabupaten Kuantan Singingi
|
1401,14,Kuantan Singingi
|
||||||
1402,14,Kabupaten Indragiri Hulu
|
1402,14,Indragiri Hulu
|
||||||
1403,14,Kabupaten Indragiri Hilir
|
1403,14,Indragiri Hilir
|
||||||
1404,14,Kabupaten Pelalawan
|
1404,14,Pelalawan
|
||||||
1405,14,Kabupaten Siak
|
1405,14,Siak
|
||||||
1406,14,Kabupaten Kampar
|
1406,14,Kampar
|
||||||
1407,14,Kabupaten Rokan Hulu
|
1407,14,Rokan Hulu
|
||||||
1408,14,Kabupaten Bengkalis
|
1408,14,Bengkalis
|
||||||
1409,14,Kabupaten Rokan Hilir
|
1409,14,Rokan Hilir
|
||||||
1410,14,Kabupaten Kepulauan Meranti
|
1410,14,Kepulauan Meranti
|
||||||
1471,14,Kota Pekanbaru
|
1471,14,Kota Pekanbaru
|
||||||
1473,14,Kota Dumai
|
1473,14,Kota Dumai
|
||||||
1501,15,Kabupaten Kerinci
|
1501,15,Kerinci
|
||||||
1502,15,Kabupaten Merangin
|
1502,15,Merangin
|
||||||
1503,15,Kabupaten Sarolangun
|
1503,15,Sarolangun
|
||||||
1504,15,Kabupaten Batang Hari
|
1504,15,Batang Hari
|
||||||
1505,15,Kabupaten Muaro Jambi
|
1505,15,Muaro Jambi
|
||||||
1506,15,Kabupaten Tanjung Jabung Timur
|
1506,15,Tanjung Jabung Timur
|
||||||
1507,15,Kabupaten Tanjung Jabung Barat
|
1507,15,Tanjung Jabung Barat
|
||||||
1508,15,Kabupaten Tebo
|
1508,15,Tebo
|
||||||
1509,15,Kabupaten Bungo
|
1509,15,Bungo
|
||||||
1571,15,Kota Jambi
|
1571,15,Kota Jambi
|
||||||
1572,15,Kota Sungai Penuh
|
1572,15,Kota Sungai Penuh
|
||||||
1601,16,Kabupaten Ogan Komering Ulu
|
1601,16,Ogan Komering Ulu
|
||||||
1602,16,Kabupaten Ogan Komering Ilir
|
1602,16,Ogan Komering Ilir
|
||||||
1603,16,Kabupaten Muara Enim
|
1603,16,Muara Enim
|
||||||
1604,16,Kabupaten Lahat
|
1604,16,Lahat
|
||||||
1605,16,Kabupaten Musi Rawas
|
1605,16,Musi Rawas
|
||||||
1606,16,Kabupaten Musi Banyuasin
|
1606,16,Musi Banyuasin
|
||||||
1607,16,Kabupaten Banyu Asin
|
1607,16,Banyu Asin
|
||||||
1608,16,Kabupaten Ogan Komering Ulu Selatan
|
1608,16,Ogan Komering Ulu Selatan
|
||||||
1609,16,Kabupaten Ogan Komering Ulu Timur
|
1609,16,Ogan Komering Ulu Timur
|
||||||
1610,16,Kabupaten Ogan Ilir
|
1610,16,Ogan Ilir
|
||||||
1611,16,Kabupaten Empat Lawang
|
1611,16,Empat Lawang
|
||||||
1612,16,Kabupaten Penukal Abab Lematang Ilir
|
1612,16,Penukal Abab Lematang Ilir
|
||||||
1613,16,Kabupaten Musi Rawas Utara
|
1613,16,Musi Rawas Utara
|
||||||
1671,16,Kota Palembang
|
1671,16,Kota Palembang
|
||||||
1672,16,Kota Prabumulih
|
1672,16,Kota Prabumulih
|
||||||
1673,16,Kota Pagar Alam
|
1673,16,Kota Pagar Alam
|
||||||
1674,16,Kota Lubuklinggau
|
1674,16,Kota Lubuklinggau
|
||||||
1701,17,Kabupaten Bengkulu Selatan
|
1701,17,Bengkulu Selatan
|
||||||
1702,17,Kabupaten Rejang Lebong
|
1702,17,Rejang Lebong
|
||||||
1703,17,Kabupaten Bengkulu Utara
|
1703,17,Bengkulu Utara
|
||||||
1704,17,Kabupaten Kaur
|
1704,17,Kaur
|
||||||
1705,17,Kabupaten Seluma
|
1705,17,Seluma
|
||||||
1706,17,Kabupaten Mukomuko
|
1706,17,Mukomuko
|
||||||
1707,17,Kabupaten Lebong
|
1707,17,Lebong
|
||||||
1708,17,Kabupaten Kepahiang
|
1708,17,Kepahiang
|
||||||
1709,17,Kabupaten Bengkulu Tengah
|
1709,17,Bengkulu Tengah
|
||||||
1771,17,Kota Bengkulu
|
1771,17,Kota Bengkulu
|
||||||
1801,18,Kabupaten Lampung Barat
|
1801,18,Lampung Barat
|
||||||
1802,18,Kabupaten Tanggamus
|
1802,18,Tanggamus
|
||||||
1803,18,Kabupaten Lampung Selatan
|
1803,18,Lampung Selatan
|
||||||
1804,18,Kabupaten Lampung Timur
|
1804,18,Lampung Timur
|
||||||
1805,18,Kabupaten Lampung Tengah
|
1805,18,Lampung Tengah
|
||||||
1806,18,Kabupaten Lampung Utara
|
1806,18,Lampung Utara
|
||||||
1807,18,Kabupaten Way Kanan
|
1807,18,Way Kanan
|
||||||
1808,18,Kabupaten Tulangbawang
|
1808,18,Tulangbawang
|
||||||
1809,18,Kabupaten Pesawaran
|
1809,18,Pesawaran
|
||||||
1810,18,Kabupaten Pringsewu
|
1810,18,Pringsewu
|
||||||
1811,18,Kabupaten Mesuji
|
1811,18,Mesuji
|
||||||
1812,18,Kabupaten Tulang Bawang Barat
|
1812,18,Tulang Bawang Barat
|
||||||
1813,18,Kabupaten Pesisir Barat
|
1813,18,Pesisir Barat
|
||||||
1871,18,Kota Bandar Lampung
|
1871,18,Kota Bandar Lampung
|
||||||
1872,18,Kota Metro
|
1872,18,Kota Metro
|
||||||
1901,19,Kabupaten Bangka
|
1901,19,Bangka
|
||||||
1902,19,Kabupaten Belitung
|
1902,19,Belitung
|
||||||
1903,19,Kabupaten Bangka Barat
|
1903,19,Bangka Barat
|
||||||
1904,19,Kabupaten Bangka Tengah
|
1904,19,Bangka Tengah
|
||||||
1905,19,Kabupaten Bangka Selatan
|
1905,19,Bangka Selatan
|
||||||
1906,19,Kabupaten Belitung Timur
|
1906,19,Belitung Timur
|
||||||
1971,19,Kota Pangkal Pinang
|
1971,19,Kota Pangkal Pinang
|
||||||
2101,21,Kabupaten Karimun
|
2101,21,Karimun
|
||||||
2102,21,Kabupaten Bintan
|
2102,21,Bintan
|
||||||
2103,21,Kabupaten Natuna
|
2103,21,Natuna
|
||||||
2104,21,Kabupaten Lingga
|
2104,21,Lingga
|
||||||
2105,21,Kabupaten Kepulauan Anambas
|
2105,21,Kepulauan Anambas
|
||||||
2171,21,Kota Batam
|
2171,21,Kota Batam
|
||||||
2172,21,Kota Tanjung Pinang
|
2172,21,Kota Tanjung Pinang
|
||||||
3101,31,Kabupaten Kepulauan Seribu
|
3101,31,Kepulauan Seribu
|
||||||
3171,31,Kota Jakarta Selatan
|
3171,31,Kota Jakarta Selatan
|
||||||
3172,31,Kota Jakarta Timur
|
3172,31,Kota Jakarta Timur
|
||||||
3173,31,Kota Jakarta Pusat
|
3173,31,Kota Jakarta Pusat
|
||||||
3174,31,Kota Jakarta Barat
|
3174,31,Kota Jakarta Barat
|
||||||
3175,31,Kota Jakarta Utara
|
3175,31,Kota Jakarta Utara
|
||||||
3201,32,Kabupaten Bogor
|
3201,32,Bogor
|
||||||
3202,32,Kabupaten Sukabumi
|
3202,32,Sukabumi
|
||||||
3203,32,Kabupaten Cianjur
|
3203,32,Cianjur
|
||||||
3204,32,Kabupaten Bandung
|
3204,32,Bandung
|
||||||
3205,32,Kabupaten Garut
|
3205,32,Garut
|
||||||
3206,32,Kabupaten Tasikmalaya
|
3206,32,Tasikmalaya
|
||||||
3207,32,Kabupaten Ciamis
|
3207,32,Ciamis
|
||||||
3208,32,Kabupaten Kuningan
|
3208,32,Kuningan
|
||||||
3209,32,Kabupaten Cirebon
|
3209,32,Cirebon
|
||||||
3210,32,Kabupaten Majalengka
|
3210,32,Majalengka
|
||||||
3211,32,Kabupaten Sumedang
|
3211,32,Sumedang
|
||||||
3212,32,Kabupaten Indramayu
|
3212,32,Indramayu
|
||||||
3213,32,Kabupaten Subang
|
3213,32,Subang
|
||||||
3214,32,Kabupaten Purwakarta
|
3214,32,Purwakarta
|
||||||
3215,32,Kabupaten Karawang
|
3215,32,Karawang
|
||||||
3216,32,Kabupaten Bekasi
|
3216,32,Bekasi
|
||||||
3217,32,Kabupaten Bandung Barat
|
3217,32,Bandung Barat
|
||||||
3218,32,Kabupaten Pangandaran
|
3218,32,Pangandaran
|
||||||
3271,32,Kota Bogor
|
3271,32,Kota Bogor
|
||||||
3272,32,Kota Sukabumi
|
3272,32,Kota Sukabumi
|
||||||
3273,32,Kota Bandung
|
3273,32,Kota Bandung
|
||||||
@ -186,75 +186,75 @@ id,province_id,regency_name
|
|||||||
3277,32,Kota Cimahi
|
3277,32,Kota Cimahi
|
||||||
3278,32,Kota Tasikmalaya
|
3278,32,Kota Tasikmalaya
|
||||||
3279,32,Kota Banjar
|
3279,32,Kota Banjar
|
||||||
3301,33,Kabupaten Cilacap
|
3301,33,Cilacap
|
||||||
3302,33,Kabupaten Banyumas
|
3302,33,Banyumas
|
||||||
3303,33,Kabupaten Purbalingga
|
3303,33,Purbalingga
|
||||||
3304,33,Kabupaten Banjarnegara
|
3304,33,Banjarnegara
|
||||||
3305,33,Kabupaten Kebumen
|
3305,33,Kebumen
|
||||||
3306,33,Kabupaten Purworejo
|
3306,33,Purworejo
|
||||||
3307,33,Kabupaten Wonosobo
|
3307,33,Wonosobo
|
||||||
3308,33,Kabupaten Magelang
|
3308,33,Magelang
|
||||||
3309,33,Kabupaten Boyolali
|
3309,33,Boyolali
|
||||||
3310,33,Kabupaten Klaten
|
3310,33,Klaten
|
||||||
3311,33,Kabupaten Sukoharjo
|
3311,33,Sukoharjo
|
||||||
3312,33,Kabupaten Wonogiri
|
3312,33,Wonogiri
|
||||||
3313,33,Kabupaten Karanganyar
|
3313,33,Karanganyar
|
||||||
3314,33,Kabupaten Sragen
|
3314,33,Sragen
|
||||||
3315,33,Kabupaten Grobogan
|
3315,33,Grobogan
|
||||||
3316,33,Kabupaten Blora
|
3316,33,Blora
|
||||||
3317,33,Kabupaten Rembang
|
3317,33,Rembang
|
||||||
3318,33,Kabupaten Pati
|
3318,33,Pati
|
||||||
3319,33,Kabupaten Kudus
|
3319,33,Kudus
|
||||||
3320,33,Kabupaten Jepara
|
3320,33,Jepara
|
||||||
3321,33,Kabupaten Demak
|
3321,33,Demak
|
||||||
3322,33,Kabupaten Semarang
|
3322,33,Semarang
|
||||||
3323,33,Kabupaten Temanggung
|
3323,33,Temanggung
|
||||||
3324,33,Kabupaten Kendal
|
3324,33,Kendal
|
||||||
3325,33,Kabupaten Batang
|
3325,33,Batang
|
||||||
3326,33,Kabupaten Pekalongan
|
3326,33,Pekalongan
|
||||||
3327,33,Kabupaten Pemalang
|
3327,33,Pemalang
|
||||||
3328,33,Kabupaten Tegal
|
3328,33,Tegal
|
||||||
3329,33,Kabupaten Brebes
|
3329,33,Brebes
|
||||||
3371,33,Kota Magelang
|
3371,33,Kota Magelang
|
||||||
3372,33,Kota Surakarta
|
3372,33,Kota Surakarta
|
||||||
3373,33,Kota Salatiga
|
3373,33,Kota Salatiga
|
||||||
3374,33,Kota Semarang
|
3374,33,Kota Semarang
|
||||||
3375,33,Kota Pekalongan
|
3375,33,Kota Pekalongan
|
||||||
3376,33,Kota Tegal
|
3376,33,Kota Tegal
|
||||||
3401,34,Kabupaten Kulon Progo
|
3401,34,Kulon Progo
|
||||||
3402,34,Kabupaten Bantul
|
3402,34,Bantul
|
||||||
3403,34,Kabupaten Gunung Kidul
|
3403,34,Gunung Kidul
|
||||||
3404,34,Kabupaten Sleman
|
3404,34,Sleman
|
||||||
3471,34,Kota Yogyakarta
|
3471,34,Kota Yogyakarta
|
||||||
3501,35,Kabupaten Pacitan
|
3501,35,Pacitan
|
||||||
3502,35,Kabupaten Ponorogo
|
3502,35,Ponorogo
|
||||||
3503,35,Kabupaten Trenggalek
|
3503,35,Trenggalek
|
||||||
3504,35,Kabupaten Tulungagung
|
3504,35,Tulungagung
|
||||||
3505,35,Kabupaten Blitar
|
3505,35,Blitar
|
||||||
3506,35,Kabupaten Kediri
|
3506,35,Kediri
|
||||||
3507,35,Kabupaten Malang
|
3507,35,Malang
|
||||||
3508,35,Kabupaten Lumajang
|
3508,35,Lumajang
|
||||||
3509,35,Kabupaten Jember
|
3509,35,Jember
|
||||||
3510,35,Kabupaten Banyuwangi
|
3510,35,Banyuwangi
|
||||||
3511,35,Kabupaten Bondowoso
|
3511,35,Bondowoso
|
||||||
3512,35,Kabupaten Situbondo
|
3512,35,Situbondo
|
||||||
3513,35,Kabupaten Probolinggo
|
3513,35,Probolinggo
|
||||||
3514,35,Kabupaten Pasuruan
|
3514,35,Pasuruan
|
||||||
3515,35,Kabupaten Sidoarjo
|
3515,35,Sidoarjo
|
||||||
3516,35,Kabupaten Mojokerto
|
3516,35,Mojokerto
|
||||||
3517,35,Kabupaten Jombang
|
3517,35,Jombang
|
||||||
3518,35,Kabupaten Nganjuk
|
3518,35,Nganjuk
|
||||||
3519,35,Kabupaten Madiun
|
3519,35,Madiun
|
||||||
3520,35,Kabupaten Magetan
|
3520,35,Magetan
|
||||||
3521,35,Kabupaten Ngawi
|
3521,35,Ngawi
|
||||||
3522,35,Kabupaten Bojonegoro
|
3522,35,Bojonegoro
|
||||||
3523,35,Kabupaten Tuban
|
3523,35,Tuban
|
||||||
3524,35,Kabupaten Lamongan
|
3524,35,Lamongan
|
||||||
3525,35,Kabupaten Gresik
|
3525,35,Gresik
|
||||||
3526,35,Kabupaten Bangkalan
|
3526,35,Bangkalan
|
||||||
3527,35,Kabupaten Sampang
|
3527,35,Sampang
|
||||||
3528,35,Kabupaten Pamekasan
|
3528,35,Pamekasan
|
||||||
3529,35,Kabupaten Sumenep
|
3529,35,Sumenep
|
||||||
3571,35,Kota Kediri
|
3571,35,Kota Kediri
|
||||||
3572,35,Kota Blitar
|
3572,35,Kota Blitar
|
||||||
3573,35,Kota Malang
|
3573,35,Kota Malang
|
||||||
@ -264,252 +264,252 @@ id,province_id,regency_name
|
|||||||
3577,35,Kota Madiun
|
3577,35,Kota Madiun
|
||||||
3578,35,Kota Surabaya
|
3578,35,Kota Surabaya
|
||||||
3579,35,Kota Batu
|
3579,35,Kota Batu
|
||||||
3601,36,Kabupaten Pandeglang
|
3601,36,Pandeglang
|
||||||
3602,36,Kabupaten Lebak
|
3602,36,Lebak
|
||||||
3603,36,Kabupaten Tangerang
|
3603,36,Tangerang
|
||||||
3604,36,Kabupaten Serang
|
3604,36,Serang
|
||||||
3671,36,Kota Tangerang
|
3671,36,Kota Tangerang
|
||||||
3672,36,Kota Cilegon
|
3672,36,Kota Cilegon
|
||||||
3673,36,Kota Serang
|
3673,36,Kota Serang
|
||||||
3674,36,Kota Tangerang Selatan
|
3674,36,Kota Tangerang Selatan
|
||||||
5101,51,Kabupaten Jembrana
|
5101,51,Jembrana
|
||||||
5102,51,Kabupaten Tabanan
|
5102,51,Tabanan
|
||||||
5103,51,Kabupaten Badung
|
5103,51,Badung
|
||||||
5104,51,Kabupaten Gianyar
|
5104,51,Gianyar
|
||||||
5105,51,Kabupaten Klungkung
|
5105,51,Klungkung
|
||||||
5106,51,Kabupaten Bangli
|
5106,51,Bangli
|
||||||
5107,51,Kabupaten Karang Asem
|
5107,51,Karang Asem
|
||||||
5108,51,Kabupaten Buleleng
|
5108,51,Buleleng
|
||||||
5171,51,Kota Denpasar
|
5171,51,Kota Denpasar
|
||||||
5201,52,Kabupaten Lombok Barat
|
5201,52,Lombok Barat
|
||||||
5202,52,Kabupaten Lombok Tengah
|
5202,52,Lombok Tengah
|
||||||
5203,52,Kabupaten Lombok Timur
|
5203,52,Lombok Timur
|
||||||
5204,52,Kabupaten Sumbawa
|
5204,52,Sumbawa
|
||||||
5205,52,Kabupaten Dompu
|
5205,52,Dompu
|
||||||
5206,52,Kabupaten Bima
|
5206,52,Bima
|
||||||
5207,52,Kabupaten Sumbawa Barat
|
5207,52,Sumbawa Barat
|
||||||
5208,52,Kabupaten Lombok Utara
|
5208,52,Lombok Utara
|
||||||
5271,52,Kota Mataram
|
5271,52,Kota Mataram
|
||||||
5272,52,Kota Bima
|
5272,52,Kota Bima
|
||||||
5301,53,Kabupaten Sumba Barat
|
5301,53,Sumba Barat
|
||||||
5302,53,Kabupaten Sumba Timur
|
5302,53,Sumba Timur
|
||||||
5303,53,Kabupaten Kupang
|
5303,53,Kupang
|
||||||
5304,53,Kabupaten Timor Tengah Selatan
|
5304,53,Timor Tengah Selatan
|
||||||
5305,53,Kabupaten Timor Tengah Utara
|
5305,53,Timor Tengah Utara
|
||||||
5306,53,Kabupaten Belu
|
5306,53,Belu
|
||||||
5307,53,Kabupaten Alor
|
5307,53,Alor
|
||||||
5308,53,Kabupaten Lembata
|
5308,53,Lembata
|
||||||
5309,53,Kabupaten Flores Timur
|
5309,53,Flores Timur
|
||||||
5310,53,Kabupaten Sikka
|
5310,53,Sikka
|
||||||
5311,53,Kabupaten Ende
|
5311,53,Ende
|
||||||
5312,53,Kabupaten Ngada
|
5312,53,Ngada
|
||||||
5313,53,Kabupaten Manggarai
|
5313,53,Manggarai
|
||||||
5314,53,Kabupaten Rote Ndao
|
5314,53,Rote Ndao
|
||||||
5315,53,Kabupaten Manggarai Barat
|
5315,53,Manggarai Barat
|
||||||
5316,53,Kabupaten Sumba Tengah
|
5316,53,Sumba Tengah
|
||||||
5317,53,Kabupaten Sumba Barat Daya
|
5317,53,Sumba Barat Daya
|
||||||
5318,53,Kabupaten Nagekeo
|
5318,53,Nagekeo
|
||||||
5319,53,Kabupaten Manggarai Timur
|
5319,53,Manggarai Timur
|
||||||
5320,53,Kabupaten Sabu Raijua
|
5320,53,Sabu Raijua
|
||||||
5321,53,Kabupaten Malaka
|
5321,53,Malaka
|
||||||
5371,53,Kota Kupang
|
5371,53,Kota Kupang
|
||||||
6101,61,Kabupaten Sambas
|
6101,61,Sambas
|
||||||
6102,61,Kabupaten Bengkayang
|
6102,61,Bengkayang
|
||||||
6103,61,Kabupaten Landak
|
6103,61,Landak
|
||||||
6104,61,Kabupaten Mempawah
|
6104,61,Mempawah
|
||||||
6105,61,Kabupaten Sanggau
|
6105,61,Sanggau
|
||||||
6106,61,Kabupaten Ketapang
|
6106,61,Ketapang
|
||||||
6107,61,Kabupaten Sintang
|
6107,61,Sintang
|
||||||
6108,61,Kabupaten Kapuas Hulu
|
6108,61,Kapuas Hulu
|
||||||
6109,61,Kabupaten Sekadau
|
6109,61,Sekadau
|
||||||
6110,61,Kabupaten Melawi
|
6110,61,Melawi
|
||||||
6111,61,Kabupaten Kayong Utara
|
6111,61,Kayong Utara
|
||||||
6112,61,Kabupaten Kubu Raya
|
6112,61,Kubu Raya
|
||||||
6171,61,Kota Pontianak
|
6171,61,Kota Pontianak
|
||||||
6172,61,Kota Singkawang
|
6172,61,Kota Singkawang
|
||||||
6201,62,Kabupaten Kotawaringin Barat
|
6201,62,Kotawaringin Barat
|
||||||
6202,62,Kabupaten Kotawaringin Timur
|
6202,62,Kotawaringin Timur
|
||||||
6203,62,Kabupaten Kapuas
|
6203,62,Kapuas
|
||||||
6204,62,Kabupaten Barito Selatan
|
6204,62,Barito Selatan
|
||||||
6205,62,Kabupaten Barito Utara
|
6205,62,Barito Utara
|
||||||
6206,62,Kabupaten Sukamara
|
6206,62,Sukamara
|
||||||
6207,62,Kabupaten Lamandau
|
6207,62,Lamandau
|
||||||
6208,62,Kabupaten Seruyan
|
6208,62,Seruyan
|
||||||
6209,62,Kabupaten Katingan
|
6209,62,Katingan
|
||||||
6210,62,Kabupaten Pulang Pisau
|
6210,62,Pulang Pisau
|
||||||
6211,62,Kabupaten Gunung Mas
|
6211,62,Gunung Mas
|
||||||
6212,62,Kabupaten Barito Timur
|
6212,62,Barito Timur
|
||||||
6213,62,Kabupaten Murung Raya
|
6213,62,Murung Raya
|
||||||
6271,62,Kota Palangka Raya
|
6271,62,Kota Palangka Raya
|
||||||
6301,63,Kabupaten Tanah Laut
|
6301,63,Tanah Laut
|
||||||
6302,63,Kabupaten Kota Baru
|
6302,63,Kota Baru
|
||||||
6303,63,Kabupaten Banjar
|
6303,63,Banjar
|
||||||
6304,63,Kabupaten Barito Kuala
|
6304,63,Barito Kuala
|
||||||
6305,63,Kabupaten Tapin
|
6305,63,Tapin
|
||||||
6306,63,Kabupaten Hulu Sungai Selatan
|
6306,63,Hulu Sungai Selatan
|
||||||
6307,63,Kabupaten Hulu Sungai Tengah
|
6307,63,Hulu Sungai Tengah
|
||||||
6308,63,Kabupaten Hulu Sungai Utara
|
6308,63,Hulu Sungai Utara
|
||||||
6309,63,Kabupaten Tabalong
|
6309,63,Tabalong
|
||||||
6310,63,Kabupaten Tanah Bumbu
|
6310,63,Tanah Bumbu
|
||||||
6311,63,Kabupaten Balangan
|
6311,63,Balangan
|
||||||
6371,63,Kota Banjarmasin
|
6371,63,Kota Banjarmasin
|
||||||
6372,63,Kota Banjar Baru
|
6372,63,Kota Banjar Baru
|
||||||
6401,64,Kabupaten Paser
|
6401,64,Paser
|
||||||
6402,64,Kabupaten Kutai Barat
|
6402,64,Kutai Barat
|
||||||
6403,64,Kabupaten Kutai Kartanegara
|
6403,64,Kutai Kartanegara
|
||||||
6404,64,Kabupaten Kutai Timur
|
6404,64,Kutai Timur
|
||||||
6405,64,Kabupaten Berau
|
6405,64,Berau
|
||||||
6409,64,Kabupaten Penajam Paser Utara
|
6409,64,Penajam Paser Utara
|
||||||
6411,64,Kabupaten Mahakam Hulu
|
6411,64,Mahakam Hulu
|
||||||
6471,64,Kota Balikpapan
|
6471,64,Kota Balikpapan
|
||||||
6472,64,Kota Samarinda
|
6472,64,Kota Samarinda
|
||||||
6474,64,Kota Bontang
|
6474,64,Kota Bontang
|
||||||
6501,65,Kabupaten Malinau
|
6501,65,Malinau
|
||||||
6502,65,Kabupaten Bulungan
|
6502,65,Bulungan
|
||||||
6503,65,Kabupaten Tana Tidung
|
6503,65,Tana Tidung
|
||||||
6504,65,Kabupaten Nunukan
|
6504,65,Nunukan
|
||||||
6571,65,Kota Tarakan
|
6571,65,Kota Tarakan
|
||||||
7101,71,Kabupaten Bolaang Mongondow
|
7101,71,Bolaang Mongondow
|
||||||
7102,71,Kabupaten Minahasa
|
7102,71,Minahasa
|
||||||
7103,71,Kabupaten Kepulauan Sangihe
|
7103,71,Kepulauan Sangihe
|
||||||
7104,71,Kabupaten Kepulauan Talaud
|
7104,71,Kepulauan Talaud
|
||||||
7105,71,Kabupaten Minahasa Selatan
|
7105,71,Minahasa Selatan
|
||||||
7106,71,Kabupaten Minahasa Utara
|
7106,71,Minahasa Utara
|
||||||
7107,71,Kabupaten Bolaang Mongondow Utara
|
7107,71,Bolaang Mongondow Utara
|
||||||
7108,71,Kabupaten Siau Tagulandang Biaro
|
7108,71,Siau Tagulandang Biaro
|
||||||
7109,71,Kabupaten Minahasa Tenggara
|
7109,71,Minahasa Tenggara
|
||||||
7110,71,Kabupaten Bolaang Mongondow Selatan
|
7110,71,Bolaang Mongondow Selatan
|
||||||
7111,71,Kabupaten Bolaang Mongondow Timur
|
7111,71,Bolaang Mongondow Timur
|
||||||
7171,71,Kota Manado
|
7171,71,Kota Manado
|
||||||
7172,71,Kota Bitung
|
7172,71,Kota Bitung
|
||||||
7173,71,Kota Tomohon
|
7173,71,Kota Tomohon
|
||||||
7174,71,Kota Kotamobagu
|
7174,71,Kota Kotamobagu
|
||||||
7201,72,Kabupaten Banggai Kepulauan
|
7201,72,Banggai Kepulauan
|
||||||
7202,72,Kabupaten Banggai
|
7202,72,Banggai
|
||||||
7203,72,Kabupaten Morowali
|
7203,72,Morowali
|
||||||
7204,72,Kabupaten Poso
|
7204,72,Poso
|
||||||
7205,72,Kabupaten Donggala
|
7205,72,Donggala
|
||||||
7206,72,Kabupaten Toli-Toli
|
7206,72,Toli-Toli
|
||||||
7207,72,Kabupaten Buol
|
7207,72,Buol
|
||||||
7208,72,Kabupaten Parigi Moutong
|
7208,72,Parigi Moutong
|
||||||
7209,72,Kabupaten Tojo Una-Una
|
7209,72,Tojo Una-Una
|
||||||
7210,72,Kabupaten Sigi
|
7210,72,Sigi
|
||||||
7211,72,Kabupaten Banggai Laut
|
7211,72,Banggai Laut
|
||||||
7212,72,Kabupaten Morowali Utara
|
7212,72,Morowali Utara
|
||||||
7271,72,Kota Palu
|
7271,72,Kota Palu
|
||||||
7301,73,Kabupaten Kepulauan Selayar
|
7301,73,Kepulauan Selayar
|
||||||
7302,73,Kabupaten Bulukumba
|
7302,73,Bulukumba
|
||||||
7303,73,Kabupaten Bantaeng
|
7303,73,Bantaeng
|
||||||
7304,73,Kabupaten Jeneponto
|
7304,73,Jeneponto
|
||||||
7305,73,Kabupaten Takalar
|
7305,73,Takalar
|
||||||
7306,73,Kabupaten Gowa
|
7306,73,Gowa
|
||||||
7307,73,Kabupaten Sinjai
|
7307,73,Sinjai
|
||||||
7308,73,Kabupaten Maros
|
7308,73,Maros
|
||||||
7309,73,Kabupaten Pangkajene Dan Kepulauan
|
7309,73,Pangkajene Dan Kepulauan
|
||||||
7310,73,Kabupaten Barru
|
7310,73,Barru
|
||||||
7311,73,Kabupaten Bone
|
7311,73,Bone
|
||||||
7312,73,Kabupaten Soppeng
|
7312,73,Soppeng
|
||||||
7313,73,Kabupaten Wajo
|
7313,73,Wajo
|
||||||
7314,73,Kabupaten Sidenreng Rappang
|
7314,73,Sidenreng Rappang
|
||||||
7315,73,Kabupaten Pinrang
|
7315,73,Pinrang
|
||||||
7316,73,Kabupaten Enrekang
|
7316,73,Enrekang
|
||||||
7317,73,Kabupaten Luwu
|
7317,73,Luwu
|
||||||
7318,73,Kabupaten Tana Toraja
|
7318,73,Tana Toraja
|
||||||
7322,73,Kabupaten Luwu Utara
|
7322,73,Luwu Utara
|
||||||
7325,73,Kabupaten Luwu Timur
|
7325,73,Luwu Timur
|
||||||
7326,73,Kabupaten Toraja Utara
|
7326,73,Toraja Utara
|
||||||
7371,73,Kota Makassar
|
7371,73,Kota Makassar
|
||||||
7372,73,Kota Parepare
|
7372,73,Kota Parepare
|
||||||
7373,73,Kota Palopo
|
7373,73,Kota Palopo
|
||||||
7401,74,Kabupaten Buton
|
7401,74,Buton
|
||||||
7402,74,Kabupaten Muna
|
7402,74,Muna
|
||||||
7403,74,Kabupaten Konawe
|
7403,74,Konawe
|
||||||
7404,74,Kabupaten Kolaka
|
7404,74,Kolaka
|
||||||
7405,74,Kabupaten Konawe Selatan
|
7405,74,Konawe Selatan
|
||||||
7406,74,Kabupaten Bombana
|
7406,74,Bombana
|
||||||
7407,74,Kabupaten Wakatobi
|
7407,74,Wakatobi
|
||||||
7408,74,Kabupaten Kolaka Utara
|
7408,74,Kolaka Utara
|
||||||
7409,74,Kabupaten Buton Utara
|
7409,74,Buton Utara
|
||||||
7410,74,Kabupaten Konawe Utara
|
7410,74,Konawe Utara
|
||||||
7411,74,Kabupaten Kolaka Timur
|
7411,74,Kolaka Timur
|
||||||
7412,74,Kabupaten Konawe Kepulauan
|
7412,74,Konawe Kepulauan
|
||||||
7413,74,Kabupaten Muna Barat
|
7413,74,Muna Barat
|
||||||
7414,74,Kabupaten Buton Tengah
|
7414,74,Buton Tengah
|
||||||
7415,74,Kabupaten Buton Selatan
|
7415,74,Buton Selatan
|
||||||
7471,74,Kota Kendari
|
7471,74,Kota Kendari
|
||||||
7472,74,Kota Baubau
|
7472,74,Kota Baubau
|
||||||
7501,75,Kabupaten Boalemo
|
7501,75,Boalemo
|
||||||
7502,75,Kabupaten Gorontalo
|
7502,75,Gorontalo
|
||||||
7503,75,Kabupaten Pohuwato
|
7503,75,Pohuwato
|
||||||
7504,75,Kabupaten Bone Bolango
|
7504,75,Bone Bolango
|
||||||
7505,75,Kabupaten Gorontalo Utara
|
7505,75,Gorontalo Utara
|
||||||
7571,75,Kota Gorontalo
|
7571,75,Kota Gorontalo
|
||||||
7601,76,Kabupaten Majene
|
7601,76,Majene
|
||||||
7602,76,Kabupaten Polewali Mandar
|
7602,76,Polewali Mandar
|
||||||
7603,76,Kabupaten Mamasa
|
7603,76,Mamasa
|
||||||
7604,76,Kabupaten Mamuju
|
7604,76,Mamuju
|
||||||
7605,76,Kabupaten Mamuju Utara
|
7605,76,Mamuju Utara
|
||||||
7606,76,Kabupaten Mamuju Tengah
|
7606,76,Mamuju Tengah
|
||||||
8101,81,Kabupaten Maluku Tenggara Barat
|
8101,81,Maluku Tenggara Barat
|
||||||
8102,81,Kabupaten Maluku Tenggara
|
8102,81,Maluku Tenggara
|
||||||
8103,81,Kabupaten Maluku Tengah
|
8103,81,Maluku Tengah
|
||||||
8104,81,Kabupaten Buru
|
8104,81,Buru
|
||||||
8105,81,Kabupaten Kepulauan Aru
|
8105,81,Kepulauan Aru
|
||||||
8106,81,Kabupaten Seram Bagian Barat
|
8106,81,Seram Bagian Barat
|
||||||
8107,81,Kabupaten Seram Bagian Timur
|
8107,81,Seram Bagian Timur
|
||||||
8108,81,Kabupaten Maluku Barat Daya
|
8108,81,Maluku Barat Daya
|
||||||
8109,81,Kabupaten Buru Selatan
|
8109,81,Buru Selatan
|
||||||
8171,81,Kota Ambon
|
8171,81,Kota Ambon
|
||||||
8172,81,Kota Tual
|
8172,81,Kota Tual
|
||||||
8201,82,Kabupaten Halmahera Barat
|
8201,82,Halmahera Barat
|
||||||
8202,82,Kabupaten Halmahera Tengah
|
8202,82,Halmahera Tengah
|
||||||
8203,82,Kabupaten Kepulauan Sula
|
8203,82,Kepulauan Sula
|
||||||
8204,82,Kabupaten Halmahera Selatan
|
8204,82,Halmahera Selatan
|
||||||
8205,82,Kabupaten Halmahera Utara
|
8205,82,Halmahera Utara
|
||||||
8206,82,Kabupaten Halmahera Timur
|
8206,82,Halmahera Timur
|
||||||
8207,82,Kabupaten Pulau Morotai
|
8207,82,Pulau Morotai
|
||||||
8208,82,Kabupaten Pulau Taliabu
|
8208,82,Pulau Taliabu
|
||||||
8271,82,Kota Ternate
|
8271,82,Kota Ternate
|
||||||
8272,82,Kota Tidore Kepulauan
|
8272,82,Kota Tidore Kepulauan
|
||||||
9101,91,Kabupaten Fakfak
|
9101,91,Fakfak
|
||||||
9102,91,Kabupaten Kaimana
|
9102,91,Kaimana
|
||||||
9103,91,Kabupaten Teluk Wondama
|
9103,91,Teluk Wondama
|
||||||
9104,91,Kabupaten Teluk Bintuni
|
9104,91,Teluk Bintuni
|
||||||
9105,91,Kabupaten Manokwari
|
9105,91,Manokwari
|
||||||
9106,91,Kabupaten Sorong Selatan
|
9106,91,Sorong Selatan
|
||||||
9107,91,Kabupaten Sorong
|
9107,91,Sorong
|
||||||
9108,91,Kabupaten Raja Ampat
|
9108,91,Raja Ampat
|
||||||
9109,91,Kabupaten Tambrauw
|
9109,91,Tambrauw
|
||||||
9110,91,Kabupaten Maybrat
|
9110,91,Maybrat
|
||||||
9111,91,Kabupaten Manokwari Selatan
|
9111,91,Manokwari Selatan
|
||||||
9112,91,Kabupaten Pegunungan Arfak
|
9112,91,Pegunungan Arfak
|
||||||
9171,91,Kota Sorong
|
9171,91,Kota Sorong
|
||||||
9401,94,Kabupaten Merauke
|
9401,94,Merauke
|
||||||
9402,94,Kabupaten Jayawijaya
|
9402,94,Jayawijaya
|
||||||
9403,94,Kabupaten Jayapura
|
9403,94,Jayapura
|
||||||
9404,94,Kabupaten Nabire
|
9404,94,Nabire
|
||||||
9408,94,Kabupaten Kepulauan Yapen
|
9408,94,Kepulauan Yapen
|
||||||
9409,94,Kabupaten Biak Numfor
|
9409,94,Biak Numfor
|
||||||
9410,94,Kabupaten Paniai
|
9410,94,Paniai
|
||||||
9411,94,Kabupaten Puncak Jaya
|
9411,94,Puncak Jaya
|
||||||
9412,94,Kabupaten Mimika
|
9412,94,Mimika
|
||||||
9413,94,Kabupaten Boven Digoel
|
9413,94,Boven Digoel
|
||||||
9414,94,Kabupaten Mappi
|
9414,94,Mappi
|
||||||
9415,94,Kabupaten Asmat
|
9415,94,Asmat
|
||||||
9416,94,Kabupaten Yahukimo
|
9416,94,Yahukimo
|
||||||
9417,94,Kabupaten Pegunungan Bintang
|
9417,94,Pegunungan Bintang
|
||||||
9418,94,Kabupaten Tolikara
|
9418,94,Tolikara
|
||||||
9419,94,Kabupaten Sarmi
|
9419,94,Sarmi
|
||||||
9420,94,Kabupaten Keerom
|
9420,94,Keerom
|
||||||
9426,94,Kabupaten Waropen
|
9426,94,Waropen
|
||||||
9427,94,Kabupaten Supiori
|
9427,94,Supiori
|
||||||
9428,94,Kabupaten Mamberamo Raya
|
9428,94,Mamberamo Raya
|
||||||
9429,94,Kabupaten Nduga
|
9429,94,Nduga
|
||||||
9430,94,Kabupaten Lanny Jaya
|
9430,94,Lanny Jaya
|
||||||
9431,94,Kabupaten Mamberamo Tengah
|
9431,94,Mamberamo Tengah
|
||||||
9432,94,Kabupaten Yalimo
|
9432,94,Yalimo
|
||||||
9433,94,Kabupaten Puncak
|
9433,94,Puncak
|
||||||
9434,94,Kabupaten Dogiyai
|
9434,94,Dogiyai
|
||||||
9435,94,Kabupaten Intan Jaya
|
9435,94,Intan Jaya
|
||||||
9436,94,Kabupaten Deiyai
|
9436,94,Deiyai
|
||||||
9471,94,Kota Jayapura
|
9471,94,Kota Jayapura
|
|
@ -85,7 +85,7 @@ CREATE TYPE location_type AS ENUM(
|
|||||||
CREATE TABLE locations(
|
CREATE TABLE locations(
|
||||||
"id" serial primary key not null,
|
"id" serial primary key not null,
|
||||||
"address" varchar not null,
|
"address" varchar not null,
|
||||||
"name" varchar not null,
|
"name" varchar unique not null,
|
||||||
"google_maps_link" varchar,
|
"google_maps_link" varchar,
|
||||||
"location_type" location_type not null,
|
"location_type" location_type not null,
|
||||||
"submitted_by" integer references "users"("id") not null,
|
"submitted_by" integer references "users"("id") not null,
|
||||||
|
@ -248,7 +248,7 @@ func (mr *MockStoreMockRecorder) GetListProvinces(arg0 any) *gomock.Call {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetListRecentLocationsWithRatings mocks base method.
|
// GetListRecentLocationsWithRatings mocks base method.
|
||||||
func (m *MockStore) GetListRecentLocationsWithRatings(arg0 context.Context, arg1 int32) ([]db.GetListRecentLocationsWithRatingsRow, error) {
|
func (m *MockStore) GetListRecentLocationsWithRatings(arg0 context.Context, arg1 db.GetListRecentLocationsParams) ([]db.GetListRecentLocationsWithRatingsRow, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "GetListRecentLocationsWithRatings", arg0, arg1)
|
ret := m.ctrl.Call(m, "GetListRecentLocationsWithRatings", arg0, arg1)
|
||||||
ret0, _ := ret[0].([]db.GetListRecentLocationsWithRatingsRow)
|
ret0, _ := ret[0].([]db.GetListRecentLocationsWithRatingsRow)
|
||||||
|
@ -1,24 +1,6 @@
|
|||||||
-- name: GetListLocations :many
|
-- name: GetListLocations :many
|
||||||
SELECT * FROM locations;
|
SELECT * FROM locations;
|
||||||
|
|
||||||
-- name: GetListRecentLocationsWithRatings :many
|
|
||||||
SELECT
|
|
||||||
l.id,
|
|
||||||
name,
|
|
||||||
thumbnail,
|
|
||||||
COALESCE(re.regency_name, '') as regency_name,
|
|
||||||
COALESCE(pr.province_name, '') as province_name,
|
|
||||||
(SELECT COALESCE(SUM(score), 0) from reviews re where re.is_from_critic = true and re.location_id = l.id) as critic_score,
|
|
||||||
(SELECT COUNT(id) from reviews re where re.is_from_critic = true and re.location_id = l.id) as critic_count,
|
|
||||||
(SELECT COALESCE(SUM(score), 0) from reviews re where re.is_from_critic = false and re.location_id = l.id) as user_score,
|
|
||||||
(SELECT COUNT(id) from reviews re where re.is_from_critic = false and re.location_id = l.id) as user_count
|
|
||||||
FROM locations l
|
|
||||||
JOIN regencies re on re.id = l.regency_id
|
|
||||||
JOIN provinces pr on re.province_id = pr.id
|
|
||||||
WHERE approved_by IS NOT NULL
|
|
||||||
ORDER BY l.created_at ASC
|
|
||||||
LIMIT $1;
|
|
||||||
|
|
||||||
-- name: GetLocationTag :many
|
-- name: GetLocationTag :many
|
||||||
SELECT
|
SELECT
|
||||||
name
|
name
|
||||||
|
@ -3,7 +3,9 @@ package db
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/henvic/pgq"
|
||||||
"github.com/jackc/pgx/v5/pgtype"
|
"github.com/jackc/pgx/v5/pgtype"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -109,6 +111,89 @@ func (q *Queries) GetTopListLocations(ctx context.Context, arg GetTopListLocatio
|
|||||||
return items, nil
|
return items, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GetListRecentLocationsWithRatingsRow struct {
|
||||||
|
ID int32 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Thumbnail pgtype.Text `json:"thumbnail"`
|
||||||
|
LocationType pgtype.Text `json:"location_type"`
|
||||||
|
RegencyName string `json:"regency_name"`
|
||||||
|
ProvinceName string `json:"province_name"`
|
||||||
|
CriticScore interface{} `json:"critic_score"`
|
||||||
|
CriticCount int64 `json:"critic_count"`
|
||||||
|
UserScore interface{} `json:"user_score"`
|
||||||
|
UserCount int64 `json:"user_count"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetListRecentLocationsParams struct {
|
||||||
|
Limit int32 `json:"limit" default:"12"`
|
||||||
|
Regions string `json:"regions" default:""`
|
||||||
|
LocationTypes string `json:"location_type" default:""`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) GetListRecentLocationsWithRatings(ctx context.Context, arg GetListRecentLocationsParams) ([]GetListRecentLocationsWithRatingsRow, error) {
|
||||||
|
sqlBuilder := pgq.Select(
|
||||||
|
"l.id",
|
||||||
|
"name",
|
||||||
|
"thumbnail",
|
||||||
|
"l.location_type",
|
||||||
|
"COALESCE(re.regency_name, '') as regency_name",
|
||||||
|
"COALESCE(pr.province_name, '') as province_name",
|
||||||
|
"(SELECT COALESCE(SUM(score), 0) from reviews re where re.is_from_critic = true and re.location_id = l.id) as critic_score",
|
||||||
|
"(SELECT COUNT(id) from reviews re where re.is_from_critic = true and re.location_id = l.id) as critic_count",
|
||||||
|
"(SELECT COALESCE(SUM(score), 0) from reviews re where re.is_from_critic = false and re.location_id = l.id) as user_score",
|
||||||
|
"(SELECT COUNT(id) from reviews re where re.is_from_critic = false and re.location_id = l.id) as user_count",
|
||||||
|
).
|
||||||
|
From("locations l").
|
||||||
|
Join("regencies re on re.id = l.regency_id").
|
||||||
|
Join("provinces pr on re.province_id = pr.id").
|
||||||
|
Limit(uint64(arg.Limit))
|
||||||
|
|
||||||
|
if arg.Regions != "" {
|
||||||
|
region := strings.Split(arg.Regions, ",")
|
||||||
|
sqlBuilder = sqlBuilder.Where(pgq.Eq{"re.id": region})
|
||||||
|
}
|
||||||
|
|
||||||
|
if arg.LocationTypes != "" {
|
||||||
|
locType := strings.Split(arg.LocationTypes, ",")
|
||||||
|
sqlBuilder = sqlBuilder.Where(pgq.Eq{"l.location_type": locType})
|
||||||
|
}
|
||||||
|
|
||||||
|
query, arguments, err := sqlBuilder.Where(pgq.NotEq{"approved_by": nil}).SQL()
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
rows, err := q.db.Query(ctx, query, arguments...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
items := []GetListRecentLocationsWithRatingsRow{}
|
||||||
|
for rows.Next() {
|
||||||
|
var i GetListRecentLocationsWithRatingsRow
|
||||||
|
if err := rows.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.Name,
|
||||||
|
&i.Thumbnail,
|
||||||
|
&i.LocationType,
|
||||||
|
&i.RegencyName,
|
||||||
|
&i.ProvinceName,
|
||||||
|
&i.CriticScore,
|
||||||
|
&i.CriticCount,
|
||||||
|
&i.UserScore,
|
||||||
|
&i.UserCount,
|
||||||
|
); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
items = append(items, i)
|
||||||
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return items, nil
|
||||||
|
}
|
||||||
|
|
||||||
type GetLocationRow struct {
|
type GetLocationRow struct {
|
||||||
ID int32 `json:"id"`
|
ID int32 `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
@ -126,26 +211,26 @@ type GetLocationRow struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var getLocationQ = `
|
var getLocationQ = `
|
||||||
SELECT
|
SELECT
|
||||||
l.id,
|
l.id,
|
||||||
name,
|
name,
|
||||||
l.address,
|
l.address,
|
||||||
COALESCE(re.regency_name, '') as regency_name,
|
COALESCE(re.regency_name, '') as regency_name,
|
||||||
COALESCE(prov.province_name, '') as province_name,
|
COALESCE(prov.province_name, '') as province_name,
|
||||||
COALESCE(reg.region_name, '') as region_name,
|
COALESCE(reg.region_name, '') as region_name,
|
||||||
COALESCE(l.google_maps_link, '') as google_maps_link,
|
COALESCE(l.google_maps_link, '') as google_maps_link,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
u.username as submitted_by,
|
u.username as submitted_by,
|
||||||
(SELECT COALESCE(SUM(score), 0) from reviews re where re.is_from_critic = true and re.location_id = l.id) as critic_score,
|
(SELECT COALESCE(SUM(score), 0) from reviews re where re.is_from_critic = true and re.location_id = l.id) as critic_score,
|
||||||
(SELECT COUNT(id) from reviews re where re.is_from_critic = true and re.location_id = l.id) as critic_count,
|
(SELECT COUNT(id) from reviews re where re.is_from_critic = true and re.location_id = l.id) as critic_count,
|
||||||
(SELECT COALESCE(SUM(score), 0) from reviews re where re.is_from_critic = false and re.location_id = l.id) as user_score,
|
(SELECT COALESCE(SUM(score), 0) from reviews re where re.is_from_critic = false and re.location_id = l.id) as user_score,
|
||||||
(SELECT COUNT(id) from reviews re where re.is_from_critic = false and re.location_id = l.id) as user_count
|
(SELECT COUNT(id) from reviews re where re.is_from_critic = false and re.location_id = l.id) as user_count
|
||||||
FROM locations l
|
FROM locations l
|
||||||
JOIN regencies re on re.id = l.regency_id
|
JOIN regencies re on re.id = l.regency_id
|
||||||
JOIN provinces prov on prov.id = re.province_id
|
JOIN provinces prov on prov.id = re.province_id
|
||||||
JOIN regions reg on reg.id = prov.region_id
|
JOIN regions reg on reg.id = prov.region_id
|
||||||
JOIN users u on u.id = l.submitted_by
|
JOIN users u on u.id = l.submitted_by
|
||||||
WHERE l.id = $1
|
WHERE l.id = $1
|
||||||
`
|
`
|
||||||
|
|
||||||
func (q *Queries) GetLocation(ctx context.Context, location_id int32) (GetLocationRow, error) {
|
func (q *Queries) GetLocation(ctx context.Context, location_id int32) (GetLocationRow, error) {
|
||||||
|
@ -50,67 +50,6 @@ func (q *Queries) GetListLocations(ctx context.Context) ([]Location, error) {
|
|||||||
return items, nil
|
return items, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
const getListRecentLocationsWithRatings = `-- name: GetListRecentLocationsWithRatings :many
|
|
||||||
SELECT
|
|
||||||
l.id,
|
|
||||||
name,
|
|
||||||
thumbnail,
|
|
||||||
COALESCE(re.regency_name, '') as regency_name,
|
|
||||||
COALESCE(pr.province_name, '') as province_name,
|
|
||||||
(SELECT COALESCE(SUM(score), 0) from reviews re where re.is_from_critic = true and re.location_id = l.id) as critic_score,
|
|
||||||
(SELECT COUNT(id) from reviews re where re.is_from_critic = true and re.location_id = l.id) as critic_count,
|
|
||||||
(SELECT COALESCE(SUM(score), 0) from reviews re where re.is_from_critic = false and re.location_id = l.id) as user_score,
|
|
||||||
(SELECT COUNT(id) from reviews re where re.is_from_critic = false and re.location_id = l.id) as user_count
|
|
||||||
FROM locations l
|
|
||||||
JOIN regencies re on re.id = l.regency_id
|
|
||||||
JOIN provinces pr on re.province_id = pr.id
|
|
||||||
WHERE approved_by IS NOT NULL
|
|
||||||
ORDER BY l.created_at ASC
|
|
||||||
LIMIT $1
|
|
||||||
`
|
|
||||||
|
|
||||||
type GetListRecentLocationsWithRatingsRow struct {
|
|
||||||
ID int32 `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Thumbnail pgtype.Text `json:"thumbnail"`
|
|
||||||
RegencyName string `json:"regency_name"`
|
|
||||||
ProvinceName string `json:"province_name"`
|
|
||||||
CriticScore interface{} `json:"critic_score"`
|
|
||||||
CriticCount int64 `json:"critic_count"`
|
|
||||||
UserScore interface{} `json:"user_score"`
|
|
||||||
UserCount int64 `json:"user_count"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (q *Queries) GetListRecentLocationsWithRatings(ctx context.Context, limit int32) ([]GetListRecentLocationsWithRatingsRow, error) {
|
|
||||||
rows, err := q.db.Query(ctx, getListRecentLocationsWithRatings, limit)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer rows.Close()
|
|
||||||
items := []GetListRecentLocationsWithRatingsRow{}
|
|
||||||
for rows.Next() {
|
|
||||||
var i GetListRecentLocationsWithRatingsRow
|
|
||||||
if err := rows.Scan(
|
|
||||||
&i.ID,
|
|
||||||
&i.Name,
|
|
||||||
&i.Thumbnail,
|
|
||||||
&i.RegencyName,
|
|
||||||
&i.ProvinceName,
|
|
||||||
&i.CriticScore,
|
|
||||||
&i.CriticCount,
|
|
||||||
&i.UserScore,
|
|
||||||
&i.UserCount,
|
|
||||||
); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
items = append(items, i)
|
|
||||||
}
|
|
||||||
if err := rows.Err(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return items, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
const getLocationTag = `-- name: GetLocationTag :many
|
const getLocationTag = `-- name: GetLocationTag :many
|
||||||
SELECT
|
SELECT
|
||||||
name
|
name
|
||||||
|
@ -19,7 +19,6 @@ type Querier interface {
|
|||||||
GetCountImageByLocation(ctx context.Context, imageOf int32) (int64, error)
|
GetCountImageByLocation(ctx context.Context, imageOf int32) (int64, error)
|
||||||
GetListLocations(ctx context.Context) ([]Location, error)
|
GetListLocations(ctx context.Context) ([]Location, error)
|
||||||
GetListProvinces(ctx context.Context) ([]GetListProvincesRow, error)
|
GetListProvinces(ctx context.Context) ([]GetListProvincesRow, error)
|
||||||
GetListRecentLocationsWithRatings(ctx context.Context, limit int32) ([]GetListRecentLocationsWithRatingsRow, error)
|
|
||||||
GetListRegencies(ctx context.Context) ([]GetListRegenciesRow, error)
|
GetListRegencies(ctx context.Context) ([]GetListRegenciesRow, error)
|
||||||
GetListRegions(ctx context.Context) ([]GetListRegionsRow, error)
|
GetListRegions(ctx context.Context) ([]GetListRegionsRow, error)
|
||||||
GetLocationTag(ctx context.Context, targetID int32) ([]string, error)
|
GetLocationTag(ctx context.Context, targetID int32) ([]string, error)
|
||||||
|
@ -21,6 +21,7 @@ type Store interface {
|
|||||||
CreateImage(ctx context.Context, arg []CreateImageParams) error
|
CreateImage(ctx context.Context, arg []CreateImageParams) error
|
||||||
CreateLocationTx(ctx context.Context, arg CreateLocationTxParams) error
|
CreateLocationTx(ctx context.Context, arg CreateLocationTxParams) error
|
||||||
GetNewsEventsList(ctx context.Context, arg GetNewsEventsListParams) ([]NewsEventRow, error)
|
GetNewsEventsList(ctx context.Context, arg GetNewsEventsListParams) ([]NewsEventRow, error)
|
||||||
|
GetListRecentLocationsWithRatings(ctx context.Context, arg GetListRecentLocationsParams) ([]GetListRecentLocationsWithRatingsRow, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type SQLStore struct {
|
type SQLStore struct {
|
||||||
|
1
go.mod
1
go.mod
@ -32,6 +32,7 @@ require (
|
|||||||
github.com/goccy/go-json v0.10.2 // indirect
|
github.com/goccy/go-json v0.10.2 // indirect
|
||||||
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
|
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
|
||||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||||
|
github.com/henvic/pgq v0.0.2 // indirect
|
||||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
|
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
|
||||||
github.com/jackc/puddle/v2 v2.2.1 // indirect
|
github.com/jackc/puddle/v2 v2.2.1 // indirect
|
||||||
|
2
go.sum
2
go.sum
@ -169,6 +169,8 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
|
|||||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||||
|
github.com/henvic/pgq v0.0.2 h1:4q/G/cW7zpxpwq672Xuh7BkcKcXonZJ6b9kR8ub3EwQ=
|
||||||
|
github.com/henvic/pgq v0.0.2/go.mod h1:1Q6dKMwtbe2glBXlusJvNZnJrvgbwub/KcfiB/7UXA4=
|
||||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||||
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
|
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
|
||||||
|
Loading…
Reference in New Issue
Block a user