forked from microsoft/github-copilot-vibe-coding-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPost.cs
More file actions
58 lines (49 loc) · 1.53 KB
/
Copy pathPost.cs
File metadata and controls
58 lines (49 loc) · 1.53 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
using System.ComponentModel.DataAnnotations;
namespace Contoso.BlazorApp.Models;
public class Post
{
public string Id { get; set; } = string.Empty;
public string Username { get; set; } = string.Empty;
public string Content { get; set; } = string.Empty;
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
public int LikesCount { get; set; }
public bool IsLiked { get; set; } // Client-side computed property
public int CommentsCount { get; set; }
}
public class CreatePostRequest
{
[Required]
[StringLength(50, MinimumLength = 1)]
public string Username { get; set; } = string.Empty;
[Required]
[StringLength(2000, MinimumLength = 1)]
public string Content { get; set; } = string.Empty;
}
public class UpdatePostRequest
{
[Required]
[StringLength(50, MinimumLength = 1)]
public string Username { get; set; } = string.Empty;
[Required]
[StringLength(2000, MinimumLength = 1)]
public string Content { get; set; } = string.Empty;
}
public class LikeRequest
{
[Required]
[StringLength(50, MinimumLength = 1)]
public string Username { get; set; } = string.Empty;
}
public class LikeResponse
{
public string PostId { get; set; } = string.Empty;
public string Username { get; set; } = string.Empty;
public DateTime LikedAt { get; set; }
}
public class Error
{
public string ErrorCode { get; set; } = string.Empty;
public string Message { get; set; } = string.Empty;
public List<string>? Details { get; set; }
}