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

New: Add new Project Parameters

parent 456937ad
...@@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Mvc.Controllers; ...@@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
...@@ -48,7 +49,10 @@ namespace Coscine.Api.Project.Tests ...@@ -48,7 +49,10 @@ namespace Coscine.Api.Project.Tests
{ {
Description = "Description", Description = "Description",
Organization = "Organization", Organization = "Organization",
DisplayName = "TestProject" DisplayName = "TestProject",
StartDate = DateTime.Now,
EndDate = DateTime.Now.AddYears(1),
Keywords = "Test1;Test2"
}; };
projectModel.Insert(project); projectModel.Insert(project);
...@@ -61,7 +65,10 @@ namespace Coscine.Api.Project.Tests ...@@ -61,7 +65,10 @@ namespace Coscine.Api.Project.Tests
{ {
Description = "Description2", Description = "Description2",
Organization = "Organization2", Organization = "Organization2",
DisplayName = "TestProject2" DisplayName = "TestProject2",
StartDate = DateTime.Now,
EndDate = DateTime.Now.AddYears(1),
Keywords = "Test1;Test2"
}; };
projectModel.Insert(project2); projectModel.Insert(project2);
projects.Add(projectModel.GetById(project2.Id)); projects.Add(projectModel.GetById(project2.Id));
......
...@@ -46,8 +46,8 @@ ...@@ -46,8 +46,8 @@
<Reference Include="Coscine.Configuration, Version=1.4.0.0, Culture=neutral, PublicKeyToken=ce3d7a32d7dc1e5a, processorArchitecture=MSIL"> <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> <HintPath>..\packages\Coscine.Configuration.1.4.0\lib\net461\Coscine.Configuration.dll</HintPath>
</Reference> </Reference>
<Reference Include="Coscine.Database, Version=1.2.2.0, Culture=neutral, PublicKeyToken=767d77427707b70a, processorArchitecture=MSIL"> <Reference Include="Coscine.Database, Version=1.3.0.0, Culture=neutral, PublicKeyToken=767d77427707b70a, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Database.1.2.2\lib\net461\Coscine.Database.dll</HintPath> <HintPath>..\packages\Coscine.Database.1.3.0\lib\net461\Coscine.Database.dll</HintPath>
</Reference> </Reference>
<Reference Include="linq2db, Version=2.6.4.0, Culture=neutral, PublicKeyToken=e41013125f9e410a, processorArchitecture=MSIL"> <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> <HintPath>..\packages\linq2db.2.6.4\lib\net46\linq2db.dll</HintPath>
......
using NUnit.Framework; using NUnit.Framework;
using Coscine.Api.Project.Controllers; using Coscine.Api.Project.Controllers;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using static Coscine.Api.Project.Controllers.ProjectController;
using Coscine.Api.Project.Models; using Coscine.Api.Project.Models;
using System.Collections.Generic;
using Coscine.Database.Model;
using System.Linq; 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 Coscine.Api.Project.ReturnObjects;
using Newtonsoft.Json;
using Coscine.Api.Project.Factories; using Coscine.Api.Project.Factories;
using System.IO; using System.IO;
using System; using System;
...@@ -67,6 +57,9 @@ namespace Coscine.Api.Project.Tests ...@@ -67,6 +57,9 @@ namespace Coscine.Api.Project.Tests
Assert.IsTrue(projectObject.Description == projects[0].Description); Assert.IsTrue(projectObject.Description == projects[0].Description);
Assert.IsTrue(projectObject.DisplayName == projects[0].DisplayName); Assert.IsTrue(projectObject.DisplayName == projects[0].DisplayName);
Assert.IsTrue(projectObject.Organization == projects[0].Organization); 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 ...@@ -110,7 +103,7 @@ namespace Coscine.Api.Project.Tests
[Test] [Test]
public void TestControllerStore() 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); var stream = ObjectFactory<ProjectObject>.SerializeToStream(newProjectObject);
...@@ -127,6 +120,9 @@ namespace Coscine.Api.Project.Tests ...@@ -127,6 +120,9 @@ namespace Coscine.Api.Project.Tests
Assert.IsTrue(createdProjectObject.Description == newProjectObject.Description); Assert.IsTrue(createdProjectObject.Description == newProjectObject.Description);
Assert.IsTrue(createdProjectObject.DisplayName == newProjectObject.DisplayName); Assert.IsTrue(createdProjectObject.DisplayName == newProjectObject.DisplayName);
Assert.IsTrue(createdProjectObject.Organization == newProjectObject.Organization); 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 // Cleanup
stream.Close(); stream.Close();
......
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
......
...@@ -3,18 +3,10 @@ using Coscine.Api.Project.Exceptions; ...@@ -3,18 +3,10 @@ using Coscine.Api.Project.Exceptions;
using Coscine.Api.Project.Factories; using Coscine.Api.Project.Factories;
using Coscine.Api.Project.Models; using Coscine.Api.Project.Models;
using Coscine.Api.Project.ReturnObjects; using Coscine.Api.Project.ReturnObjects;
using Coscine.Database.Model;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Controllers;
using Moq;
using NUnit.Framework; using NUnit.Framework;
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.Tests namespace Coscine.Api.Project.Tests
{ {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<package id="Castle.Core" version="4.4.0" targetFramework="net472" /> <package id="Castle.Core" version="4.4.0" targetFramework="net472" />
<package id="Consul" version="0.7.2.6" 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.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" version="2.6.4" targetFramework="net472" />
<package id="linq2db.SqlServer" 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" /> <package id="linq2db.t4models" version="2.6.4" targetFramework="net472" />
......
...@@ -2,10 +2,7 @@ ...@@ -2,10 +2,7 @@
using Coscine.Database.Model; using Coscine.Database.Model;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project namespace Coscine.Api.Project
{ {
......
...@@ -30,7 +30,7 @@ namespace Coscine.Api.Project.Controllers ...@@ -30,7 +30,7 @@ namespace Coscine.Api.Project.Controllers
select projectRole).Any() select projectRole).Any()
).Select((project) => ).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 ...@@ -42,7 +42,7 @@ namespace Coscine.Api.Project.Controllers
{ {
ProjectModel projectModel = new ProjectModel(); ProjectModel projectModel = new ProjectModel();
var project = projectModel.GetById(Guid.Parse(id)); 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 ...@@ -73,7 +73,7 @@ namespace Coscine.Api.Project.Controllers
ProjectObject projectObject = ObjectFactory<ProjectObject>.DeserializeFromStream(Request.Body); ProjectObject projectObject = ObjectFactory<ProjectObject>.DeserializeFromStream(Request.Body);
ProjectModel projectModel = new ProjectModel(); ProjectModel projectModel = new ProjectModel();
var project = projectModel.StoreFromObject(projectObject, user); 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; ...@@ -4,10 +4,7 @@ using Coscine.Api.Project.Models;
using Coscine.Api.Project.ReturnObjects; using Coscine.Api.Project.ReturnObjects;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.Controllers namespace Coscine.Api.Project.Controllers
{ {
......
using Coscine.Configuration; using Coscine.Configuration;
using Coscine.Database.Model; using Coscine.Database.Model;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project namespace Coscine.Api.Project
{ {
......
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.Exceptions namespace Coscine.Api.Project.Exceptions
{ {
......
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.Exceptions namespace Coscine.Api.Project.Exceptions
{ {
......
using System; using System.IO;
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 Newtonsoft.Json; using Newtonsoft.Json;
namespace Coscine.Api.Project.Factories namespace Coscine.Api.Project.Factories
......
...@@ -7,7 +7,6 @@ using System.IdentityModel.Tokens.Jwt; ...@@ -7,7 +7,6 @@ using System.IdentityModel.Tokens.Jwt;
using System.Linq; using System.Linq;
using System.Security.Claims; using System.Security.Claims;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project namespace Coscine.Api.Project
{ {
......
...@@ -6,8 +6,6 @@ using System; ...@@ -6,8 +6,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.Models namespace Coscine.Api.Project.Models
{ {
......
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Coscine.Api.Project.Exceptions;
using Coscine.Api.Project.ReturnObjects; using Coscine.Api.Project.ReturnObjects;
using Coscine.Database.Model; using Coscine.Database.Model;
using LinqToDB; using LinqToDB;
...@@ -24,7 +20,10 @@ namespace Coscine.Api.Project.Models ...@@ -24,7 +20,10 @@ namespace Coscine.Api.Project.Models
{ {
Description = projectObject.Description, Description = projectObject.Description,
DisplayName = projectObject.DisplayName, DisplayName = projectObject.DisplayName,
Organization = projectObject.Organization Organization = projectObject.Organization,
StartDate = projectObject.StartDate,
EndDate = projectObject.EndDate,
Keywords = projectObject.Keywords,
}; };
Insert(project); Insert(project);
SetOwner(project, user); SetOwner(project, user);
...@@ -79,6 +78,9 @@ namespace Coscine.Api.Project.Models ...@@ -79,6 +78,9 @@ namespace Coscine.Api.Project.Models
project.Description = projectObject.Description; project.Description = projectObject.Description;
project.DisplayName = projectObject.DisplayName; project.DisplayName = projectObject.DisplayName;
project.Organization = projectObject.Organization; project.Organization = projectObject.Organization;
project.StartDate = projectObject.StartDate;
project.EndDate = projectObject.EndDate;
project.Keywords = projectObject.Keywords;
return Update(project); return Update(project);
} }
......
using Coscine.Database.Model; using Coscine.Database.Model;
using LinqToDB; using LinqToDB;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.Models namespace Coscine.Api.Project.Models
{ {
......
...@@ -2,11 +2,8 @@ ...@@ -2,11 +2,8 @@
using Coscine.Database.Model; using Coscine.Database.Model;
using LinqToDB; using LinqToDB;
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.Models namespace Coscine.Api.Project.Models
{ {
......
using Coscine.Database.Model; using Coscine.Database.Model;
using LinqToDB; using LinqToDB;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.Models namespace Coscine.Api.Project.Models
{ {
......
using Coscine.Database.Model; using Coscine.Database.Model;
using LinqToDB; using LinqToDB;
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.Models namespace Coscine.Api.Project.Models
{ {
......
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