forked from json-api-dotnet/JsonApiDotNetCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTodoItem.cs
More file actions
36 lines (27 loc) · 1.05 KB
/
TodoItem.cs
File metadata and controls
36 lines (27 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.ComponentModel.DataAnnotations;
using JetBrains.Annotations;
using JsonApiDotNetCore.Resources;
using JsonApiDotNetCore.Resources.Annotations;
namespace JsonApiDotNetCoreExample.Models;
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
[Resource]
public sealed class TodoItem : Identifiable<long>
{
[Attr]
public required string Description { get; set; }
[Attr]
[Required]
public TodoItemPriority? Priority { get; set; }
[Attr]
public long? DurationInHours { get; set; }
[Attr(Capabilities = AttrCapabilities.AllowFilter | AttrCapabilities.AllowSort | AttrCapabilities.AllowView)]
public DateTimeOffset CreatedAt { get; set; }
[Attr(PublicName = "modifiedAt", Capabilities = AttrCapabilities.AllowFilter | AttrCapabilities.AllowSort | AttrCapabilities.AllowView)]
public DateTimeOffset? LastModifiedAt { get; set; }
[HasOne]
public required Person Owner { get; set; }
[HasOne]
public Person? Assignee { get; set; }
[HasMany]
public ISet<Tag> Tags { get; set; } = new HashSet<Tag>();
}