Skip to content

Commit

Permalink
Add Swagger to Arda.Kanban
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabricio Catae committed Feb 2, 2017
1 parent 794e5e6 commit 0213e44
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/Arda.Kanban/Controllers/AppointmentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public IEnumerable<AppointmentViewModel> List()

[HttpGet]
[Route("listfromuser")]
public IEnumerable<AppointmentViewModel> ListFromUser(string user)
public IEnumerable<AppointmentViewModel> ListFromUser([FromQuery]string user)
{
try
{
Expand All @@ -95,7 +95,7 @@ public IEnumerable<AppointmentViewModel> ListFromUser(string user)

[HttpGet]
[Route("getappointmentbyid")]
public AppointmentViewModel GetAppointmentByID(Guid id)
public AppointmentViewModel GetAppointmentByID([FromQuery]Guid id)
{
try
{
Expand Down Expand Up @@ -146,7 +146,7 @@ public HttpResponseMessage EditAppointmentByID()

[HttpDelete]
[Route("deleteappointmentbyid")]
public HttpResponseMessage DeleteAppointmentByID(Guid id)
public HttpResponseMessage DeleteAppointmentByID([FromQuery]Guid id)
{
try
{
Expand Down
4 changes: 2 additions & 2 deletions src/Arda.Kanban/Controllers/FiscalYearController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public IEnumerable<FiscalYearViewModel> List()

[HttpGet]
[Route("getfiscalyearbyid")]
public FiscalYearViewModel GetFiscalYearByID(Guid id)
public FiscalYearViewModel GetFiscalYearByID([FromQuery]Guid id)
{
try
{
Expand Down Expand Up @@ -123,7 +123,7 @@ public HttpResponseMessage EditFiscalYearByID()

[HttpDelete]
[Route("deletefiscalyearbyid")]
public HttpResponseMessage DeleteFiscalYearByID(Guid id)
public HttpResponseMessage DeleteFiscalYearByID([FromQuery]Guid id)
{
try
{
Expand Down
6 changes: 3 additions & 3 deletions src/Arda.Kanban/Controllers/MetricController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public IEnumerable<MetricViewModel> List()

[HttpGet]
[Route("listbyyear")]
public IEnumerable<MetricViewModel> List(int year)
public IEnumerable<MetricViewModel> List([FromQuery]int year)
{
try
{
Expand All @@ -95,7 +95,7 @@ public IEnumerable<MetricViewModel> List(int year)

[HttpGet]
[Route("getmetricbyid")]
public MetricViewModel GetMetricByID(Guid id)
public MetricViewModel GetMetricByID([FromQuery]Guid id)
{
try
{
Expand Down Expand Up @@ -146,7 +146,7 @@ public HttpResponseMessage EditMetricByID()

[HttpDelete]
[Route("deletemetricbyid")]
public HttpResponseMessage DeleteMetricByID(Guid id)
public HttpResponseMessage DeleteMetricByID([FromQuery]Guid id)
{
try
{
Expand Down
6 changes: 3 additions & 3 deletions src/Arda.Kanban/Controllers/ReportController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public ReportController(IReportRepository repository)

[HttpGet]
[Route("getactivityconsumingdata")]
public IEnumerable<ActivityConsumingViewModel> GetActivityConsumingData(DateTime startDate, DateTime endDate, string user = "All")
public IEnumerable<ActivityConsumingViewModel> GetActivityConsumingData([FromQuery]DateTime startDate, [FromQuery] DateTime endDate, [FromQuery]string user = "All")
{
try
{
Expand All @@ -43,7 +43,7 @@ public IEnumerable<ActivityConsumingViewModel> GetActivityConsumingData(DateTime

[HttpGet]
[Route("getexpertiseconsumingdata")]
public IEnumerable<ExpertiseConsumingViewModel> GetExpertiseConsumingData(DateTime startDate, DateTime endDate, string user = "All")
public IEnumerable<ExpertiseConsumingViewModel> GetExpertiseConsumingData([FromQuery]DateTime startDate, [FromQuery]DateTime endDate, [FromQuery]string user = "All")
{
try
{
Expand All @@ -66,7 +66,7 @@ public IEnumerable<ExpertiseConsumingViewModel> GetExpertiseConsumingData(DateTi

[HttpGet]
[Route("getmetricconsumingdata")]
public IEnumerable<MetricConsumingViewModel> GetMetricConsumingData(DateTime startDate, DateTime endDate, string user = "All")
public IEnumerable<MetricConsumingViewModel> GetMetricConsumingData([FromQuery]DateTime startDate, [FromQuery]DateTime endDate, [FromQuery]string user = "All")
{
try
{
Expand Down
2 changes: 1 addition & 1 deletion src/Arda.Kanban/Controllers/UserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public HttpResponseMessage AddUser()

[HttpDelete]
[Route("delete")]
public HttpResponseMessage DeleteUser(string userID)
public HttpResponseMessage DeleteUser([FromQuery]string userID)
{
if (userID != null)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Arda.Kanban/Controllers/WorkloadController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public IEnumerable<WorkloadViewModel> List()

[HttpGet]
[Route("details")]
public WorkloadViewModel Details(Guid workloadID)
public WorkloadViewModel Details([FromQuery]Guid workloadID)
{
try
{
Expand Down Expand Up @@ -173,7 +173,7 @@ public HttpResponseMessage Edit()

[HttpDelete]
[Route("delete")]
public HttpResponseMessage Delete(Guid workloadID)
public HttpResponseMessage Delete([FromQuery]Guid workloadID)
{
try
{
Expand Down
12 changes: 12 additions & 0 deletions src/Arda.Kanban/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Arda.Kanban.Models;
using Arda.Common.Interfaces.Kanban;
using Arda.Kanban.Repositories;
using Swashbuckle.AspNetCore.Swagger;

namespace Arda.Kanban
{
Expand Down Expand Up @@ -73,6 +74,11 @@ public void ConfigureServices(IServiceCollection services)
services.AddScoped<IWorkloadRepository, WorkloadRepository>();
services.AddScoped<IAppointmentRepository, AppointmentRepository>();
services.AddScoped<IReportRepository, ReportRepository>();

services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info { Title = "Arda.Kanban", Version = "v1" });
});
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline
Expand All @@ -91,6 +97,12 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF

app.UseCors("AllowAll");

app.UseSwagger();
app.UseSwaggerUi(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Arda.Kanban v1");
});

app.UseMvc();
}

Expand Down
3 changes: 2 additions & 1 deletion src/Arda.Kanban/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"Microsoft.Extensions.Caching.Redis": "1.1.0-preview1-final",
"Newtonsoft.Json": "9.0.1",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
"Arda.Common": "1.0.0-*"
"Arda.Common": "1.0.0-*",
"Swashbuckle.AspNetCore": "1.0.0-rc1"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-*"
Expand Down

0 comments on commit 0213e44

Please sign in to comment.