Commit b162a9cd authored by Marcel Nellesen's avatar Marcel Nellesen
Browse files

New: Api refactoring

parent a19772c5
using System;
namespace Coscine.Api.Project.ReturnObjects
{
[Serializable]
public class RDSResourceTypeObject : ResourceTypeOptionObject
{
public Guid Id { get; set; }
public string BucketName { get; set; }
public int Size { get; set; }
public RDSResourceTypeObject(Guid id, string bucketName, int size)
{
Id = id;
BucketName = bucketName;
Size = size;
}
}
}
using Coscine.ApiCommons.ReturnObjects;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
namespace Coscine.Api.Project.ReturnObjects
{
[Serializable]
public class ResourceObject : IReturnObject
{
public Guid Id { get; set; }
public string PID { get { return Program.Configuration.GetStringAndWait("coscine/global/epic/prefix") + "/" + Id.ToString(); } }
public string DisplayName { get; set; }
public string ResourceName { get; set; }
public string Description { get; set; }
public string Keywords { get; set; }
public string UsageRights { get; set; }
public ResourceTypeObject Type { get; set; }
public IEnumerable<DisciplineObject> Disciplines { get; set; }
public VisibilityObject Visibility { get; set; }
public LicenseObject License { get; set; }
public JObject ResourceTypeOption { get; set; }
public string ApplicationProfile { get; set; }
public JToken FixedValues { get; set; }
public Guid? Creator { get; set; }
public ResourceObject(Guid id, string displayName, string resourceName, string description, string keywords, string usageRights, ResourceTypeObject type, IEnumerable<DisciplineObject> disciplines, VisibilityObject visibility, LicenseObject license, JObject resourceTypeOption, string applicationProfile, JToken fixedValues, Guid? creator = null)
{
Id = id;
DisplayName = displayName;
ResourceName = resourceName;
Description = description;
Keywords = keywords;
UsageRights = usageRights;
Type = type;
Disciplines = disciplines;
Visibility = visibility;
License = license;
ResourceTypeOption = resourceTypeOption;
ApplicationProfile = applicationProfile;
FixedValues = fixedValues;
Creator = creator;
}
}
}
using Coscine.ApiCommons.ReturnObjects;
using System;
namespace Coscine.Api.Project.ReturnObjects
{
[Serializable]
public class ResourceTypeObject : IReturnObject
{
public Guid Id { get; set; }
public string DisplayName { get; set; }
public bool Enabled { get; set; }
public ResourceTypeObject(Guid id, string displayName, bool enabled)
{
Id = id;
DisplayName = displayName;
Enabled = enabled;
}
}
}
using Coscine.ApiCommons.ReturnObjects;
using System;
namespace Coscine.Api.Project.ReturnObjects
{
[Serializable]
public abstract class ResourceTypeOptionObject : IReturnObject
{
}
}
\ No newline at end of file
using Coscine.ApiCommons.ReturnObjects;
using System;
namespace Coscine.Api.Project.ReturnObjects
{
[Serializable]
public class RoleObject : IReturnObject
{
public Guid Id { get; set; }
public string DisplayName { get; set; }
public RoleObject(Guid id, string displayName)
{
Id = id;
DisplayName = displayName;
}
}
}
\ No newline at end of file
using System;
namespace Coscine.Api.Project.ReturnObjects
{
[Serializable]
public class S3ResourceTypeObject : ResourceTypeOptionObject
{
public Guid Id { get; set; }
public string BucketName { get; set; }
public string AccessKey { get; set; }
public string SecretKey { get; set; }
public S3ResourceTypeObject(Guid id, string bucketName, string accessKey, string secretKey)
{
Id = id;
BucketName = bucketName;
AccessKey = accessKey;
SecretKey = secretKey;
}
}
}
using Coscine.ApiCommons.ReturnObjects;
using System;
namespace Coscine.Api.Project.ReturnObjects
{
[Serializable]
public class UserObject : IReturnObject
{
public Guid Id { get; set; }
public string DisplayName { get; set; }
public string Givenname { get; set; }
public string Surname { get; set; }
public string EmailAddress { get; set; }
public UserObject(Guid id, string displayName, string givenname, string surname, string emailAddress)
{
Id = id;
DisplayName = displayName;
Givenname = givenname;
Surname = surname;
EmailAddress = emailAddress;
}
}
}
using Coscine.ApiCommons.ReturnObjects;
using Coscine.Database.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coscine.Api.Project.ReturnObjects
{
public class VisibilityObject : IReturnObject
{
public Guid Id { get; set; }
public string DisplayName { get; set; }
public VisibilityObject(Guid id, string displayName)
{
Id = id;
DisplayName = displayName;
}
}
}
using System;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
namespace Coscine.Api.Project.ReturnObjects
{
public class WaterbutlerObject
{
public bool IsFolder { get; set; } = false;
public string Absolutepath { get; set; } = null;
public string Name { get; set; } = null;
public string LastModified { get; set; }
public string Created { get; set; }
public string Size { get; set; }
// Shallow! Only one level deep.
// Should the folder contain additional folders, they will be empty/null.
public List<WaterbutlerObject> Content { get; set; } = null;
public WaterbutlerObject()
{
}
public WaterbutlerObject(string path, JToken data)
{
Absolutepath = path;
Content = new List<WaterbutlerObject>();
IsFolder = true;
if (data == null)
{
throw new ArgumentNullException("The data for the WaterbutlerFolder cannot be null.");
}
foreach (var obj in data)
{
if (obj["type"].ToObject<string>() == "files")
{
Content.Add(new WaterbutlerObject
{
IsFolder = obj["attributes"]["kind"].ToObject<string>() == "folder",
Absolutepath = obj["attributes"]["path"].ToObject<string>(),
Name = obj["attributes"]["name"].ToObject<string>(),
Created = obj["attributes"]["modified_utc"]?.ToObject<string>(),
LastModified = obj["attributes"]["LastModified_utc"]?.ToObject<string>(),
Size = obj["attributes"]["size"]?.ToObject<string>(),
});
}
}
}
}
}
namespace Coscine.Api.Project
{
public static class UserRoles
{
public static string Member { get; } = "member";
public static string Owner { get; } = "owner";
}
}
......@@ -2,23 +2,21 @@
<packages>
<package id="AutoMapper" version="8.0.0" targetFramework="net472" />
<package id="AutoMapper.Extensions.Microsoft.DependencyInjection" version="6.0.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="Coscine.Action" version="1.9.0" targetFramework="net472" />
<package id="Coscine.ApiCommons" version="1.5.0" targetFramework="net472" />
<package id="Coscine.Action" version="1.10.0" targetFramework="net472" />
<package id="Coscine.ApiCommons" version="1.6.0" targetFramework="net472" />
<package id="Coscine.Configuration" version="1.4.0" targetFramework="net472" />
<package id="Coscine.Database" version="1.15.1" targetFramework="net472" />
<package id="Coscine.Database" version="1.16.0" targetFramework="net472" />
<package id="Coscine.Logging" version="1.0.1" targetFramework="net472" />
<package id="Coscine.ProxyApi" version="1.2.1" targetFramework="net472" />
<package id="Coscine.SharePoint.Webparts.Vue" version="1.4.0" targetFramework="net472" />
<package id="dotNetRDF" version="2.2.1" targetFramework="net472" />
<package id="dotNetRDF.Data.Virtuoso" version="2.2.1" targetFramework="net472" />
<package id="Coscine.SharePoint.Webparts.Vue" version="1.5.0" targetFramework="net472" />
<package id="EntityFramework" version="6.2.0" targetFramework="net472" />
<package id="HtmlAgilityPack" version="1.8.2" 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" />
<package id="LinqKit" version="1.1.16" targetFramework="net472" />
<package id="Metadata" version="1.0.0" targetFramework="net472" />
<package id="LinqKit" version="1.1.17" targetFramework="net472" />
<package id="Microsoft.AspNetCore" version="2.2.0" targetFramework="net472" />
<package id="Microsoft.AspNetCore.Antiforgery" version="2.2.0" targetFramework="net472" />
<package id="Microsoft.AspNetCore.Authentication" version="2.2.0" targetFramework="net472" />
......@@ -121,7 +119,8 @@
<package id="Microsoft.IdentityModel.Tokens" version="5.6.0" targetFramework="net472" />
<package id="Microsoft.Net.Http.Headers" version="2.2.0" targetFramework="net472" />
<package id="Microsoft.Win32.Registry" version="4.5.0" targetFramework="net472" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
<package id="Moq" version="4.13.1" targetFramework="net472" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
<package id="Newtonsoft.Json.Bson" version="1.0.2" targetFramework="net472" />
<package id="NLog" version="4.6.8" targetFramework="net472" />
<package id="NLog.Config" version="4.6.8" 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