Repository navigation
Expand file tree
/
Copy pathAnalytics.cs
More file actions
112 lines (94 loc) · 2.72 KB
/
Copy pathAnalytics.cs
File metadata and controls
112 lines (94 loc) · 2.72 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
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
104
105
106
107
108
109
110
111
112
using ServiceStack;
using ServiceStack.DataAnnotations;
using System;
namespace BlazorDiffusion.ServiceModel;
[NamedConnection(Databases.Analytics)]
public class StatBase
{
public string RefId { get; set; }
public int? AppUserId { get; set; }
public string RawUrl { get; set; }
public string RemoteIp { get; set; }
public DateTime CreatedDate { get; set; }
}
public enum StatType
{
Download,
}
[Icon(Svg = Icons.Stats)]
public class ArtifactStat : StatBase
{
[AutoIncrement]
public int Id { get; set; }
public StatType Type { get; set; }
public int ArtifactId { get; set; }
public string Source { get; set; }
public string Version { get; set; }
}
[Icon(Svg = Icons.Stats)]
public class SearchStat : StatBase
{
[AutoIncrement]
public int Id { get; set; }
public string? Query { get; set; }
public string? Similar { get; set; }
public string? User { get; set; }
public string? Modifier { get; set; }
public string? Artist { get; set; }
public string? Album { get; set; }
public string? Show { get; set; }
public string? Source { get; set; }
public int? ArtifactId { get; set; }
public int? AlbumId { get; set; }
public int? ModifierId { get; set; }
public int? ArtistId { get; set; }
}
public enum SignupType
{
Updates,
Beta,
}
[Icon(Svg = Icons.Signup)]
public class Signup : StatBase
{
[AutoIncrement]
public int Id { get; set; }
public SignupType Type { get; set; }
public string Email { get; set; }
public string? Name { get; set; }
public DateTime? CancelledDate { get; set; }
}
[Tag(Tag.Analytics)]
public class CreateSignup : ICreateDb<Signup>, IReturn<EmptyResponse> // IReturnVoid -> support cast EmptyResponse -> byte[]
{
public SignupType Type { get; set; }
[ValidateNotEmpty, ValidateEmail]
public string Email { get; set; }
public string? Name { get; set; }
}
[Tag(Tag.Analytics)]
[ValidateHasRole(AppRoles.Moderator)]
public class QueryArtifactStats : QueryDb<ArtifactStat> { }
[Tag(Tag.Analytics)]
[ValidateHasRole(AppRoles.Moderator)]
public class QuerySearchStats : QueryDb<SearchStat> { }
[Tag(Tag.Analytics)]
[ValidateHasRole(AppRoles.Moderator)]
public class QuerySignups : QueryDb<Signup> { }
[Tag(Tag.Analytics)]
[ValidateHasRole(AppRoles.Moderator)]
public class UpdateSignup : IPatchDb<Signup>, IReturn<Signup>
{
public int Id { get; set; }
public SignupType? Type { get; set; }
[ValidateEmail]
public string? Email { get; set; }
public string? Name { get; set; }
public DateTime? CancelledDate { get; set; }
}
[Tag(Tag.Analytics)]
[ValidateHasRole(AppRoles.Moderator)]
public class DeleteSignup : IDeleteDb<Signup>, IReturnVoid
{
public int Id { get; set; }
}