Skip to content

Commit

Permalink
Added Category, removed Date
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanDuvalV committed Mar 23, 2024
1 parent fd6b23c commit fc7a4d3
Show file tree
Hide file tree
Showing 9 changed files with 479 additions and 11 deletions.
3 changes: 3 additions & 0 deletions core/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ CONTAINER_DIR=/app/volume
CDN_URL=http://localhost:6464

FRONTEND_BASE_URL=http://localhost:3000

RATE_LIMIT_TIME_WINDOW_SECONDS=10
RATE_LIMIT_MAX_REQUESTS=4
4 changes: 3 additions & 1 deletion core/Data/Entities/Report.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

using api.core.Data.Enums;

using Microsoft.EntityFrameworkCore;

namespace api.core.data.entities;
Expand All @@ -17,7 +19,7 @@ public partial class Report

public string Reason { get; set; } = null!;

public DateTime Date { get; set; }
public ReportCategory Category { get; set; }

public Guid PublicationId { get; set; }

Expand Down
19 changes: 19 additions & 0 deletions core/Data/Enums/ReportCategory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Text.Json.Serialization;

namespace api.core.Data.Enums;

/// <summary>
/// 1 - InappropriateContent
/// 2 - FalseInformation
/// 3 - AbusiveBehavior
/// 4 - ObsoleteInformation
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
[Flags]
public enum ReportCategory
{
InappropriateContent = 1,
FalseInformation = 2,
AbusiveBehavior = 3,
ObsoleteInformation = 4
}
6 changes: 4 additions & 2 deletions core/Data/Requests/ReportRequestDTO.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
namespace api.core.Data.Requests;
using api.core.Data.Enums;

namespace api.core.Data.Requests;

public class CreateReportRequestDTO
{
public string Reason { get; set; }

public DateTime Date { get; set; }
public ReportCategory Category { get; set; }
}
5 changes: 3 additions & 2 deletions core/Data/Responses/ReportResponseDTO.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using api.core.data.entities;
using api.core.Data.Enums;

namespace api.core.Data.Responses;

Expand All @@ -8,7 +9,7 @@ public class ReportResponseDTO

public string Reason { get; set; }

public DateTime Date { get; set; }
public ReportCategory Category { get; set; }

public EventResponseDTO Publication { get; set; }

Expand All @@ -22,7 +23,7 @@ public static ReportResponseDTO Map(Report report)
{
Id = report.Id,
Reason = report.Reason,
Date = report.Date,
Category = report.Category,
CreatedAt = report.CreatedAt,
UpdatedAt = report.UpdatedAt,
Publication = new EventResponseDTO
Expand Down
Loading

0 comments on commit fc7a4d3

Please sign in to comment.