From 9315b78250ca0f587155316c3cbf87b1ed3f0edd Mon Sep 17 00:00:00 2001 From: scogliera Date: Sat, 9 Dec 2023 03:58:56 +0100 Subject: [PATCH] Add Guid support for Lecturers and Tags, add ctor to Lecturer.cs --- Models/Lecturer.cs | 9 +++++++-- Models/Tag.cs | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Models/Lecturer.cs b/Models/Lecturer.cs index d58fc76..851cd94 100644 --- a/Models/Lecturer.cs +++ b/Models/Lecturer.cs @@ -4,8 +4,13 @@ namespace TeacherDigitalAgency.Models; public class Lecturer { - // TODO: Find out how UUIDs get generated -> C# or Mongo solution - [JsonPropertyName("uuid")] public string Uuid { get; init; } + public Lecturer(string firstName, string lastName) + { + FirstName = firstName; + LastName = lastName; + } + + [JsonPropertyName("uuid")] public Guid Uuid { get; init; } = Guid.NewGuid(); [JsonPropertyName("title_before")] public string? TitleBefore { get; set; } [JsonPropertyName("first_name")] public required string FirstName { get; set; } [JsonPropertyName("middle_name")] public string? MiddleName { get; set; } diff --git a/Models/Tag.cs b/Models/Tag.cs index 36a7467..1c901ee 100644 --- a/Models/Tag.cs +++ b/Models/Tag.cs @@ -4,6 +4,6 @@ namespace TeacherDigitalAgency.Models; public class Tag { - [JsonPropertyName("uuid")] public required string Uuid { get; init; } + [JsonPropertyName("uuid")] public Guid Uuid { get; init; } = Guid.NewGuid(); [JsonPropertyName("name")] public required string Name { get; set; } } \ No newline at end of file