mirror of
https://github.com/GCMatters/hermes.git
synced 2026-02-04 05:30:13 +01:00
fix: offload building DTOs to GUHF
DTO building allows for fully returning correct event's skills and registrations
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using WebApp.Entities;
|
||||
|
||||
namespace WebApp.DTOs;
|
||||
|
||||
// Output values in JSON file
|
||||
public record class EventDetailsDto
|
||||
(
|
||||
int EventId,
|
||||
[Required] int? OrganisationId,
|
||||
[Required] string? OrganisationName,
|
||||
[Required][StringLength(50)] string Title,
|
||||
[StringLength(500)] string Description,
|
||||
[Required][StringLength(100)] string Location,
|
||||
[Required] DateTime? EventDate,
|
||||
ICollection<EventSkill> EventSkills,
|
||||
ICollection<EventRegistration> EventRegistrations
|
||||
);
|
||||
{
|
||||
public int EventId { get; set; }
|
||||
[Required] public int? OrganisationId { get; set; }
|
||||
[Required] public string? OrganisationName { get; set; }
|
||||
[Required][StringLength(50)] public string Title { get; set; }
|
||||
[StringLength(500)] public string Description { get; set; }
|
||||
[Required][StringLength(100)] public string Location { get; set; }
|
||||
[Required] public DateTime? EventDate { get; set; }
|
||||
//ICollection<EventSkill> EventSkills,
|
||||
public ICollection<SkillSummaryDto> EventSkills { get; set; }
|
||||
public ICollection<EventRegistrationDto> EventRegistrations { get; set; }
|
||||
|
||||
public EventDetailsDto() { }
|
||||
};
|
||||
|
||||
15
WebApp/DTOs/EventRegistrationDto.cs
Normal file
15
WebApp/DTOs/EventRegistrationDto.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using WebApp.Entities;
|
||||
|
||||
namespace WebApp.DTOs;
|
||||
|
||||
public record class EventRegistrationDto
|
||||
{
|
||||
public int EventId { get; set; }
|
||||
public int UserId { get; set; }
|
||||
public string UserName { get; set; }
|
||||
public DateTime RegisteredAt { get; set; }
|
||||
|
||||
public EventRegistrationDto() { }
|
||||
|
||||
};
|
||||
@@ -1,17 +1,19 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using WebApp.Entities;
|
||||
|
||||
namespace WebApp.DTOs;
|
||||
|
||||
// Output values in JSON file
|
||||
public record class EventSummaryDto(
|
||||
int EventId,
|
||||
[Required] string Organisation,
|
||||
[Required] int OrganisationId,
|
||||
[Required] [StringLength(50)] string Title,
|
||||
[StringLength(500)] string Description,
|
||||
[Required] [StringLength(100)] string Location,
|
||||
[Required] DateTime? EventDate,
|
||||
ICollection<EventSkill> EventSkills,
|
||||
ICollection<EventRegistration> EventRegistrations
|
||||
);
|
||||
public record class EventSummaryDto {
|
||||
public int EventId { get; set; }
|
||||
[Required] public string Organisation { get; set; }
|
||||
[Required] public int OrganisationId { get; set; }
|
||||
[Required] [StringLength(50)] public string Title { get; set; }
|
||||
[StringLength(500)] public string Description { get; set; }
|
||||
[Required] [StringLength(100)] public string Location { get; set; }
|
||||
[Required] public DateTime? EventDate { get; set; }
|
||||
public ICollection<EventSkill> EventSkills { get; set; }
|
||||
public ICollection<EventRegistration> EventRegistrations { get; set; }
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using WebApp.Entities;
|
||||
|
||||
namespace WebApp.DTOs;
|
||||
@@ -13,4 +13,5 @@ public record class EventSummaryNoErDto(
|
||||
[Required][StringLength(100)] string Location,
|
||||
[Required] DateTime? EventDate,
|
||||
ICollection<EventSkill> EventSkills
|
||||
// ICollection<SkillSummaryDto> EventSkills
|
||||
);
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using WebApp.Entities;
|
||||
|
||||
namespace WebApp.DTOs;
|
||||
|
||||
public record class SkillSummaryDto
|
||||
(
|
||||
[Required] int SkillId,
|
||||
[Required] string SkillName
|
||||
);
|
||||
{
|
||||
public int? SkillId { get; set; }
|
||||
public string? SkillName { get; set; }
|
||||
|
||||
public SkillSummaryDto() { }
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user