Workspace project added
This commit is contained in:
parent
e374b41b08
commit
c6ef3b184c
@ -0,0 +1,20 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Events\" />
|
||||||
|
<Folder Include="Documents\" />
|
||||||
|
<Folder Include="Notifications\" />
|
||||||
|
<Folder Include="Tasks\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\..\connected.framework\src\Connected.Entities\Connected.Entities.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
114
src/Connected.Common.Workspace/IWorkspaceEntity.cs
Normal file
114
src/Connected.Common.Workspace/IWorkspaceEntity.cs
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
using Connected.Common.Workspace.Messaging;
|
||||||
|
using Connected.Entities.Consistency;
|
||||||
|
using Connected.Security.Identity;
|
||||||
|
|
||||||
|
namespace Connected.Common.Workspace;
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies the read state of the <see cref="IWorkspaceEntity"/> entity.
|
||||||
|
/// </summary>
|
||||||
|
public enum ReadStatus
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The entity has not been read by the <see cref="IWorkspaceEntity.IdentityId"/>.
|
||||||
|
/// </summary>
|
||||||
|
New = 0,
|
||||||
|
/// <summary>
|
||||||
|
/// The entity has been read by the <see cref="IWorkspaceEntity.IdentityId"/>.
|
||||||
|
/// </summary>
|
||||||
|
Read = 1
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies what kind of actions can be performed by the identity on each <see cref="IWorkspaceEntity"/> entity.
|
||||||
|
/// </summary>
|
||||||
|
[Flags]
|
||||||
|
public enum IdentityVerbs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The entity is read only. Identity cannot perform any actions on it
|
||||||
|
/// except reading.
|
||||||
|
/// </summary>
|
||||||
|
ReadOnly = 0,
|
||||||
|
/// <summary>
|
||||||
|
/// The entity can be deleted from the workspace by the identity.
|
||||||
|
/// </summary>
|
||||||
|
AllowDelete = 1
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a base entity for all workspace related entities.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Digital Workspace offers many different services serving different purposes. Each service introduces
|
||||||
|
/// its own set of entities. All top level entities inherits from this entity, for example <see cref="IMessage"/>.
|
||||||
|
/// </remarks>
|
||||||
|
public interface IWorkspaceEntity : IConsistentEntity<long>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The type of identity to which workspace entity belongs to (like Recipient).
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// The most common type of the identity entity is <see cref="IUser"/>.
|
||||||
|
/// </remarks>
|
||||||
|
string IdentityEntity { get; init; }
|
||||||
|
/// <summary>
|
||||||
|
/// The id of the identity to which workspace entity belongs. This could be the id of the user,
|
||||||
|
/// device, organization unit or any other entity id.
|
||||||
|
/// </summary>
|
||||||
|
string IdentityId { get; init; }
|
||||||
|
/// <summary>
|
||||||
|
/// The date and time the workspace entity has been created.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This value can represent the value when the origin entity has been created or when
|
||||||
|
/// the workspace entity has been created. This value is specific to the service implementation.
|
||||||
|
/// </remarks>
|
||||||
|
DateTimeOffset Created { get; init; }
|
||||||
|
/// <summary>
|
||||||
|
/// The date and time the workspace entity expires.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Expired workspace entities are automatically deleted from the system. If this value is <c>null</c>,
|
||||||
|
/// workspace entity never expires.
|
||||||
|
/// </remarks>
|
||||||
|
DateTimeOffset? Expires { get; init; }
|
||||||
|
/// <summary>
|
||||||
|
/// The title of the entity.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This should be as short as possible so user can quickly recognize the nature of the entity.
|
||||||
|
/// </remarks>
|
||||||
|
string Title { get; init; }
|
||||||
|
/// <summary>
|
||||||
|
/// The short description of the entity. Can be <c>null</c>.
|
||||||
|
/// </summary>
|
||||||
|
string? Description { get; init; }
|
||||||
|
/// <summary>
|
||||||
|
/// The read status of the entity. This serves primary for a UI purpose to enable visual feedback
|
||||||
|
/// to the user.
|
||||||
|
/// </summary>
|
||||||
|
ReadStatus Status { get; init; }
|
||||||
|
/// <summary>
|
||||||
|
/// The domain to which this entity belongs.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Each workspace entity should have one and only one domain to which it originates.
|
||||||
|
/// </remarks>
|
||||||
|
string Domain { get; init; }
|
||||||
|
/// <summary>
|
||||||
|
/// Zero or more tags that represents additional meta data of the workspace entity.
|
||||||
|
/// </summary>
|
||||||
|
string? Tags { get; init; }
|
||||||
|
/// <summary>
|
||||||
|
/// The entity which triggered this workspace entity to be created. Can be <c>null</c> if it was
|
||||||
|
/// automatically generated by the underlying system.
|
||||||
|
/// </summary>
|
||||||
|
string? AuthorEntity { get; init; }
|
||||||
|
/// <summary>
|
||||||
|
/// The id of the entity which created this workspace entity. Can be <c>null</c> if it was
|
||||||
|
/// automatically generated by the underlying system.
|
||||||
|
/// </summary>
|
||||||
|
string? AuthorId { get; init; }
|
||||||
|
/// <summary>
|
||||||
|
/// Actions that can be performed by the identity on the workspace entity.
|
||||||
|
/// </summary>
|
||||||
|
IdentityVerbs Verbs { get; init; }
|
||||||
|
}
|
22
src/Connected.Common.Workspace/Identities/IIdentity.cs
Normal file
22
src/Connected.Common.Workspace/Identities/IIdentity.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using Connected.Data;
|
||||||
|
|
||||||
|
namespace Connected.Common.Workspace.Identities;
|
||||||
|
/// <summary>
|
||||||
|
/// Represents the workspace identity.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Workspace supports identities through the <see cref="IIdentityService"/>. There could
|
||||||
|
/// be any number of different identities, such as users or devices which are provided via
|
||||||
|
/// different identity providers.
|
||||||
|
/// </remarks>
|
||||||
|
public interface IIdentity : IPrimaryKey<string>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The display name of the identity. This should be short and descriptive.
|
||||||
|
/// </summary>
|
||||||
|
string DisplayName { get; init; }
|
||||||
|
/// <summary>
|
||||||
|
/// The Url of the identity's avatar if it is supported.
|
||||||
|
/// </summary>
|
||||||
|
string Avatar { get; init; }
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
using System.Collections.Immutable;
|
||||||
|
|
||||||
|
namespace Connected.Common.Workspace.Identities;
|
||||||
|
/// <summary>
|
||||||
|
/// The provider service used for providing identity descriptors.
|
||||||
|
/// </summary>
|
||||||
|
public interface IIdentityService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Queries identities for the specified set of entity types and their ids.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args">The arguments containing entity types and their ids.</param>
|
||||||
|
/// <returns>The list of identities that matches the specified criteria.</returns>
|
||||||
|
Task<ImmutableList<IIdentity>> Query(QueryIdentitiesArgs args);
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
using Connected.Annotations;
|
||||||
|
using Connected.ServiceModel;
|
||||||
|
|
||||||
|
namespace Connected.Common.Workspace.Identities;
|
||||||
|
public sealed class QueryIdentitiesArgs : QueryArgs
|
||||||
|
{
|
||||||
|
[NonDefault]
|
||||||
|
public Dictionary<string, string> Items { get; set; } = default!;
|
||||||
|
}
|
5
src/Connected.Common.Workspace/Messaging/IMessage.cs
Normal file
5
src/Connected.Common.Workspace/Messaging/IMessage.cs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
namespace Connected.Common.Workspace.Messaging;
|
||||||
|
public interface IMessage : IWorkspaceEntity
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
15
src/Connected.Common.Workspace/Messaging/IMessagesService.cs
Normal file
15
src/Connected.Common.Workspace/Messaging/IMessagesService.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System.Collections.Immutable;
|
||||||
|
using Connected.Notifications;
|
||||||
|
using Connected.ServiceModel;
|
||||||
|
|
||||||
|
namespace Connected.Common.Workspace.Messaging;
|
||||||
|
public interface IMessagesService : IServiceNotifications<long>
|
||||||
|
{
|
||||||
|
Task<ImmutableList<IMessage>> Query(QueryMessageArgs args);
|
||||||
|
Task<IMessage?> Select(PrimaryKeyArgs<long> args);
|
||||||
|
|
||||||
|
Task<long> Insert(InsertMessageArgs args);
|
||||||
|
Task Update(UpdateMessageArgs args);
|
||||||
|
Task Patch(PatchArgs<long> args);
|
||||||
|
Task Delete(PrimaryKeyArgs<long> args);
|
||||||
|
}
|
21
src/Connected.Common.Workspace/Messaging/MessageArgs.cs
Normal file
21
src/Connected.Common.Workspace/Messaging/MessageArgs.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using Connected.ServiceModel;
|
||||||
|
|
||||||
|
namespace Connected.Common.Workspace.Messaging;
|
||||||
|
public sealed class QueryMessageArgs : QueryArgs
|
||||||
|
{
|
||||||
|
[Required, MaxLength(128)]
|
||||||
|
public string IdentityEntity { get; set; } = default!;
|
||||||
|
[Required, MaxLength(128)]
|
||||||
|
public string IdentityId { get; set; } = default!;
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class InsertMessageArgs : InsertWorkspaceArgs
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class UpdateMessageArgs : UpdateWorkspaceArgs
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
67
src/Connected.Common.Workspace/WorkspaceArgs.cs
Normal file
67
src/Connected.Common.Workspace/WorkspaceArgs.cs
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using Connected.ServiceModel;
|
||||||
|
|
||||||
|
namespace Connected.Common.Workspace;
|
||||||
|
/// <summary>
|
||||||
|
/// The base class for the arguments used when inserting one of the
|
||||||
|
/// implementations of the <see cref="IWorkspaceEntity"/> entity.
|
||||||
|
/// </summary>
|
||||||
|
public abstract class InsertWorkspaceArgs : Dto
|
||||||
|
{
|
||||||
|
/// <inheritdoc cref="IWorkspaceEntity.IdentityEntity"/>
|
||||||
|
[Required, MaxLength(128)]
|
||||||
|
public string IdentityEntity { get; set; } = default!;
|
||||||
|
/// <inheritdoc cref="IWorkspaceEntity.IdentityId"/>
|
||||||
|
[Required, MaxLength(128)]
|
||||||
|
public string IdentityId { get; set; } = default!;
|
||||||
|
/// <inheritdoc cref="IWorkspaceEntity.Created"/>
|
||||||
|
public DateTimeOffset? Created { get; set; }
|
||||||
|
/// <inheritdoc cref="IWorkspaceEntity.Expires"/>
|
||||||
|
public DateTimeOffset? Expires { get; set; }
|
||||||
|
/// <inheritdoc cref="IWorkspaceEntity.Title"/>
|
||||||
|
[Required, MaxLength(128)]
|
||||||
|
public string Title { get; set; } = default!;
|
||||||
|
/// <inheritdoc cref="IWorkspaceEntity.Description"/>
|
||||||
|
[MaxLength(256)]
|
||||||
|
public string? Description { get; set; }
|
||||||
|
/// <inheritdoc cref="IWorkspaceEntity.Status"/>
|
||||||
|
public ReadStatus? Status { get; set; }
|
||||||
|
/// <inheritdoc cref="IWorkspaceEntity.Domain"/>
|
||||||
|
[Required, MaxLength(128)]
|
||||||
|
public string Domain { get; init; } = default!;
|
||||||
|
/// <inheritdoc cref="IWorkspaceEntity.Tags"/>
|
||||||
|
[MaxLength(256)]
|
||||||
|
public string? Tags { get; init; }
|
||||||
|
/// <inheritdoc cref="IWorkspaceEntity.AuthorEntity"/>
|
||||||
|
[MaxLength(128)]
|
||||||
|
public string? AuthorEntity { get; init; }
|
||||||
|
/// <inheritdoc cref="IWorkspaceEntity.AuthorId"/>
|
||||||
|
[MaxLength(128)]
|
||||||
|
public string? AuthorId { get; init; }
|
||||||
|
/// <inheritdoc cref="IWorkspaceEntity.Verbs"/>
|
||||||
|
public IdentityVerbs? Verbs { get; init; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// The base class used when updating one of the
|
||||||
|
/// implementations of the <see cref="IWorkspaceEntity"/> entity.
|
||||||
|
/// </summary>
|
||||||
|
public abstract class UpdateWorkspaceArgs : PrimaryKeyArgs<long>
|
||||||
|
{
|
||||||
|
/// <inheritdoc cref="IWorkspaceEntity.Created"/>
|
||||||
|
public DateTimeOffset? Created { get; set; }
|
||||||
|
/// <inheritdoc cref="IWorkspaceEntity.Expires"/>
|
||||||
|
public DateTimeOffset? Expires { get; set; }
|
||||||
|
/// <inheritdoc cref="IWorkspaceEntity.Title"/>
|
||||||
|
[Required, MaxLength(128)]
|
||||||
|
public string Title { get; set; } = default!;
|
||||||
|
/// <inheritdoc cref="IWorkspaceEntity.Description"/>
|
||||||
|
[MaxLength(256)]
|
||||||
|
public string? Description { get; set; }
|
||||||
|
/// <inheritdoc cref="IWorkspaceEntity.Status"/>
|
||||||
|
public ReadStatus? Status { get; set; }
|
||||||
|
/// <inheritdoc cref="IWorkspaceEntity.Tags"/>
|
||||||
|
[MaxLength(256)]
|
||||||
|
public string? Tags { get; init; }
|
||||||
|
/// <inheritdoc cref="IWorkspaceEntity.Verbs"/>
|
||||||
|
public IdentityVerbs? Verbs { get; init; }
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user