diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c3981c --- /dev/null +++ b/.gitignore @@ -0,0 +1,70 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr +# User-specific stuff: +.idea/workspace.xml +.idea/tasks.xml +.idea/dictionaries +.idea/vcs.xml +.idea/jsLibraryMappings.xml +.idea/ + +# Sensitive or high-churn files: +.idea/dataSources.ids +.idea/dataSources.xml +.idea/dataSources.local.xml +.idea/sqlDataSources.xml +.idea/dynamic.xml +.idea/uiDesigner.xml + +# Gradle: +.idea/gradle.xml +.idea/libraries + +# Mongo Explorer plugin: +.idea/mongoSettings.xml + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ +*.iml +# modules.xml + +### VS Code ### +.vscode/ diff --git a/database_country.sql b/database_country.sql new file mode 100644 index 0000000..6065436 --- /dev/null +++ b/database_country.sql @@ -0,0 +1,257 @@ +-- -------------------------------------------------------- +-- Hôte: 127.0.0.1 +-- Version du serveur: 10.8.3-MariaDB - mariadb.org binary distribution +-- SE du serveur: Win64 +-- HeidiSQL Version: 11.3.0.6295 +-- -------------------------------------------------------- + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET NAMES utf8 */; +/*!50503 SET NAMES utf8mb4 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +-- Listage des données de la table world_country.countries : ~241 rows (environ) +/*!40000 ALTER TABLE `countries` DISABLE KEYS */; +INSERT INTO `countries` (`id`, `code`, `alpha2`, `alpha3`, `name_en`, `name_fr`) VALUES + (1, 4, 'AF', 'AFG', 'Afghanistan', 'Afghanistan'), + (2, 8, 'AL', 'ALB', 'Albania', 'Albanie'), + (3, 10, 'AQ', 'ATA', 'Antarctica', 'Antarctique'), + (4, 12, 'DZ', 'DZA', 'Algeria', 'Algérie'), + (5, 16, 'AS', 'ASM', 'American Samoa', 'Samoa Américaines'), + (6, 20, 'AD', 'AND', 'Andorra', 'Andorre'), + (7, 24, 'AO', 'AGO', 'Angola', 'Angola'), + (8, 28, 'AG', 'ATG', 'Antigua and Barbuda', 'Antigua-et-Barbuda'), + (9, 31, 'AZ', 'AZE', 'Azerbaijan', 'Azerbaïdjan'), + (10, 32, 'AR', 'ARG', 'Argentina', 'Argentine'), + (11, 36, 'AU', 'AUS', 'Australia', 'Australie'), + (12, 40, 'AT', 'AUT', 'Austria', 'Autriche'), + (13, 44, 'BS', 'BHS', 'Bahamas', 'Bahamas'), + (14, 48, 'BH', 'BHR', 'Bahrain', 'Bahreïn'), + (15, 50, 'BD', 'BGD', 'Bangladesh', 'Bangladesh'), + (16, 51, 'AM', 'ARM', 'Armenia', 'Arménie'), + (17, 52, 'BB', 'BRB', 'Barbados', 'Barbade'), + (18, 56, 'BE', 'BEL', 'Belgium', 'Belgique'), + (19, 60, 'BM', 'BMU', 'Bermuda', 'Bermudes'), + (20, 64, 'BT', 'BTN', 'Bhutan', 'Bhoutan'), + (21, 68, 'BO', 'BOL', 'Bolivia', 'Bolivie'), + (22, 70, 'BA', 'BIH', 'Bosnia and Herzegovina', 'Bosnie-Herzégovine'), + (23, 72, 'BW', 'BWA', 'Botswana', 'Botswana'), + (24, 74, 'BV', 'BVT', 'Bouvet Island', 'Île Bouvet'), + (25, 76, 'BR', 'BRA', 'Brazil', 'Brésil'), + (26, 84, 'BZ', 'BLZ', 'Belize', 'Belize'), + (27, 86, 'IO', 'IOT', 'British Indian Ocean Territory', 'Territoire Britannique de l\'Océan Indien'), + (28, 90, 'SB', 'SLB', 'Solomon Islands', 'Îles Salomon'), + (29, 92, 'VG', 'VGB', 'British Virgin Islands', 'Îles Vierges Britanniques'), + (30, 96, 'BN', 'BRN', 'Brunei Darussalam', 'Brunéi Darussalam'), + (31, 100, 'BG', 'BGR', 'Bulgaria', 'Bulgarie'), + (32, 104, 'MM', 'MMR', 'Myanmar', 'Myanmar'), + (33, 108, 'BI', 'BDI', 'Burundi', 'Burundi'), + (34, 112, 'BY', 'BLR', 'Belarus', 'Bélarus'), + (35, 116, 'KH', 'KHM', 'Cambodia', 'Cambodge'), + (36, 120, 'CM', 'CMR', 'Cameroon', 'Cameroun'), + (37, 124, 'CA', 'CAN', 'Canada', 'Canada'), + (38, 132, 'CV', 'CPV', 'Cape Verde', 'Cap-vert'), + (39, 136, 'KY', 'CYM', 'Cayman Islands', 'Îles Caïmanes'), + (40, 140, 'CF', 'CAF', 'Central African', 'République Centrafricaine'), + (41, 144, 'LK', 'LKA', 'Sri Lanka', 'Sri Lanka'), + (42, 148, 'TD', 'TCD', 'Chad', 'Tchad'), + (43, 152, 'CL', 'CHL', 'Chile', 'Chili'), + (44, 156, 'CN', 'CHN', 'China', 'Chine'), + (45, 158, 'TW', 'TWN', 'Taiwan', 'Taïwan'), + (46, 162, 'CX', 'CXR', 'Christmas Island', 'Île Christmas'), + (47, 166, 'CC', 'CCK', 'Cocos (Keeling) Islands', 'Îles Cocos (Keeling)'), + (48, 170, 'CO', 'COL', 'Colombia', 'Colombie'), + (49, 174, 'KM', 'COM', 'Comoros', 'Comores'), + (50, 175, 'YT', 'MYT', 'Mayotte', 'Mayotte'), + (51, 178, 'CG', 'COG', 'Republic of the Congo', 'République du Congo'), + (52, 180, 'CD', 'COD', 'The Democratic Republic Of The Congo', 'République Démocratique du Congo'), + (53, 184, 'CK', 'COK', 'Cook Islands', 'Îles Cook'), + (54, 188, 'CR', 'CRI', 'Costa Rica', 'Costa Rica'), + (55, 191, 'HR', 'HRV', 'Croatia', 'Croatie'), + (56, 192, 'CU', 'CUB', 'Cuba', 'Cuba'), + (57, 196, 'CY', 'CYP', 'Cyprus', 'Chypre'), + (58, 203, 'CZ', 'CZE', 'Czech Republic', 'République Tchèque'), + (59, 204, 'BJ', 'BEN', 'Benin', 'Bénin'), + (60, 208, 'DK', 'DNK', 'Denmark', 'Danemark'), + (61, 212, 'DM', 'DMA', 'Dominica', 'Dominique'), + (62, 214, 'DO', 'DOM', 'Dominican Republic', 'République Dominicaine'), + (63, 218, 'EC', 'ECU', 'Ecuador', 'Équateur'), + (64, 222, 'SV', 'SLV', 'El Salvador', 'El Salvador'), + (65, 226, 'GQ', 'GNQ', 'Equatorial Guinea', 'Guinée Équatoriale'), + (66, 231, 'ET', 'ETH', 'Ethiopia', 'Éthiopie'), + (67, 232, 'ER', 'ERI', 'Eritrea', 'Érythrée'), + (68, 233, 'EE', 'EST', 'Estonia', 'Estonie'), + (69, 234, 'FO', 'FRO', 'Faroe Islands', 'Îles Féroé'), + (70, 238, 'FK', 'FLK', 'Falkland Islands', 'Îles (malvinas) Falkland'), + (71, 239, 'GS', 'SGS', 'South Georgia and the South Sandwich Islands', 'Géorgie du Sud et les Îles Sandwich du Sud'), + (72, 242, 'FJ', 'FJI', 'Fiji', 'Fidji'), + (73, 246, 'FI', 'FIN', 'Finland', 'Finlande'), + (74, 248, 'AX', 'ALA', 'Åland Islands', 'Îles Åland'), + (75, 250, 'FR', 'FRA', 'France', 'France'), + (76, 254, 'GF', 'GUF', 'French Guiana', 'Guyane Française'), + (77, 258, 'PF', 'PYF', 'French Polynesia', 'Polynésie Française'), + (78, 260, 'TF', 'ATF', 'French Southern Territories', 'Terres Australes Françaises'), + (79, 262, 'DJ', 'DJI', 'Djibouti', 'Djibouti'), + (80, 266, 'GA', 'GAB', 'Gabon', 'Gabon'), + (81, 268, 'GE', 'GEO', 'Georgia', 'Géorgie'), + (82, 270, 'GM', 'GMB', 'Gambia', 'Gambie'), + (83, 275, 'PS', 'PSE', 'Occupied Palestinian Territory', 'Territoire Palestinien Occupé'), + (84, 276, 'DE', 'DEU', 'Germany', 'Allemagne'), + (85, 288, 'GH', 'GHA', 'Ghana', 'Ghana'), + (86, 292, 'GI', 'GIB', 'Gibraltar', 'Gibraltar'), + (87, 296, 'KI', 'KIR', 'Kiribati', 'Kiribati'), + (88, 300, 'GR', 'GRC', 'Greece', 'Grèce'), + (89, 304, 'GL', 'GRL', 'Greenland', 'Groenland'), + (90, 308, 'GD', 'GRD', 'Grenada', 'Grenade'), + (91, 312, 'GP', 'GLP', 'Guadeloupe', 'Guadeloupe'), + (92, 316, 'GU', 'GUM', 'Guam', 'Guam'), + (93, 320, 'GT', 'GTM', 'Guatemala', 'Guatemala'), + (94, 324, 'GN', 'GIN', 'Guinea', 'Guinée'), + (95, 328, 'GY', 'GUY', 'Guyana', 'Guyana'), + (96, 332, 'HT', 'HTI', 'Haiti', 'Haïti'), + (97, 334, 'HM', 'HMD', 'Heard Island and McDonald Islands', 'Îles Heard et Mcdonald'), + (98, 336, 'VA', 'VAT', 'Vatican City State', 'Saint-Siège (état de la Cité du Vatican)'), + (99, 340, 'HN', 'HND', 'Honduras', 'Honduras'), + (100, 344, 'HK', 'HKG', 'Hong Kong', 'Hong-Kong'), + (101, 348, 'HU', 'HUN', 'Hungary', 'Hongrie'), + (102, 352, 'IS', 'ISL', 'Iceland', 'Islande'), + (103, 356, 'IN', 'IND', 'India', 'Inde'), + (104, 360, 'ID', 'IDN', 'Indonesia', 'Indonésie'), + (105, 364, 'IR', 'IRN', 'Islamic Republic of Iran', 'République Islamique d\'Iran'), + (106, 368, 'IQ', 'IRQ', 'Iraq', 'Iraq'), + (107, 372, 'IE', 'IRL', 'Ireland', 'Irlande'), + (108, 376, 'IL', 'ISR', 'Israel', 'Israël'), + (109, 380, 'IT', 'ITA', 'Italy', 'Italie'), + (110, 384, 'CI', 'CIV', 'Côte d\'Ivoire', 'Côte d\'Ivoire'), + (111, 388, 'JM', 'JAM', 'Jamaica', 'Jamaïque'), + (112, 392, 'JP', 'JPN', 'Japan', 'Japon'), + (113, 398, 'KZ', 'KAZ', 'Kazakhstan', 'Kazakhstan'), + (114, 400, 'JO', 'JOR', 'Jordan', 'Jordanie'), + (115, 404, 'KE', 'KEN', 'Kenya', 'Kenya'), + (116, 408, 'KP', 'PRK', 'Democratic People\'s Republic of Korea', 'République Populaire Démocratique de Corée'), + (117, 410, 'KR', 'KOR', 'Republic of Korea', 'République de Corée'), + (118, 414, 'KW', 'KWT', 'Kuwait', 'Koweït'), + (119, 417, 'KG', 'KGZ', 'Kyrgyzstan', 'Kirghizistan'), + (120, 418, 'LA', 'LAO', 'Lao People\'s Democratic Republic', 'République Démocratique Populaire Lao'), + (121, 422, 'LB', 'LBN', 'Lebanon', 'Liban'), + (122, 426, 'LS', 'LSO', 'Lesotho', 'Lesotho'), + (123, 428, 'LV', 'LVA', 'Latvia', 'Lettonie'), + (124, 430, 'LR', 'LBR', 'Liberia', 'Libéria'), + (125, 434, 'LY', 'LBY', 'Libyan Arab Jamahiriya', 'Jamahiriya Arabe Libyenne'), + (126, 438, 'LI', 'LIE', 'Liechtenstein', 'Liechtenstein'), + (127, 440, 'LT', 'LTU', 'Lithuania', 'Lituanie'), + (128, 442, 'LU', 'LUX', 'Luxembourg', 'Luxembourg'), + (129, 446, 'MO', 'MAC', 'Macao', 'Macao'), + (130, 450, 'MG', 'MDG', 'Madagascar', 'Madagascar'), + (131, 454, 'MW', 'MWI', 'Malawi', 'Malawi'), + (132, 458, 'MY', 'MYS', 'Malaysia', 'Malaisie'), + (133, 462, 'MV', 'MDV', 'Maldives', 'Maldives'), + (134, 466, 'ML', 'MLI', 'Mali', 'Mali'), + (135, 470, 'MT', 'MLT', 'Malta', 'Malte'), + (136, 474, 'MQ', 'MTQ', 'Martinique', 'Martinique'), + (137, 478, 'MR', 'MRT', 'Mauritania', 'Mauritanie'), + (138, 480, 'MU', 'MUS', 'Mauritius', 'Maurice'), + (139, 484, 'MX', 'MEX', 'Mexico', 'Mexique'), + (140, 492, 'MC', 'MCO', 'Monaco', 'Monaco'), + (141, 496, 'MN', 'MNG', 'Mongolia', 'Mongolie'), + (142, 498, 'MD', 'MDA', 'Republic of Moldova', 'République de Moldova'), + (143, 500, 'MS', 'MSR', 'Montserrat', 'Montserrat'), + (144, 504, 'MA', 'MAR', 'Morocco', 'Maroc'), + (145, 508, 'MZ', 'MOZ', 'Mozambique', 'Mozambique'), + (146, 512, 'OM', 'OMN', 'Oman', 'Oman'), + (147, 516, 'NA', 'NAM', 'Namibia', 'Namibie'), + (148, 520, 'NR', 'NRU', 'Nauru', 'Nauru'), + (149, 524, 'NP', 'NPL', 'Nepal', 'Népal'), + (150, 528, 'NL', 'NLD', 'Netherlands', 'Pays-Bas'), + (151, 530, 'AN', 'ANT', 'Netherlands Antilles', 'Antilles Néerlandaises'), + (152, 533, 'AW', 'ABW', 'Aruba', 'Aruba'), + (153, 540, 'NC', 'NCL', 'New Caledonia', 'Nouvelle-Calédonie'), + (154, 548, 'VU', 'VUT', 'Vanuatu', 'Vanuatu'), + (155, 554, 'NZ', 'NZL', 'New Zealand', 'Nouvelle-Zélande'), + (156, 558, 'NI', 'NIC', 'Nicaragua', 'Nicaragua'), + (157, 562, 'NE', 'NER', 'Niger', 'Niger'), + (158, 566, 'NG', 'NGA', 'Nigeria', 'Nigéria'), + (159, 570, 'NU', 'NIU', 'Niue', 'Niué'), + (160, 574, 'NF', 'NFK', 'Norfolk Island', 'Île Norfolk'), + (161, 578, 'NO', 'NOR', 'Norway', 'Norvège'), + (162, 580, 'MP', 'MNP', 'Northern Mariana Islands', 'Îles Mariannes du Nord'), + (163, 581, 'UM', 'UMI', 'United States Minor Outlying Islands', 'Îles Mineures Éloignées des États-Unis'), + (164, 583, 'FM', 'FSM', 'Federated States of Micronesia', 'États Fédérés de Micronésie'), + (165, 584, 'MH', 'MHL', 'Marshall Islands', 'Îles Marshall'), + (166, 585, 'PW', 'PLW', 'Palau', 'Palaos'), + (167, 586, 'PK', 'PAK', 'Pakistan', 'Pakistan'), + (168, 591, 'PA', 'PAN', 'Panama', 'Panama'), + (169, 598, 'PG', 'PNG', 'Papua New Guinea', 'Papouasie-Nouvelle-Guinée'), + (170, 600, 'PY', 'PRY', 'Paraguay', 'Paraguay'), + (171, 604, 'PE', 'PER', 'Peru', 'Pérou'), + (172, 608, 'PH', 'PHL', 'Philippines', 'Philippines'), + (173, 612, 'PN', 'PCN', 'Pitcairn', 'Pitcairn'), + (174, 616, 'PL', 'POL', 'Poland', 'Pologne'), + (175, 620, 'PT', 'PRT', 'Portugal', 'Portugal'), + (176, 624, 'GW', 'GNB', 'Guinea-Bissau', 'Guinée-Bissau'), + (177, 626, 'TL', 'TLS', 'Timor-Leste', 'Timor-Leste'), + (178, 630, 'PR', 'PRI', 'Puerto Rico', 'Porto Rico'), + (179, 634, 'QA', 'QAT', 'Qatar', 'Qatar'), + (180, 638, 'RE', 'REU', 'Réunion', 'Réunion'), + (181, 642, 'RO', 'ROU', 'Romania', 'Roumanie'), + (182, 643, 'RU', 'RUS', 'Russian Federation', 'Fédération de Russie'), + (183, 646, 'RW', 'RWA', 'Rwanda', 'Rwanda'), + (184, 654, 'SH', 'SHN', 'Saint Helena', 'Sainte-Hélène'), + (185, 659, 'KN', 'KNA', 'Saint Kitts and Nevis', 'Saint-Kitts-et-Nevis'), + (186, 660, 'AI', 'AIA', 'Anguilla', 'Anguilla'), + (187, 662, 'LC', 'LCA', 'Saint Lucia', 'Sainte-Lucie'), + (188, 666, 'PM', 'SPM', 'Saint-Pierre and Miquelon', 'Saint-Pierre-et-Miquelon'), + (189, 670, 'VC', 'VCT', 'Saint Vincent and the Grenadines', 'Saint-Vincent-et-les Grenadines'), + (190, 674, 'SM', 'SMR', 'San Marino', 'Saint-Marin'), + (191, 678, 'ST', 'STP', 'Sao Tome and Principe', 'Sao Tomé-et-Principe'), + (192, 682, 'SA', 'SAU', 'Saudi Arabia', 'Arabie Saoudite'), + (193, 686, 'SN', 'SEN', 'Senegal', 'Sénégal'), + (194, 690, 'SC', 'SYC', 'Seychelles', 'Seychelles'), + (195, 694, 'SL', 'SLE', 'Sierra Leone', 'Sierra Leone'), + (196, 702, 'SG', 'SGP', 'Singapore', 'Singapour'), + (197, 703, 'SK', 'SVK', 'Slovakia', 'Slovaquie'), + (198, 704, 'VN', 'VNM', 'Vietnam', 'Viet Nam'), + (199, 705, 'SI', 'SVN', 'Slovenia', 'Slovénie'), + (200, 706, 'SO', 'SOM', 'Somalia', 'Somalie'), + (201, 710, 'ZA', 'ZAF', 'South Africa', 'Afrique du Sud'), + (202, 716, 'ZW', 'ZWE', 'Zimbabwe', 'Zimbabwe'), + (203, 724, 'ES', 'ESP', 'Spain', 'Espagne'), + (204, 732, 'EH', 'ESH', 'Western Sahara', 'Sahara Occidental'), + (205, 736, 'SD', 'SDN', 'Sudan', 'Soudan'), + (206, 740, 'SR', 'SUR', 'Suriname', 'Suriname'), + (207, 744, 'SJ', 'SJM', 'Svalbard and Jan Mayen', 'Svalbard etÎle Jan Mayen'), + (208, 748, 'SZ', 'SWZ', 'Swaziland', 'Swaziland'), + (209, 752, 'SE', 'SWE', 'Sweden', 'Suède'), + (210, 756, 'CH', 'CHE', 'Switzerland', 'Suisse'), + (211, 760, 'SY', 'SYR', 'Syrian Arab Republic', 'République Arabe Syrienne'), + (212, 762, 'TJ', 'TJK', 'Tajikistan', 'Tadjikistan'), + (213, 764, 'TH', 'THA', 'Thailand', 'Thaïlande'), + (214, 768, 'TG', 'TGO', 'Togo', 'Togo'), + (215, 772, 'TK', 'TKL', 'Tokelau', 'Tokelau'), + (216, 776, 'TO', 'TON', 'Tonga', 'Tonga'), + (217, 780, 'TT', 'TTO', 'Trinidad and Tobago', 'Trinité-et-Tobago'), + (218, 784, 'AE', 'ARE', 'United Arab Emirates', 'Émirats Arabes Unis'), + (219, 788, 'TN', 'TUN', 'Tunisia', 'Tunisie'), + (220, 792, 'TR', 'TUR', 'Turkey', 'Turquie'), + (221, 795, 'TM', 'TKM', 'Turkmenistan', 'Turkménistan'), + (222, 796, 'TC', 'TCA', 'Turks and Caicos Islands', 'Îles Turks et Caïques'), + (223, 798, 'TV', 'TUV', 'Tuvalu', 'Tuvalu'), + (224, 800, 'UG', 'UGA', 'Uganda', 'Ouganda'), + (225, 804, 'UA', 'UKR', 'Ukraine', 'Ukraine'), + (226, 807, 'MK', 'MKD', 'The Former Yugoslav Republic of Macedonia', 'L\'ex-République Yougoslave de Macédoine'), + (227, 818, 'EG', 'EGY', 'Egypt', 'Égypte'), + (228, 826, 'GB', 'GBR', 'United Kingdom', 'Royaume-Uni'), + (229, 833, 'IM', 'IMN', 'Isle of Man', 'Île de Man'), + (230, 834, 'TZ', 'TZA', 'United Republic Of Tanzania', 'République-Unie de Tanzanie'), + (231, 840, 'US', 'USA', 'United States', 'États-Unis'), + (232, 850, 'VI', 'VIR', 'U.S. Virgin Islands', 'Îles Vierges des États-Unis'), + (233, 854, 'BF', 'BFA', 'Burkina Faso', 'Burkina Faso'), + (234, 858, 'UY', 'URY', 'Uruguay', 'Uruguay'), + (235, 860, 'UZ', 'UZB', 'Uzbekistan', 'Ouzbékistan'), + (236, 862, 'VE', 'VEN', 'Venezuela', 'Venezuela'), + (237, 876, 'WF', 'WLF', 'Wallis and Futuna', 'Wallis et Futuna'), + (238, 882, 'WS', 'WSM', 'Samoa', 'Samoa'), + (239, 887, 'YE', 'YEM', 'Yemen', 'Yémen'), + (240, 891, 'CS', 'SCG', 'Serbia and Montenegro', 'Serbie-et-Monténégro'), + (241, 894, 'ZM', 'ZMB', 'Zambia', 'Zambie'); diff --git a/nbactions.tmp b/nbactions.tmp new file mode 100644 index 0000000..1410308 --- /dev/null +++ b/nbactions.tmp @@ -0,0 +1,46 @@ + + + + run + + jar + + + spring-boot:run + + + -noverify -XX:TieredStopAtLevel=1 + com.github.geoffreylgv.apiworldcountries.ApiworldcountriesApplication + always + + + + debug + + jar + + + spring-boot:run + + + -Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -noverify -XX:TieredStopAtLevel=1 + com.github.geoffreylgv.apiworldcountries.ApiworldcountriesApplication + always + true + + + + profile + + jar + + + process-classes + org.codehaus.mojo:exec-maven-plugin:1.2.1:exec + + + -classpath %classpath com.github.geoffreylgv.apiworldcountries.ApiworldcountriesApplication + java + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..86413c8 --- /dev/null +++ b/pom.xml @@ -0,0 +1,98 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.7.1 + + + com.github.geoffreylgv + apiworldcountries + jar + 0.0.1-SNAPSHOT + apiworldcountries + World Countries API + + 1.8 + 2021.0.3 + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.cloud + spring-cloud-starter-bootstrap + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + mysql + mysql-connector-java + runtime + + + io.springfox + springfox-swagger2 + 2.9.2 + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + org.jetbrains + annotations + RELEASE + compile + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + diff --git a/src/main/java/com/github/geoffreylgv/ApiworldcountriesApplication.java b/src/main/java/com/github/geoffreylgv/ApiworldcountriesApplication.java new file mode 100644 index 0000000..4c23948 --- /dev/null +++ b/src/main/java/com/github/geoffreylgv/ApiworldcountriesApplication.java @@ -0,0 +1,18 @@ +package com.github.geoffreylgv; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * + * @author geoffreylgv < geoffrey.logovi@studentambassadors.com; geoffreylogovi2@gmail.com + * > + */ +@SpringBootApplication +public class ApiworldcountriesApplication { + + public static void main(String[] args) { + SpringApplication.run(ApiworldcountriesApplication.class, args); + } + +} diff --git a/src/main/java/com/github/geoffreylgv/controller/CountryController.java b/src/main/java/com/github/geoffreylgv/controller/CountryController.java new file mode 100644 index 0000000..e2d5297 --- /dev/null +++ b/src/main/java/com/github/geoffreylgv/controller/CountryController.java @@ -0,0 +1,62 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.github.geoffreylgv.controller; + +import com.github.geoffreylgv.entity.Country; +import com.github.geoffreylgv.repository.CountryRepository; +import java.util.List; +import java.util.Optional; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +/** + * + * @author geoffreylgv < geoffrey.logovi@studentambassadors.com; + * geoffreylogovi2@gmail.com + */ +@RestController +@RequestMapping(value = "/api/country/v1/countries") +public class CountryController { + + @Autowired + CountryRepository countryRepo; + + //get all countries + @GetMapping("/") + public ResponseEntity getAll() { + List listCountry = countryRepo.findAll(); + if (!listCountry.isEmpty()) { + return new ResponseEntity(listCountry, HttpStatus.OK); + } + return new ResponseEntity("Not found error", HttpStatus.NOT_FOUND); + } + + //get country by id + @GetMapping("/{id}") + public ResponseEntity getCountryById(@PathVariable("id") Long id) { + Optional listCountry = countryRepo.findById(id); + return listCountry.map(c -> new ResponseEntity<>(c, HttpStatus.OK)) + .orElse(new ResponseEntity("Country Not Found !", HttpStatus.NOT_FOUND)); + } + + //get country by name + @GetMapping("/by/name") + public ResponseEntity getCountryByName(@RequestParam(value = "name") String search) { + return new ResponseEntity<>(countryRepo.findLikeName(search), HttpStatus.OK); + } + + //get country by any libelle searched + @GetMapping("/by/occurence") + public ResponseEntity getCountryByOccurenceSearched(@RequestParam(value = "search") String search) { + return new ResponseEntity<>(countryRepo.findCountryLikeLibelleSearch(search), HttpStatus.OK); + } +} diff --git a/src/main/java/com/github/geoffreylgv/entity/Country.java b/src/main/java/com/github/geoffreylgv/entity/Country.java new file mode 100644 index 0000000..037412b --- /dev/null +++ b/src/main/java/com/github/geoffreylgv/entity/Country.java @@ -0,0 +1,50 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.github.geoffreylgv.entity; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.ToString; + +/** + * + * @author geoffreylgv < geoffrey.logovi@studentambassadors.com; geoffreylogovi2@gmail.com + * > + */ +@Entity +@Data +@ToString +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode +@Table(name = "COUNTRIES") +public class Country implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "ID") + private Long id; + + @Column(name = "CODE", nullable = false, unique = true) + private String code; + @Column(name = "NAME_FR", nullable = false) + private String nameFR; + @Column(name = "NAME_EN", nullable = false) + private String nameEN; + @Column(name = "ALPHA2", nullable = false) + private String alpha2; + @Column(name = "ALPHA3", nullable = false) + private String alpha3; +} diff --git a/src/main/java/com/github/geoffreylgv/repository/CountryRepository.java b/src/main/java/com/github/geoffreylgv/repository/CountryRepository.java new file mode 100644 index 0000000..d9acadd --- /dev/null +++ b/src/main/java/com/github/geoffreylgv/repository/CountryRepository.java @@ -0,0 +1,33 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.github.geoffreylgv.repository; + +import com.github.geoffreylgv.entity.Country; +import java.util.List; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +/** + * + * @author geoffreylgv < geoffrey.logovi@studentambassadors.com; + * geoffreylogovi2@gmail.com + */ +@Repository +public interface CountryRepository extends JpaRepository { + + //find countries search like name + @Query(value = "select c from Country c " + + "where c.nameEN like %:name% or c.nameFR like %:name% ") + public List findLikeName(@Param("name") String name); + + //find countries by any search, just enter a libelle and it will return countries of match + @Query(value = "select * from countries c where c.name_en like %:search% " + + "or c.name_fr like %:search% or c.alpha2 like %:search% " + + "or c.code like %:search% or c.alpha3 like %:search% ", nativeQuery = true) + public List findCountryLikeLibelleSearch(@Param("search") String search); +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..d3ac411 --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,8 @@ + +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.url=jdbc:mysql://localhost:3307/world_country?autoReconnect=true&useSSL=false&serverTimezone=UTC +spring.datasource.username=root +spring.datasource.password=root +spring.jpa.hibernate.ddl-auto = update +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL57Dialect +server.port=8090 \ No newline at end of file