Skip to content

Commit

Permalink
Update Posts.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Mar 21, 2024
1 parent e33f199 commit 7191d32
Showing 1 changed file with 46 additions and 12 deletions.
58 changes: 46 additions & 12 deletions MyApp.ServiceModel/Posts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ namespace MyApp.ServiceModel;
public class Post
{
public int Id { get; set; }

[Required]
public int PostTypeId { get; set; }

[Required] public int PostTypeId { get; set; }

public int? AcceptedAnswerId { get; set; }

Expand Down Expand Up @@ -45,17 +44,46 @@ public class Post
public string Slug { get; set; }

public string Summary { get; set; }

[Ignore]
public string? Body { get; set; }

[Ignore] public string? Body { get; set; }
}

public class QueryPosts : QueryDb<Post> {}
public class PostJob
{
public int JobId { get; set; }
public int PostId { get; set; }
public string Title { get; set; }
public string Body { get; set; }
public List<string> Tags { get; set; }
}

public class CheckPostJobs : IGet, IReturn<CheckPostJobsResponse>
{
public string WorkerId { get; set; }
public List<string> Models { get; set; }
}
public class CheckPostJobsResponse
{
public List<PostJob> Results { get; set; }
}

public class CreateAnswer : IReturnVoid
{
public int PostId { get; set; }
public string Model { get; set; }
public string Body { get; set; }
public string UserName { get; set; }
public int? JobId { get; set; }
public string? WorkerId { get; set; }
}

public class QueryPosts : QueryDb<Post>
{
}

public class PostFts
{
[Alias("rowid")]
public int Id { get; set; }
[Alias("rowid")] public int Id { get; set; }
public string RefId { get; set; }
public string UserName { get; set; }
public string Body { get; set; }
Expand All @@ -67,31 +95,35 @@ public class Choice
public int Index { get; set; }
public ChoiceMessage Message { get; set; }
}

public class ChoiceMessage
{
public string Role { get; set; }
public string Content { get; set; }
}

public class Answer
{
public string Id { get; set; }
public string Object { get; set; }
public long Created { get; set; }
public string Model { get; set; }
public List<Choice> Choices { get; set; }
public Dictionary<string,int> Usage { get; set; }
public Dictionary<string, int> Usage { get; set; }
public decimal Temperature { get; set; }
public List<Comment> Comments { get; set; } = [];
public int Votes => UpVotes - DownVotes;
public int UpVotes { get; set; }
public int DownVotes { get; set; }
}

public class Comment
{
public string Body { get; set; }
public string CreatedBy { get; set; }
public DateTime CreatedDate { get; set; }
}

public class QuestionAndAnswers
{
public int Id => Post.Id;
Expand All @@ -101,7 +133,9 @@ public class QuestionAndAnswers
public List<Answer> Answers { get; set; } = [];
}

public class AdminData : IGet, IReturn<AdminDataResponse> {}
public class AdminData : IGet, IReturn<AdminDataResponse>
{
}

public class PageStats
{
Expand All @@ -112,4 +146,4 @@ public class PageStats
public class AdminDataResponse
{
public List<PageStats> PageStats { get; set; }
}
}

0 comments on commit 7191d32

Please sign in to comment.