forked from ebhomengo/niki
1
0
Fork 0

feat(service): Get all cities

This commit is contained in:
mohammad mahdi rezaei 2024-01-18 13:46:36 +03:30
parent 3d9590000e
commit bd0a2084d7
8 changed files with 1042 additions and 2 deletions

View File

@ -0,0 +1,22 @@
package benefactorbasehandler
import (
"net/http"
addressparam "git.gocasts.ir/ebhomengo/niki/param/benefactor/address"
httpmsg "git.gocasts.ir/ebhomengo/niki/pkg/http_msg"
"github.com/labstack/echo/v4"
)
func (h Handler) GetAllCities(c echo.Context) error {
var req addressparam.GetAllCitiesRequest
listCities, err := h.addressSvc.GetAllCities(c.Request().Context(), req)
if err != nil {
msg, code := httpmsg.Error(err)
return echo.NewHTTPError(code, msg)
}
return c.JSON(http.StatusOK, listCities)
}

View File

@ -6,4 +6,5 @@ func (h Handler) SetRoutes(e *echo.Echo) {
r := e.Group("/base")
r.GET("/provinces", h.GetAllProvinces)
r.GET("/cities", h.GetAllCities)
}

View File

@ -0,0 +1,10 @@
package addressparam
import "git.gocasts.ir/ebhomengo/niki/entity"
type (
GetAllCitiesRequest struct{}
GetAllCitiesResponse struct {
Cities []entity.City `json:"cities"`
}
)

View File

@ -0,0 +1,51 @@
package mysqladdress
import (
"context"
"time"
"git.gocasts.ir/ebhomengo/niki/entity"
errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg"
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
"git.gocasts.ir/ebhomengo/niki/repository/mysql"
)
func (d DB) GetAllCities(ctx context.Context) ([]entity.City, error) {
const op = "mysqladdress.GetAllCities"
cities := make([]entity.City, 0)
rows, err := d.conn.Conn().QueryContext(ctx, `SELECT * FROM cities;`)
if err != nil {
return nil, richerror.New(op).WithErr(err).
WithMessage(errmsg.ErrorMsgSomethingWentWrong).WithKind(richerror.KindUnexpected)
}
defer rows.Close()
for rows.Next() {
city, err := scanCity(rows)
if err != nil {
return nil, richerror.New(op).WithErr(err).
WithMessage(errmsg.ErrorMsgSomethingWentWrong).WithKind(richerror.KindUnexpected)
}
cities = append(cities, city)
}
if err := rows.Err(); err != nil {
return nil, richerror.New(op).WithErr(err).
WithMessage(errmsg.ErrorMsgSomethingWentWrong).WithKind(richerror.KindUnexpected)
}
return cities, nil
}
func scanCity(scanner mysql.Scanner) (entity.City, error) {
var createdAt time.Time
var city entity.City
err := scanner.Scan(&city.ID, &city.ProvinceID, &city.Name, &createdAt)
return city, err
}

View File

@ -11,7 +11,7 @@ import (
)
func (d DB) GetAllProvinces(ctx context.Context) ([]entity.Province, error) {
const op = "mysqladdress.IsExistAddressByID"
const op = "mysqladdress.GetAllProvinces"
provinces := make([]entity.Province, 0)

View File

@ -1,8 +1,8 @@
-- +migrate Up
CREATE TABLE `cities` (
`id` INT PRIMARY KEY AUTO_INCREMENT,
`name` VARCHAR(191) NOT NULL,
`province_id` INT NOT NULL,
`name` VARCHAR(191) NOT NULL,
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (`province_id`) REFERENCES `provinces`(`id`)
);

View File

@ -0,0 +1,944 @@
-- +migrate Up
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (1, 1, 'آذرشهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (2, 1, 'اسکو');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (3, 1, 'اهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (4, 1, 'بستان آباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (5, 1, 'بناب');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (6, 1, 'تبریز');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (7, 1, ' جلفا');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (8, 1, ' چار اویماق');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (9, 1, ' سراب');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (10, 1, ' شبستر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (11, 1, ' عجبشیر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (12, 1, ' کلیبر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (13, 1, ' مراغه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (14, 1, ' مرند');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (15, 1, ' ملکان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (16, 1, ' میانه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (17, 1, ' ورزقان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (18, 1, ' هریس');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (19, 1, 'هشترود');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (20, 2, ' ارومیه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (21, 2, ' اشنویه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (22, 2, ' بوکان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (23, 2, ' پیرانشهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (24, 2, ' تکاب');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (25, 2, ' چالدران');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (26, 2, ' خوی');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (27, 2, ' سردشت');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (28, 2, ' سلماس');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (29, 2, ' شاهین دژ');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (30, 2, ' ماکو');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (31, 2, ' مهاباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (32, 2, ' میاندوآب');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (33, 2, ' نقده');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (34, 3, ' اردبیل');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (35, 3, ' بیله سوار');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (36, 3, ' پارس آباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (37, 3, ' خلخال');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (38, 3, ' کوثر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (39, 3, ' گرمی');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (40, 3, ' مشگین');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (41, 3, ' نمین');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (42, 3, ' نیر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (43, 4, ' آران و بیدگل');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (44, 4, ' اردستان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (45, 4, ' اصفهان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (46, 4, ' برخوار و میمه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (47, 4, ' تیران و کرون');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (48, 4, ' چادگان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (49, 4, ' خمینی شهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (50, 4, ' خوانسار');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (51, 4, ' سمیرم');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (52, 4, ' شاهین شهر و میمه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (53, 4, ' شهر رضا');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (54, 4, 'دهاقان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (55, 4, ' فریدن');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (56, 4, ' فریدون شهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (57, 4, ' فلاورجان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (58, 4, ' کاشان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (59, 4, ' گلپایگان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (60, 4, ' لنجان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (61, 4, ' مبارکه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (62, 4, ' نائین');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (63, 4, ' نجف آباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (64, 4, ' نطنز');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (65, 5, ' ساوجبلاق');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (66, 5, ' کرج');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (67, 5, ' نظرآباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (68, 5, 'طالقان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (69, 6, ' آبدانان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (70, 6, ' ایلام');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (71, 6, ' ایوان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (72, 6, ' دره شهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (73, 6, ' دهلران');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (74, 6, ' شیران و چرداول');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (75, 6, ' مهران');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (76, 7, ' بوشهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (77, 7, ' تنگستان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (78, 7, ' جم');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (79, 7, ' دشتستان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (80, 7, ' دشتی');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (81, 7, ' دیر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (82, 7, ' دیلم');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (83, 7, ' کنگان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (84, 7, ' گناوه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (85, 8, ' اسلام شهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (86, 8, ' پاکدشت');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (87, 8, ' تهران');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (88, 8, ' دماوند');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (89, 8, ' رباط کریم');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (90, 8, ' ری');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (91, 8, ' شمیرانات');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (92, 8, ' شهریار');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (93, 8, ' فیروزکوه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (94, 8, ' ورامین');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (95, 9, ' اردل');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (96, 9, ' بروجن');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (97, 9, ' شهرکرد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (98, 9, ' فارسان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (99, 9, ' کوهرنگ');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (100, 9, ' لردگان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (101, 10, ' بیرجند');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (102, 10, ' درمیان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (103, 10, ' سرایان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (104, 10, ' سر بیشه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (105, 10, ' فردوس');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (106, 10, ' قائن');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (107, 10, ' نهبندان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (108, 11, ' برد سکن');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (109, 11, ' بجستان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (110, 11, ' تایباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (111, 11, ' تحت جلگه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (112, 11, ' تربت جام');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (113, 11, ' تربت حیدریه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (114, 11, ' چناران');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (115, 11, ' جغتای');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (116, 11, ' جوین');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (117, 11, ' خلیل آباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (118, 11, ' خواف');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (119, 11, ' درگز');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (120, 11, ' رشتخوار');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (121, 11, ' زاوه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (122, 11, ' سبزوار');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (123, 11, ' سرخس');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (124, 11, ' فریمان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (125, 11, ' قوچان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (126, 11, 'طرقبه شاندیز');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (127, 11, ' کاشمر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (128, 11, ' کلات');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (129, 11, ' گناباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (130, 11, ' مشهد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (131, 11, ' مه ولات');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (132, 11, ' نیشابور');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (133, 12, ' اسفراین');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (134, 12, ' بجنورد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (135, 12, ' جاجرم');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (136, 12, ' شیروان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (137, 12, ' فاروج');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (138, 12, ' مانه و سملقان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (139, 13, ' آبادان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (140, 13, ' امیدیه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (141, 13, ' اندیمشک');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (142, 13, ' اهواز');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (143, 13, ' ایذه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (144, 13, ' باغ ملک');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (145, 13, ' بندرماهشهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (146, 13, ' بهبهان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (147, 13, ' خرمشهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (148, 13, ' دزفول');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (149, 13, ' دشت آزادگان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (150, 13, ' رامشیر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (151, 13, ' رامهرمز');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (152, 13, ' شادگان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (153, 13, ' شوش');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (154, 13, ' شوشتر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (155, 13, ' گتوند');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (156, 13, ' لالی');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (157, 13, ' مسجد سلیمان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (158, 13, ' هندیجان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (159, 14, ' ابهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (160, 14, ' ایجرود');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (161, 14, ' خدابنده');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (162, 14, ' خرمدره');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (163, 14, ' زنجان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (164, 14, ' طارم');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (165, 14, ' ماه نشان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (166, 15, ' دامغان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (167, 15, ' سمنان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (168, 15, ' شاهرود');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (169, 15, ' گرمسار');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (170, 15, ' مهدی شهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (171, 16, ' ایرانشهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (172, 16, ' چابهار');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (173, 16, ' خاش');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (174, 16, ' دلگان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (175, 16, ' زابل');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (176, 16, ' زاهدان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (177, 16, ' زهک');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (178, 16, ' سراوان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (179, 16, ' سرباز');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (180, 16, ' کنارک');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (181, 16, ' نیکشهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (182, 17, ' آباده');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (183, 17, ' ارسنجان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (184, 17, ' استهبان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (185, 17, ' اقلید');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (186, 17, ' بوانات');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (187, 17, ' پاسارگاد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (188, 17, ' جهرم');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (189, 17, ' خرم بید');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (190, 17, ' خنج');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (191, 17, ' داراب');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (192, 17, ' زرین دشت');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (193, 17, ' سپیدان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (194, 17, ' شیراز');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (195, 17, ' فراشبند');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (196, 17, ' فسا');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (197, 17, ' فیروزآباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (198, 17, ' قیر و کارزین');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (199, 17, ' کازرون');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (200, 17, ' لارستان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (201, 17, ' لامرد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (202, 17, ' مرودشت');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (203, 17, ' ممسنی');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (204, 17, ' مهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (205, 17, ' نی ریز');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (206, 18, ' آبیک');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (207, 18, ' البرز');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (208, 18, ' بوئین زهرا');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (209, 18, ' تاکستان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (210, 18, ' قزوین');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (211, 19, ' قم');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (212, 20, ' بانه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (213, 20, ' بیجار');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (214, 20, ' دیواندره');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (215, 20, ' سروآباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (216, 20, ' سقز');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (217, 20, ' سنندج');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (218, 20, ' قروه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (219, 20, ' کامیاران');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (220, 20, ' مریوان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (221, 21, ' بافت');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (222, 21, ' بردسیر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (223, 21, ' بم');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (224, 21, ' جیرفت');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (225, 21, ' راور');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (226, 21, ' رفسنجان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (227, 21, ' رودبار جنوب');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (228, 21, ' زرند');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (229, 21, ' سیرجان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (230, 21, ' شهر بابک');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (231, 21, ' عنبرآباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (232, 21, ' قلعه گنج');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (233, 21, ' کرمان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (234, 21, ' کوهبنان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (235, 21, ' کهنوج');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (236, 21, ' منوجان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (237, 22, ' اسلام آباد غرب');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (238, 22, ' پاوه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (239, 22, ' ثلاث باباجانی');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (240, 22, ' جوانرود');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (241, 22, ' دالاهو');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (242, 22, ' روانسر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (243, 22, ' سرپل ذهاب');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (244, 22, ' سنقر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (245, 22, ' صحنه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (246, 22, ' قصر شیرین');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (247, 22, ' کرمانشاه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (248, 22, ' کنگاور');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (249, 22, ' گیلان غرب');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (250, 22, ' هرسین');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (251, 23, ' بویر احمد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (252, 23, ' بهمئی');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (253, 23, ' دنا');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (254, 23, ' کهگیلویه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (255, 23, ' گچساران');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (256, 24, ' آزادشهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (257, 24, ' آق قلا');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (258, 24, ' بندر گز');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (259, 24, ' بندر ترکمن');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (260, 24, ' رامیان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (261, 24, ' علی آباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (262, 24, ' کرد کوی');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (263, 24, ' کلاله');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (264, 24, ' گرگان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (265, 24, ' گنبد کاووس');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (266, 24, ' مینو دشت');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (267, 25, ' آستارا');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (268, 25, ' آستانه اشرفیه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (269, 25, ' املش');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (270, 25, ' بندر انزلی');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (271, 25, ' رشت');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (272, 25, ' رضوانشهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (273, 25, ' رودبار');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (274, 25, ' رودسر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (275, 25, ' سیاهکل');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (276, 25, ' شفت');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (277, 25, ' صومعه سرا');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (278, 25, ' طوالش');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (279, 25, ' فومن');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (280, 25, ' لاهیجان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (281, 25, ' لنگرود');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (282, 25, ' ماسال');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (283, 26, ' ازنا');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (284, 26, ' الیگودرز');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (285, 26, ' بروجرد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (286, 26, ' پلدختر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (287, 26, ' خرم آباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (288, 26, ' دورود');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (289, 17, ' لامرد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (290, 17, ' مرودشت');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (291, 17, ' ممسنی');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (292, 17, ' مهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (293, 17, ' نی ریز');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (294, 18, ' آبیک');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (295, 18, ' البرز');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (296, 18, ' بوئین زهرا');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (297, 18, ' تاکستان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (298, 18, ' قزوین');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (299, 19, ' قم');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (300, 20, ' بانه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (301, 20, ' بیجار');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (302, 20, ' دیواندره');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (303, 20, ' سروآباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (304, 20, ' سقز');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (305, 20, ' سنندج');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (306, 20, ' قروه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (307, 20, ' کامیاران');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (308, 20, ' مریوان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (309, 21, ' بافت');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (310, 21, ' بردسیر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (311, 21, ' بم');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (312, 21, ' جیرفت');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (313, 21, ' راور');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (314, 21, ' رفسنجان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (315, 21, ' رودبار جنوب');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (316, 21, ' زرند');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (317, 21, ' سیرجان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (318, 21, ' شهر بابک');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (319, 21, ' عنبرآباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (320, 21, ' قلعه گنج');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (321, 21, ' کرمان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (322, 21, ' کوهبنان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (323, 21, ' کهنوج');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (324, 21, ' منوجان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (325, 22, ' اسلام آباد غرب');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (326, 22, ' پاوه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (327, 22, ' ثلاث باباجانی');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (328, 22, ' جوانرود');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (329, 22, ' دالاهو');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (330, 22, ' روانسر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (332, 22, ' سنقر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (333, 22, ' صحنه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (334, 22, ' قصر شیرین');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (335, 22, ' کرمانشاه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (336, 22, ' کنگاور');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (337, 22, ' گیلان غرب');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (338, 22, ' هرسین');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (339, 23, ' بویر احمد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (341, 23, ' دنا');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (343, 23, ' گچساران');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (344, 24, ' آزادشهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (345, 24, ' آق قلا');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (346, 24, ' بندر گز');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (347, 24, ' بندر ترکمن');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (348, 24, ' رامیان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (349, 24, ' علی آباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (350, 24, ' کرد کوی');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (351, 24, ' کلاله');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (352, 24, ' گرگان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (353, 24, ' گنبد کاووس');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (354, 24, ' مینو دشت');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (355, 25, ' آستارا');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (356, 25, ' آستانه اشرفیه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (357, 25, ' املش');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (358, 25, ' بندر انزلی');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (359, 25, ' رشت');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (360, 25, ' رضوانشهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (361, 25, ' رودبار');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (362, 25, ' رودسر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (363, 25, ' سیاهکل');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (364, 25, ' شفت');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (365, 25, ' صومعه سرا');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (366, 25, ' طوالش');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (367, 25, ' فومن');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (368, 25, ' لاهیجان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (369, 25, ' لنگرود');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (370, 25, ' ماسال');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (371, 26, ' ازنا');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (372, 26, ' الیگودرز');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (373, 26, ' بروجرد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (374, 26, ' پلدختر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (375, 26, ' خرم آباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (376, 26, ' دورود');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (377, 26, ' دلفان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (378, 26, ' سلسله');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (379, 26, ' کوهدشت');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (380, 26, ' الشتر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (381, 26, ' نورآباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (382, 27, ' آمل');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (383, 27, ' بابل');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (384, 27, ' بابلسر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (385, 27, ' بهشهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (386, 27, ' تنکابن');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (387, 27, ' جویبار');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (388, 27, ' چالوس');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (389, 27, ' رامسر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (390, 27, ' ساری');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (391, 27, ' سوادکوه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (392, 27, ' قائم شهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (393, 27, ' گلوگاه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (394, 27, ' محمود آباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (395, 27, ' نکا');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (396, 27, ' نور');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (397, 27, ' نوشهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (398, 27, ' فریدونکنار');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (399, 28, ' آشتیان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (400, 28, ' اراک');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (401, 28, ' تفرش');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (402, 28, ' خمین');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (403, 28, ' دلیجان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (404, 28, ' زرندیه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (405, 28, ' ساوه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (406, 28, ' شازند');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (407, 28, ' کمیجان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (408, 28, ' محلات');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (409, 29, ' بندرعباس');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (410, 29, ' میناب');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (411, 29, ' بندر لنگه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (412, 29, ' رودان-دهبارز');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (413, 29, ' جاسک');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (414, 29, ' قشم');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (415, 29, ' حاجی آباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (416, 29, ' ابوموسی');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (417, 29, ' بستک');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (418, 29, ' گاوبندی');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (419, 29, ' خمیر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (420, 30, ' اسدآباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (421, 30, ' بهار');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (422, 30, ' تویسرکان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (423, 30, ' رزن');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (424, 30, ' کبودر آهنگ');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (425, 30, ' ملایر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (426, 30, ' نهاوند');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (427, 30, ' همدان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (428, 31, ' ابرکوه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (429, 31, ' اردکان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (430, 31, ' بافق');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (431, 31, ' تفت');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (432, 31, ' خاتم');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (433, 31, ' صدوق');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (434, 31, ' طبس');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (435, 31, ' مهریز');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (436, 31, ' میبد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (437, 31, ' یزد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (438, 8, 'قرچک');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (439, 8, 'گلستان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (440, 8, 'قدس');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (441, 8, 'ملارد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (442, 8, 'نسیم‌شهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (443, 8, 'اندیشه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (444, 8, 'صالح‌آباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (445, 8, 'باقرشهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (446, 8, 'باغستان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (447, 8, 'بومهن');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (448, 8, 'چهاردانگه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (449, 8, 'پیشوا');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (450, 8, 'پردیس');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (451, 8, 'وحیدیه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (452, 8, 'نصیرآباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (453, 8, 'فردوسیه');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (454, 8, 'حسن‌آباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (455, 8, 'رودهن');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (456, 8, 'شاهدشهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (457, 8, 'صباشهر');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (458, 8, 'صفادشت');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (459, 8, 'لواسان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (460, 8, 'آبسرد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (461, 8, 'شریف‌آباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (462, 8, 'کهریزک');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (463, 8, 'فشم');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (464, 8, 'جوادآباد');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (465, 8, 'کیلان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (466, 8, 'آبعلی');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (467, 8, 'ارجمند');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (468, 29, 'کیش');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (469, 29, 'لاوان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (470, 29, 'پارسیان');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (471, 29, 'سیریک');
INSERT INTO `cities` (`id`, `province_id`, `name`)
VALUES (472, 29, 'بشاگرد');
-- +migrate Down
DELETE
FROM `cities`
WHERE id BETWEEN '1' AND '472';

View File

@ -12,6 +12,7 @@ type Repository interface {
CreateBenefactorAddress(ctx context.Context, address entity.Address) (entity.Address, error)
GetAddressByID(ctx context.Context, id uint) (*entity.Address, error)
GetAllProvinces(ctx context.Context) ([]entity.Province, error)
GetAllCities(ctx context.Context) ([]entity.City, error)
}
type Service struct {
@ -62,3 +63,14 @@ func (s Service) GetAllProvinces(ctx context.Context, _ param.GetAllProvincesReq
return param.GetAllProvincesResponse{Provinces: provinces}, nil
}
func (s Service) GetAllCities(ctx context.Context, _ param.GetAllCitiesRequest) (param.GetAllCitiesResponse, error) {
const op = "benefactoraddressservice.GetAllCities"
Cities, err := s.repo.GetAllCities(ctx)
if err != nil {
return param.GetAllCitiesResponse{}, richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected)
}
return param.GetAllCitiesResponse{Cities: Cities}, nil
}