Skip to content

Commit test for Coveo, Swagger URL Access should look like this http:/… #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added code/SearchService/.vs/SearchService/v14/.suo
Binary file not shown.
1,039 changes: 1,039 additions & 0 deletions code/SearchService/.vs/config/applicationhost.config

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions code/SearchService/.vs/restore.dg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#:C:\Users\achouan\Source\Repos\backend-coding-challenge\code\SearchService\src\SearchService\SearchService.xproj
33 changes: 33 additions & 0 deletions code/SearchService/SearchService.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EAF95D2C-4E84-4E08-87CC-5DD6C2F65AF2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{457E4156-1DCF-4389-961B-42C04B17FE7B}"
ProjectSection(SolutionItems) = preProject
..\..\data\cities_canada-usa.tsv = ..\..\data\cities_canada-usa.tsv
global.json = global.json
EndProjectSection
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SearchService", "src\SearchService\SearchService.xproj", "{A57C4803-82B8-4DCE-BDC7-CE19EC961E1C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A57C4803-82B8-4DCE-BDC7-CE19EC961E1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A57C4803-82B8-4DCE-BDC7-CE19EC961E1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A57C4803-82B8-4DCE-BDC7-CE19EC961E1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A57C4803-82B8-4DCE-BDC7-CE19EC961E1C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{A57C4803-82B8-4DCE-BDC7-CE19EC961E1C} = {EAF95D2C-4E84-4E08-87CC-5DD6C2F65AF2}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions code/SearchService/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-003131"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using CsvHelper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using SearchService.Model;
using SearchService.Services.Interfaces;

// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860

namespace SearchService.Controllers
{
[Route("api/[controller]")]
public class SuggestionsController : Controller
{

private readonly ICityService _cityService;

public SuggestionsController(ICityService cityService)
{
_cityService = cityService;
}

[Route("")]
[HttpGet]
public List<CityResult> Get(string q, double? longitude, double? latitude)
{
return _cityService.Search(q, longitude, latitude);
}
}
}
51 changes: 51 additions & 0 deletions code/SearchService/src/SearchService/Model/City.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading.Tasks;

namespace SearchService.Model
{
[DataContract()]
public class City
{
[DataMember(Name = "id")]
public int Id { get; set; }
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "ascii")]
public string Ascii { get; set; }
[DataMember(Name = "alt_name")]
public string Alt_Name { get; set; }
[DataMember(Name = "lat")]
public double? Lat { get; set; }
[DataMember(Name = "long")]
public double? Long { get; set; }
[DataMember(Name = "feat_class")]
public string Feat_class { get; set; }
[DataMember(Name = "feat_code")]
public string Feat_code { get; set; }
[DataMember(Name = "country")]
public string Country { get; set; }
[DataMember(Name = "cc2")]
public string Cc2 { get; set; }
[DataMember(Name = "admin1")]
public string Admin1 { get; set; }
[DataMember(Name = "admin2")]
public string Admin2 { get; set; }
[DataMember(Name = "admin3")]
public string Admin3 { get; set; }
[DataMember(Name = "admin4")]
public string Admin4 { get; set; }
[DataMember(Name = "population")]
public string Population { get; set; }
[DataMember(Name = "elevation")]
public string Elevation { get; set; }
[DataMember(Name = "dem")]
public string Dem { get; set; }
[DataMember(Name = "tz")]
public string Tz { get; set; }
[DataMember(Name = "modified_At")]
public string Modified_At { get; set; }
}
}
15 changes: 15 additions & 0 deletions code/SearchService/src/SearchService/Model/CityResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace SearchService.Model
{
public class CityResult
{
public string Name { get; set; }
public double Longitude { get; set; }
public double Latitude { get; set; }
public double Score { get; set; }
}
}
12 changes: 12 additions & 0 deletions code/SearchService/src/SearchService/Model/WebSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace SearchService.Model
{
public class WebSettings
{
public string LocationsFilePath { get; set; }
}
}
25 changes: 25 additions & 0 deletions code/SearchService/src/SearchService/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;

namespace SearchService
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();

host.Run();
}
}
}
187 changes: 187 additions & 0 deletions code/SearchService/src/SearchService/Project_Readme.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Welcome to ASP.NET Core</title>
<style>
html {
background: #f1f1f1;
height: 100%;
}

body {
background: #fff;
color: #505050;
font: 14px 'Segoe UI', tahoma, arial, helvetica, sans-serif;
margin: 1%;
min-height: 95.5%;
border: 1px solid silver;
position: relative;
}

#header {
padding: 0;
}

#header h1 {
font-size: 44px;
font-weight: normal;
margin: 0;
padding: 10px 30px 10px 30px;
}

#header span {
margin: 0;
padding: 0 30px;
display: block;
}

#header p {
font-size: 20px;
color: #fff;
background: #007acc;
padding: 0 30px;
line-height: 50px;
margin-top: 25px;

}

#header p a {
color: #fff;
text-decoration: underline;
font-weight: bold;
padding-right: 35px;
background: no-repeat right bottom url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAWCAMAAAAcqPc3AAAANlBMVEUAAAAAeswfitI9mthXp91us+KCvuaTx+mjz+2x1u+83PLH4vTR5/ba7Pjj8Pns9fv1+v3////wy3dWAAAAAXRSTlMAQObYZgAAAHxJREFUeNp9kVcSwCAIRMHUYoH7XzaxOxJ9P8oyQ1uIqNPwh3s2aLmIM2YtqrLcQIeQEylhuCeUOlhgve5yoBCfWmlnlgkN4H8ykbpaE7gR03AbUHiwoOxUH9Xp+ubd41p1HF3mBPrfC87BHeTdaB3ceeKL9HGpcvX9zu6+DdMWT9KQPvYAAAAASUVORK5CYII=);
}

#main {
padding: 5px 30px;
clear: both;
}

.section {
width: 21.7%;
float: left;
margin: 0 0 0 4%;
}

.section h2 {
font-size: 13px;
text-transform: uppercase;
margin: 0;
border-bottom: 1px solid silver;
padding-bottom: 12px;
margin-bottom: 8px;
}

.section.first {
margin-left: 0;
}

.section.first h2 {
font-size: 24px;
text-transform: none;
margin-bottom: 25px;
border: none;
}

.section.first li {
border-top: 1px solid silver;
padding: 8px 0;
}

.section.last {
margin-right: 0;
}

ul {
list-style: none;
padding: 0;
margin: 0;
line-height: 20px;
}

li {
padding: 4px 0;
}

a {
color: #267cb2;
text-decoration: none;
}

a:hover {
text-decoration: underline;
}

#footer {
clear: both;
padding-top: 50px;
}

#footer p {
position: absolute;
bottom: 10px;
}
</style>
</head>
<body>

<div id="header">
<h1>Welcome to ASP.NET Core</h1>
<span>
We've made some big updates in this release, so it’s <b>important</b> that you spend
a few minutes to learn what’s new.
</span>
<p>You've created a new ASP.NET Core project. <a href="http://go.microsoft.com/fwlink/?LinkId=518016">Learn what's new</a></p>
</div>

<div id="main">
<div class="section first">
<h2>This application consists of:</h2>
<ul>
<li>Sample pages using ASP.NET Core MVC</li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> for managing client-side libraries</li>
<li>Theming using <a href="http://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
</ul>
</div>
<div class="section">
<h2>How to</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398600">Add a Controller and View</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699562">Add an appsetting in config and access it in app.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699318">Add client packages using Bower.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a></li>
</ul>
</div>
<div class="section">
<h2>Overview</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET Core</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET Core such as Startup and middleware.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398603">Security</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a></li>
</ul>
</div>
<div class="section last">
<h2>Run & Deploy</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517853">Run tools such as EF migrations and more</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a></li>
</ul>
</div>

<div id="footer">
<p>We would love to hear your <a href="http://go.microsoft.com/fwlink/?LinkId=518015">feedback</a></p>
</div>
</div>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[cmdletbinding(SupportsShouldProcess=$true)]
param($publishProperties=@{}, $packOutput, $pubProfilePath)

# to learn more about this file visit https://go.microsoft.com/fwlink/?LinkId=524327

try{
if ($publishProperties['ProjectGuid'] -eq $null){
$publishProperties['ProjectGuid'] = 'a57c4803-82b8-4dce-bdc7-ce19ec961e1c'
}

$publishModulePath = Join-Path (Split-Path $MyInvocation.MyCommand.Path) 'publish-module.psm1'
Import-Module $publishModulePath -DisableNameChecking -Force

# call Publish-AspNet to perform the publish operation
Publish-AspNet -publishProperties $publishProperties -packOutput $packOutput -pubProfilePath $pubProfilePath
}
catch{
"An error occurred during publish.`n{0}" -f $_.Exception.Message | Write-Error
}
Loading