blob: f6039b3505b4658a11576fe05b896efbabe851b4 (
plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
using AutoMapper;
using System;
using System.ComponentModel.DataAnnotations;
using Timeline.Models.Validation;
using Timeline.Services;
namespace Timeline.Models.Http
{
/// <summary>
/// Content of post create request.
/// </summary>
public class HttpTimelinePostCreateRequestContent
{
/// <summary>
/// Type of post content.
/// </summary>
[Required]
public string Type { get; set; } = default!;
/// <summary>
/// If post is of text type, this is the text.
/// </summary>
public string? Text { get; set; }
/// <summary>
/// If post is of image type, this is base64 of image data.
/// </summary>
public string? Data { get; set; }
}
public class HttpTimelinePostCreateRequest
{
/// <summary>
/// Content of the new post.
/// </summary>
[Required]
public HttpTimelinePostCreateRequestContent Content { get; set; } = default!;
/// <summary>
/// Time of the post. If not set, current time will be used.
/// </summary>
public DateTime? Time { get; set; }
}
/// <summary>
/// Create timeline request model.
/// </summary>
public class TimelineCreateRequest
{
/// <summary>
/// Name of the new timeline. Must be a valid name.
/// </summary>
[Required]
[TimelineName]
public string Name { get; set; } = default!;
}
/// <summary>
/// Patch timeline request model.
/// </summary>
public class HttpTimelinePatchRequest
{
/// <summary>
/// New title. Null for not change.
/// </summary>
public string? Title { get; set; }
/// <summary>
/// New description. Null for not change.
/// </summary>
public string? Description { get; set; }
/// <summary>
/// New visibility. Null for not change.
/// </summary>
public TimelineVisibility? Visibility { get; set; }
}
/// <summary>
/// Change timeline name request model.
/// </summary>
public class HttpTimelineChangeNameRequest
{
/// <summary>
/// Old name of timeline.
/// </summary>
[Required]
[TimelineName]
public string OldName { get; set; } = default!;
/// <summary>
/// New name of timeline.
/// </summary>
[Required]
[TimelineName]
public string NewName { get; set; } = default!;
}
public class HttpTimelineControllerAutoMapperProfile : Profile
{
public HttpTimelineControllerAutoMapperProfile()
{
CreateMap<HttpTimelinePatchRequest, TimelineChangePropertyParams>();
}
}
}
|