Commit 7fb4f8d6 authored by Benedikt Heinrichs's avatar Benedikt Heinrichs

New: Add new Project Parameters

parent 456937ad
......@@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Routing;
using Moq;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
......@@ -48,7 +49,10 @@ namespace Coscine.Api.Project.Tests
{
Description = "Description",
Organization = "Organization",
DisplayName = "TestProject"
DisplayName = "TestProject",
StartDate = DateTime.Now,
EndDate = DateTime.Now.AddYears(1),
Keywords = "Test1;Test2"
};
projectModel.Insert(project);
......@@ -61,7 +65,10 @@ namespace Coscine.Api.Project.Tests
{
Description = "Description2",
Organization = "Organization2",
DisplayName = "TestProject2"
DisplayName = "TestProject2",
StartDate = DateTime.Now,
EndDate = DateTime.Now.AddYears(1),
Keywords = "Test1;Test2"
};
projectModel.Insert(project2);
projects.Add(projectModel.GetById(project2.Id));
......
......@@ -46,8 +46,8 @@
<Reference Include="Coscine.Configuration, Version=1.4.0.0, Culture=neutral, PublicKeyToken=ce3d7a32d7dc1e5a, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Configuration.1.4.0\lib\net461\Coscine.Configuration.dll</HintPath>
</Reference>
<Reference Include="Coscine.Database, Version=1.2.2.0, Culture=neutral, PublicKeyToken=767d77427707b70a, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Database.1.2.2\lib\net461\Coscine.Database.dll</HintPath>
<Reference Include="Coscine.Database, Version=1.3.0.0, Culture=neutral, PublicKeyToken=767d77427707b70a, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Database.1.3.0\lib\net461\Coscine.Database.dll</HintPath>
</Reference>
<Reference Include="linq2db, Version=2.6.4.0, Culture=neutral, PublicKeyToken=e41013125f9e410a, processorArchitecture=MSIL">
<HintPath>..\packages\linq2db.2.6.4\lib\net46\linq2db.dll</HintPath>
......
using NUnit.Framework;
using Coscine.Api.Project.Controllers;
using Microsoft.AspNetCore.Mvc;
using static Coscine.Api.Project.Controllers.ProjectController;
using Coscine.Api.Project.Models;
using System.Collections.Generic;
using Coscine.Database.Model;
using System.Linq;
using Moq;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Controllers;
using Coscine.Api.Project.ReturnObjects;
using Newtonsoft.Json;
using Coscine.Api.Project.Factories;
using System.IO;
using System;
......@@ -67,6 +57,9 @@ namespace Coscine.Api.Project.Tests
Assert.IsTrue(projectObject.Description == projects[0].Description);
Assert.IsTrue(projectObject.DisplayName == projects[0].DisplayName);
Assert.IsTrue(projectObject.Organization == projects[0].Organization);
Assert.IsTrue(projectObject.StartDate == projects[0].StartDate);
Assert.IsTrue(projectObject.EndDate == projects[0].EndDate);
Assert.IsTrue(projectObject.Keywords == projects[0].Keywords);
}
......@@ -110,7 +103,7 @@ namespace Coscine.Api.Project.Tests
[Test]
public void TestControllerStore()
{
ProjectObject newProjectObject = new ProjectObject(System.Guid.NewGuid(), "NewProject", "NewDisplayName", "NewOrganisation");
ProjectObject newProjectObject = new ProjectObject(System.Guid.NewGuid(), "NewProject", "NewDisplayName", "NewOrganisation", DateTime.Now, DateTime.Now.AddYears(1), "test2;test3");
var stream = ObjectFactory<ProjectObject>.SerializeToStream(newProjectObject);
......@@ -127,6 +120,9 @@ namespace Coscine.Api.Project.Tests
Assert.IsTrue(createdProjectObject.Description == newProjectObject.Description);
Assert.IsTrue(createdProjectObject.DisplayName == newProjectObject.DisplayName);
Assert.IsTrue(createdProjectObject.Organization == newProjectObject.Organization);
Assert.IsTrue(createdProjectObject.StartDate == newProjectObject.StartDate);
Assert.IsTrue(createdProjectObject.EndDate == newProjectObject.EndDate);
Assert.IsTrue(createdProjectObject.Keywords == newProjectObject.Keywords);
// Cleanup
stream.Close();
......
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
......
......@@ -3,18 +3,10 @@ using Coscine.Api.Project.Exceptions;
using Coscine.Api.Project.Factories;
using Coscine.Api.Project.Models;
using Coscine.Api.Project.ReturnObjects;
using Coscine.Database.Model;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Controllers;
using Moq;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.Tests
{
......
......@@ -3,7 +3,7 @@
<package id="Castle.Core" version="4.4.0" targetFramework="net472" />
<package id="Consul" version="0.7.2.6" targetFramework="net472" />
<package id="Coscine.Configuration" version="1.4.0" targetFramework="net472" />
<package id="Coscine.Database" version="1.2.2" targetFramework="net472" />
<package id="Coscine.Database" version="1.3.0" targetFramework="net472" />
<package id="linq2db" version="2.6.4" targetFramework="net472" />
<package id="linq2db.SqlServer" version="2.6.4" targetFramework="net472" />
<package id="linq2db.t4models" version="2.6.4" targetFramework="net472" />
......
......@@ -2,10 +2,7 @@
using Coscine.Database.Model;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project
{
......
......@@ -30,7 +30,7 @@ namespace Coscine.Api.Project.Controllers
select projectRole).Any()
).Select((project) =>
{
return new ProjectObject(project.Id, project.Description, project.DisplayName, project.Organization);
return new ProjectObject(project.Id, project.Description, project.DisplayName, project.Organization, project.StartDate, project.EndDate, project.Keywords);
});
}));
}
......@@ -42,7 +42,7 @@ namespace Coscine.Api.Project.Controllers
{
ProjectModel projectModel = new ProjectModel();
var project = projectModel.GetById(Guid.Parse(id));
return new ProjectObject(project.Id, project.Description, project.DisplayName, project.Organization);
return new ProjectObject(project.Id, project.Description, project.DisplayName, project.Organization, project.StartDate, project.EndDate, project.Keywords);
}));
}
......@@ -73,7 +73,7 @@ namespace Coscine.Api.Project.Controllers
ProjectObject projectObject = ObjectFactory<ProjectObject>.DeserializeFromStream(Request.Body);
ProjectModel projectModel = new ProjectModel();
var project = projectModel.StoreFromObject(projectObject, user);
return new ProjectObject(project.Id, project.Description, project.DisplayName, project.Organization);
return new ProjectObject(project.Id, project.Description, project.DisplayName, project.Organization, project.StartDate, project.EndDate, project.Keywords);
}));
}
}
......
......@@ -4,10 +4,7 @@ using Coscine.Api.Project.Models;
using Coscine.Api.Project.ReturnObjects;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.Controllers
{
......
using Coscine.Configuration;
using Coscine.Database.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project
{
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.Exceptions
{
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.Exceptions
{
......
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
using Coscine.Api.Project.ReturnObjects;
using System.IO;
using Newtonsoft.Json;
namespace Coscine.Api.Project.Factories
......
......@@ -7,7 +7,6 @@ using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project
{
......
......@@ -6,8 +6,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.Models
{
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Coscine.Api.Project.Exceptions;
using Coscine.Api.Project.ReturnObjects;
using Coscine.Database.Model;
using LinqToDB;
......@@ -24,7 +20,10 @@ namespace Coscine.Api.Project.Models
{
Description = projectObject.Description,
DisplayName = projectObject.DisplayName,
Organization = projectObject.Organization
Organization = projectObject.Organization,
StartDate = projectObject.StartDate,
EndDate = projectObject.EndDate,
Keywords = projectObject.Keywords,
};
Insert(project);
SetOwner(project, user);
......@@ -79,6 +78,9 @@ namespace Coscine.Api.Project.Models
project.Description = projectObject.Description;
project.DisplayName = projectObject.DisplayName;
project.Organization = projectObject.Organization;
project.StartDate = projectObject.StartDate;
project.EndDate = projectObject.EndDate;
project.Keywords = projectObject.Keywords;
return Update(project);
}
......
using Coscine.Database.Model;
using LinqToDB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.Models
{
......
......@@ -2,11 +2,8 @@
using Coscine.Database.Model;
using LinqToDB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.Models
{
......
using Coscine.Database.Model;
using LinqToDB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.Models
{
......
using Coscine.Database.Model;
using LinqToDB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.Models
{
......
using Coscine.Api.Project.Exceptions;
using Coscine.Database.Model;
using Coscine.Database.Model;
using LinqToDB;
using System;
using System.Linq;
using System.Linq.Expressions;
namespace Coscine.Api.Project.Models
......
......@@ -48,8 +48,8 @@
<Reference Include="Coscine.Configuration, Version=1.4.0.0, Culture=neutral, PublicKeyToken=ce3d7a32d7dc1e5a, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Configuration.1.4.0\lib\net461\Coscine.Configuration.dll</HintPath>
</Reference>
<Reference Include="Coscine.Database, Version=1.2.2.0, Culture=neutral, PublicKeyToken=767d77427707b70a, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Database.1.2.2\lib\net461\Coscine.Database.dll</HintPath>
<Reference Include="Coscine.Database, Version=1.3.0.0, Culture=neutral, PublicKeyToken=767d77427707b70a, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Database.1.3.0\lib\net461\Coscine.Database.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.ReturnObjects
{
......@@ -15,13 +11,19 @@ namespace Coscine.Api.Project.ReturnObjects
public string Description { get; set; }
public string DisplayName { get; set; }
public string Organization { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public string Keywords { get; set; }
public ProjectObject(Guid id, string description, string displayName, string organisation)
public ProjectObject(Guid id, string description, string displayName, string organisation, DateTime startDate, DateTime endDate, string keywords)
{
Id = id;
Description = description;
DisplayName = displayName;
Organization = organisation;
StartDate = startDate;
EndDate = endDate;
Keywords = keywords;
}
}
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.ReturnObjects
{
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.ReturnObjects
{
......
......@@ -4,7 +4,7 @@
<package id="AutoMapper.Extensions.Microsoft.DependencyInjection" version="6.0.0" targetFramework="net472" />
<package id="Consul" version="0.7.2.6" targetFramework="net472" />
<package id="Coscine.Configuration" version="1.4.0" targetFramework="net472" />
<package id="Coscine.Database" version="1.2.2" targetFramework="net472" />
<package id="Coscine.Database" version="1.3.0" targetFramework="net472" />
<package id="EntityFramework" version="6.2.0" targetFramework="net472" />
<package id="linq2db" version="2.6.4" targetFramework="net472" />
<package id="linq2db.SqlServer" version="2.6.4" targetFramework="net472" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment