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
31 lines (24 loc) · 802 Bytes
/
TodoItem.cs
File metadata and controls
31 lines (24 loc) · 802 Bytes
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
using System.ComponentModel.DataAnnotations;
using JetBrains.Annotations;
using JsonApiDotNetCore.Controllers;
using JsonApiDotNetCore.Resources;
using JsonApiDotNetCore.Resources.Annotations;
namespace NoEntityFrameworkExample.Models;
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
[Resource(GenerateControllerEndpoints = JsonApiEndpoints.Query)]
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; }
[HasOne]
public required Person Owner { get; set; }
[HasOne]
public Person? Assignee { get; set; }
[HasMany]
public ISet<Tag> Tags { get; set; } = new HashSet<Tag>();
}