2020-05-22 15:06:17 +02:00
|
|
|
using System;
|
2020-05-03 16:21:37 +02:00
|
|
|
|
|
|
|
|
namespace zero.Web.Models
|
2020-04-17 15:32:33 +02:00
|
|
|
{
|
2020-05-22 15:06:17 +02:00
|
|
|
public class EditModel : EditModel<object> { }
|
|
|
|
|
|
|
|
|
|
public class EditModel<T>
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Model
|
|
|
|
|
/// </summary>
|
|
|
|
|
public T Entity { get; set; }
|
|
|
|
|
|
2020-08-20 14:35:08 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Meta data
|
|
|
|
|
/// </summary>
|
|
|
|
|
public EditMetaModel Meta { get; set; } = new EditMetaModel();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class EditMetaModel
|
|
|
|
|
{
|
2020-06-03 12:57:29 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Whether an entity of this type can be created
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool CanCreate { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether an entity of this type can be created in the shared app space
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool CanCreateShared { get; set; }
|
|
|
|
|
|
2020-05-22 15:06:17 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Whether this entity can be edited or only viewed
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool CanEdit { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2020-06-03 12:57:29 +02:00
|
|
|
/// Whether this entity can be deleted
|
2020-05-22 15:06:17 +02:00
|
|
|
/// </summary>
|
2020-06-03 12:57:29 +02:00
|
|
|
public bool CanDelete { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Wehther this entity is application aware
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsAppAware { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether this entity can be shared across applications (only for IsAppAware=true)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool CanBeShared { get; set; }
|
|
|
|
|
|
2021-09-23 11:29:10 +02:00
|
|
|
public bool IsShared { get; set; }
|
|
|
|
|
|
2020-06-03 12:57:29 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// The change token maps to a database entity which holds ID and collection of the model to edit
|
|
|
|
|
/// If these values do not match the entity on save it is rejected
|
|
|
|
|
/// // TODO expiration expiry session.Advanced.GetMetadataFor(user)[Raven.Client.Constants.Documents.Metadata.Expires] = DateTime.UtcNow.AddMinutes(60);
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Token { get; set; }
|
2020-05-22 15:06:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public abstract class ObsoleteEditModel
|
2020-04-17 15:32:33 +02:00
|
|
|
{
|
2020-04-22 15:46:35 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Id of the entity
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
|
2020-05-04 16:00:39 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Whether this entity is active
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsActive { get; set; }
|
|
|
|
|
|
2020-04-28 14:51:17 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Whether this entity can be edited or only viewed
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool CanEdit { get; set; }
|
|
|
|
|
|
2020-05-04 16:00:39 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Date of creation
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DateTimeOffset CreatedDate { get; set; }
|
|
|
|
|
|
2020-04-17 15:51:11 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Meta data for the entity
|
|
|
|
|
/// </summary>
|
|
|
|
|
public EditModelMeta Meta { get; set; } = new EditModelMeta();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class EditModelMeta
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The change token maps to a database entity which holds ID and collection of the model to edit
|
|
|
|
|
/// If these values do not match the entity on save it is rejected
|
|
|
|
|
/// // TODO expiration expiry session.Advanced.GetMetadataFor(user)[Raven.Client.Constants.Documents.Metadata.Expires] = DateTime.UtcNow.AddMinutes(60);
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Token { get; set; }
|
2020-04-17 15:32:33 +02:00
|
|
|
}
|
|
|
|
|
}
|